Search in sources :

Example 36 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class PartitionSettingsTest method defaultSelectedSchemaIndexIsFoundBySchemaName.

@Test
public void defaultSelectedSchemaIndexIsFoundBySchemaName() throws Exception {
    PartitionSchema schema = new PartitionSchema("qwerty", 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(1, 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 37 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class PartitionSettingsTest method metaIsUpdated.

@Test
public void metaIsUpdated() {
    PartitionSchema schema = new PartitionSchema("1", Collections.<String>emptyList());
    StepPartitioningMeta meta = mock(StepPartitioningMeta.class);
    when(stepMeta.getStepPartitioningMeta()).thenReturn(meta);
    settings.updateSchema(schema);
    verify(meta).setPartitionSchema(schema);
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) Test(org.junit.Test)

Example 38 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class PartitionSettingsTest method metaIsNotUpdatedWithNameless.

@Test
public void metaIsNotUpdatedWithNameless() {
    PartitionSchema schema = new PartitionSchema(null, Collections.<String>emptyList());
    StepPartitioningMeta meta = mock(StepPartitioningMeta.class);
    when(stepMeta.getStepPartitioningMeta()).thenReturn(meta);
    settings.updateSchema(null);
    verify(meta, never()).setPartitionSchema(any(PartitionSchema.class));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) Test(org.junit.Test)

Example 39 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class Spoon method doubleClickedInTree.

/**
 * Reaction to double click
 */
private void doubleClickedInTree(Tree tree, boolean shift) {
    TreeSelection[] objects = getTreeObjects(tree);
    if (objects.length != 1) {
        // not yet supported, we can do this later when the OSX bug
        return;
    // goes away
    }
    TreeSelection object = objects[0];
    final Object selection = object.getSelection();
    final Object parent = object.getParent();
    if (selection instanceof Class<?>) {
        if (selection.equals(TransMeta.class)) {
            newTransFile();
        }
        if (selection.equals(JobMeta.class)) {
            newJobFile();
        }
        if (selection.equals(TransHopMeta.class)) {
            newHop((TransMeta) parent);
        }
        if (selection.equals(DatabaseMeta.class)) {
            delegates.db.newConnection();
        }
        if (selection.equals(PartitionSchema.class)) {
            newPartitioningSchema((TransMeta) parent);
        }
        if (selection.equals(ClusterSchema.class)) {
            newClusteringSchema((TransMeta) parent);
        }
        if (selection.equals(SlaveServer.class)) {
            newSlaveServer((HasSlaveServersInterface) parent);
        }
    } else {
        if (selection instanceof TransMeta) {
            TransGraph.editProperties((TransMeta) selection, this, rep, true);
        }
        if (selection instanceof JobMeta) {
            JobGraph.editProperties((JobMeta) selection, this, rep, true);
        }
        if (selection instanceof PluginInterface) {
            PluginInterface plugin = (PluginInterface) selection;
            if (plugin.getPluginType().equals(StepPluginType.class)) {
                TransGraph transGraph = getActiveTransGraph();
                if (transGraph != null) {
                    transGraph.addStepToChain(plugin, shift);
                }
            }
            if (plugin.getPluginType().equals(JobEntryPluginType.class)) {
                JobGraph jobGraph = getActiveJobGraph();
                if (jobGraph != null) {
                    jobGraph.addJobEntryToChain(object.getItemText(), shift);
                }
            }
        }
        if (selection instanceof DatabaseMeta) {
            DatabaseMeta database = (DatabaseMeta) selection;
            delegates.db.editConnection(database);
        }
        if (selection instanceof StepMeta) {
            StepMeta step = (StepMeta) selection;
            delegates.steps.editStep((TransMeta) parent, step);
            sharedObjectSyncUtil.synchronizeSteps(step);
        }
        if (selection instanceof JobEntryCopy) {
            editJobEntry((JobMeta) parent, (JobEntryCopy) selection);
        }
        if (selection instanceof TransHopMeta) {
            editHop((TransMeta) parent, (TransHopMeta) selection);
        }
        if (selection instanceof PartitionSchema) {
            editPartitionSchema((TransMeta) parent, (PartitionSchema) selection);
        }
        if (selection instanceof ClusterSchema) {
            delegates.clusters.editClusterSchema((TransMeta) parent, (ClusterSchema) selection);
        }
        if (selection instanceof SlaveServer) {
            editSlaveServer((SlaveServer) selection);
        }
        editSelectionTreeExtension(selection);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) PartitionSchema(org.pentaho.di.partition.PartitionSchema) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) TransMeta(org.pentaho.di.trans.TransMeta) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) RepositoryObject(org.pentaho.di.repository.RepositoryObject) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) FileObject(org.apache.commons.vfs2.FileObject) TransHopMeta(org.pentaho.di.trans.TransHopMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema)

Example 40 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class Spoon method editPartitionSchema.

public void editPartitionSchema() {
    final TransMeta transMeta = (TransMeta) selectionObjectParent;
    final PartitionSchema partitionSchema = (PartitionSchema) selectionObject;
    editPartitionSchema(transMeta, partitionSchema);
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta)

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