Search in sources :

Example 31 with PartitionSchema

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));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Example 32 with PartitionSchema

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));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Example 33 with PartitionSchema

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());
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) Test(org.junit.Test)

Example 34 with PartitionSchema

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;
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta)

Example 35 with PartitionSchema

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));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Aggregations

PartitionSchema (org.pentaho.di.partition.PartitionSchema)74 KettleException (org.pentaho.di.core.exception.KettleException)26 TransMeta (org.pentaho.di.trans.TransMeta)19 StepMeta (org.pentaho.di.trans.step.StepMeta)19 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)18 SlaveServer (org.pentaho.di.cluster.SlaveServer)18 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)17 StepPartitioningMeta (org.pentaho.di.trans.step.StepPartitioningMeta)17 Test (org.junit.Test)16 ArrayList (java.util.ArrayList)15 ObjectId (org.pentaho.di.repository.ObjectId)14 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)10 List (java.util.List)8 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)8 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)6 StringObjectId (org.pentaho.di.repository.StringObjectId)6 PartitionSchemaDialog (org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog)6 MessageBox (org.eclipse.swt.widgets.MessageBox)5 Point (org.pentaho.di.core.gui.Point)5 IOException (java.io.IOException)4