use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizePartitionSchemas_sync_shared_only.
@Test
public void synchronizePartitionSchemas_sync_shared_only() throws Exception {
final String partitionSchemaName = "PartitionSchema";
TransMeta transformarion1 = createTransMeta();
PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
PartitionSchema unsharedPartitionSchema2 = createPartitionSchema(partitionSchemaName, false);
transformarion2.setPartitionSchemas(Collections.singletonList(unsharedPartitionSchema2));
spoonDelegates.trans.addTransformation(transformarion2);
TransMeta transformarion3 = createTransMeta();
PartitionSchema partitionSchema3 = createPartitionSchema(partitionSchemaName, true);
transformarion3.setPartitionSchemas(Collections.singletonList(partitionSchema3));
spoonDelegates.trans.addTransformation(transformarion3);
partitionSchema3.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
sharedUtil.synchronizePartitionSchemas(partitionSchema3);
assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(AFTER_SYNC_VALUE));
assertThat(unsharedPartitionSchema2.getNumberOfPartitionsPerSlave(), equalTo(BEFORE_SYNC_VALUE));
}
use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizePartitionSchemas_should_not_sync_unshared.
@Test
public void synchronizePartitionSchemas_should_not_sync_unshared() throws Exception {
final String partitionSchemaName = "PartitionSchema";
TransMeta transformarion1 = createTransMeta();
PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
PartitionSchema partitionSchema2 = createPartitionSchema(partitionSchemaName, false);
transformarion2.setPartitionSchemas(Collections.singletonList(partitionSchema2));
spoonDelegates.trans.addTransformation(transformarion2);
partitionSchema2.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
sharedUtil.synchronizePartitionSchemas(partitionSchema2);
assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(BEFORE_SYNC_VALUE));
}
use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.
the class PartitionSettingsTest method defaultSelectedSchemaIndexIsNilWhenNotFoundBySchemaName.
@Test
public void defaultSelectedSchemaIndexIsNilWhenNotFoundBySchemaName() throws Exception {
PartitionSchema schema = new PartitionSchema("asdfg", Collections.<String>emptyList());
StepPartitioningMeta meta = mock(StepPartitioningMeta.class);
when(meta.getPartitionSchema()).thenReturn(schema);
when(stepMeta.getStepPartitioningMeta()).thenReturn(meta);
List<String> schemas = Arrays.asList("1", plugin.getName(), "2");
when(partitionSchemasProvider.getPartitionSchemasNames(any(TransMeta.class))).thenReturn(schemas);
assertEquals(0, settings.getDefaultSelectedSchemaIndex());
}
use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.
the class SpoonRefreshPartitionsSubtreeTest method prepareMetaWithThreeSchemas.
private static TransMeta prepareMetaWithThreeSchemas() {
TransMeta meta = mock(TransMeta.class);
List<PartitionSchema> schemas = asList(mockSchema("1"), mockSchema("2"), mockSchema("3"));
when(meta.getPartitionSchemas()).thenReturn(schemas);
return meta;
}
use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.
the class SharedObjectSyncUtilTest method synchronizePartitionSchemas.
@Test
public void synchronizePartitionSchemas() throws Exception {
final String partitionSchemaName = "SharedPartitionSchema";
TransMeta transformarion1 = createTransMeta();
PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
spoonDelegates.trans.addTransformation(transformarion1);
TransMeta transformarion2 = createTransMeta();
PartitionSchema partitionSchema2 = createPartitionSchema(partitionSchemaName, true);
transformarion2.setPartitionSchemas(Collections.singletonList(partitionSchema2));
spoonDelegates.trans.addTransformation(transformarion2);
partitionSchema2.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
sharedUtil.synchronizePartitionSchemas(partitionSchema2);
assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(AFTER_SYNC_VALUE));
}
Aggregations