@Description(
description: [
'Each database mode is a separate real database. Data can be staged into',
'each database independently, or to multiple at once.'
]
)
@Database(id: 'edw', modes: ['lkp', 'tgt'])
class stage_with_modes {
@Description(
description: [
'Stages the data to a single database mode'
]
)
@Test
stageToSingleMode(){
stage(
source: 'DATA_FILE',
target-table: 'TEST_TABLE',
mode: 'lkp'
);
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', mode: 'lkp');
// because we staged to the lkp mode, the tgt mode is still empty
assert(assertion-mode: 'empty', source-table: 'TEST_TABLE', mode: 'tgt');
}
@Description(
description: [
'Stages the data to multiple database modes at once'
]
)
@Test
stageToMultipleModes(){
stage(
source: 'DATA_FILE',
target-table: 'TEST_TABLE',
modes: ['lkp', 'tgt']
);
// because we staged to both modes, both databases contain the data
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', mode: 'tgt');
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', mode: 'lkp');
}
@Database(id: 'edw-ii', modes: ['src'])
@Description(
description: [
'Stages the data to multiple database connections at once',
'These dont have to be related at all except that they contain the same table.',
'Additionally, the Database tag on this test prepares a database that is available',
'for this test only.'
]
)
@Test
stageToMultipleConnections(){
stage(
source: 'DATA_FILE',
target-table: 'TEST_TABLE',
connections:
{
edw: {
modes: ['lkp', 'tgt']
},
edw-ii: {
mode: 'src'
}
}
);
// because we staged to both modes, both databases contain the data
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', connection-id: 'edw', mode: 'tgt');
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', connection-id: 'edw', mode: 'lkp');
// we also posted it here
assert(source-table: 'TEST_TABLE', target: 'DATA_FILE', connection-id: 'edw-ii', mode: 'src');
}
} |