Search in sources :

Example 1 with SpoonDelegates

use of org.pentaho.di.ui.spoon.delegates.SpoonDelegates in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method setUp.

@Before
public void setUp() {
    spoon = mock(Spoon.class);
    // when( spoon.getRepository() ).thenReturn( spoon.rep );
    spoonDelegates = mock(SpoonDelegates.class);
    spoonDelegates.jobs = new SpoonJobDelegate(spoon);
    spoonDelegates.trans = new SpoonTransformationDelegate(spoon);
    spoonDelegates.db = new SpoonDBDelegate(spoon);
    spoonDelegates.slaves = new SpoonSlaveDelegate(spoon);
    spoonDelegates.partitions = new SpoonPartitionsDelegate(spoon);
    spoonDelegates.clusters = new SpoonClustersDelegate(spoon);
    spoon.delegates = spoonDelegates;
    sharedUtil = new SharedObjectSyncUtil(spoon);
    repository = mock(Repository.class);
}
Also used : SpoonSlaveDelegate(org.pentaho.di.ui.spoon.delegates.SpoonSlaveDelegate) SpoonTransformationDelegate(org.pentaho.di.ui.spoon.delegates.SpoonTransformationDelegate) Repository(org.pentaho.di.repository.Repository) SpoonPartitionsDelegate(org.pentaho.di.ui.spoon.delegates.SpoonPartitionsDelegate) SpoonClustersDelegate(org.pentaho.di.ui.spoon.delegates.SpoonClustersDelegate) SpoonDBDelegate(org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate) SpoonDelegates(org.pentaho.di.ui.spoon.delegates.SpoonDelegates) SpoonJobDelegate(org.pentaho.di.ui.spoon.delegates.SpoonJobDelegate) Before(org.junit.Before)

Example 2 with SpoonDelegates

use of org.pentaho.di.ui.spoon.delegates.SpoonDelegates in project pentaho-kettle by pentaho.

the class SpoonTest method prepareSetShellTextTests.

private static Shell prepareSetShellTextTests(Spoon spoon, AbstractMeta abstractMeta, boolean versionEnabled, boolean isTransformation, boolean repIsNull, boolean revIsNull, boolean hasChanged, boolean nameIsNull, boolean filenameIsNull, boolean tabNameIsNull) {
    Shell mockShell = mock(Shell.class);
    ObjectRevision mockObjectRevision = revIsNull ? null : mock(ObjectRevision.class);
    RepositoryDirectory mockRepDirectory = mock(RepositoryDirectory.class);
    Repository mockRepository = repIsNull ? null : mock(Repository.class);
    RepositorySecurityProvider mockRepSecurityProvider = mock(RepositorySecurityProvider.class);
    SpoonDelegates mockDelegate = mock(SpoonDelegates.class);
    SpoonTabsDelegate mockDelegateTabs = mock(SpoonTabsDelegate.class);
    spoon.rep = mockRepository;
    spoon.delegates = mockDelegate;
    mockDelegate.tabs = mockDelegateTabs;
    doCallRealMethod().when(spoon).openSpoon();
    doCallRealMethod().when(spoon).setShellText();
    doReturn(mockShell).when(spoon).getShell();
    if (!tabNameIsNull) {
        doReturn("tabName").when(spoon).getActiveTabText();
    }
    doReturn(false).when(mockShell).isDisposed();
    setTransJobValues(abstractMeta, spoon, mockObjectRevision, mockRepDirectory, isTransformation, hasChanged, nameIsNull, filenameIsNull);
    if (!revIsNull) {
        doReturn("1.0").when(mockObjectRevision).getName();
    }
    doReturn("/admin").when(mockRepDirectory).getPath();
    Mockito.doReturn(null).when(abstractMeta).getVersioningEnabled();
    if (!repIsNull) {
        doReturn(mockRepSecurityProvider).when(mockRepository).getSecurityProvider();
        doReturn(versionEnabled).when(mockRepSecurityProvider).isVersioningEnabled(anyString());
    }
    doReturn("RepositoryName").when(spoon).getRepositoryName();
    doReturn(new ArrayList<TabMapEntry>()).when(mockDelegateTabs).getTabs();
    try {
        spoon.openSpoon();
    } catch (NullPointerException e) {
    // ignore work is done
    }
    spoon.setShellText();
    return mockShell;
}
Also used : ObjectRevision(org.pentaho.di.repository.ObjectRevision) RepositorySecurityProvider(org.pentaho.di.repository.RepositorySecurityProvider) Shell(org.eclipse.swt.widgets.Shell) Repository(org.pentaho.di.repository.Repository) RepositoryDirectory(org.pentaho.di.repository.RepositoryDirectory) SpoonDelegates(org.pentaho.di.ui.spoon.delegates.SpoonDelegates) SpoonTabsDelegate(org.pentaho.di.ui.spoon.delegates.SpoonTabsDelegate)

Aggregations

Repository (org.pentaho.di.repository.Repository)2 SpoonDelegates (org.pentaho.di.ui.spoon.delegates.SpoonDelegates)2 Shell (org.eclipse.swt.widgets.Shell)1 Before (org.junit.Before)1 ObjectRevision (org.pentaho.di.repository.ObjectRevision)1 RepositoryDirectory (org.pentaho.di.repository.RepositoryDirectory)1 RepositorySecurityProvider (org.pentaho.di.repository.RepositorySecurityProvider)1 SpoonClustersDelegate (org.pentaho.di.ui.spoon.delegates.SpoonClustersDelegate)1 SpoonDBDelegate (org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate)1 SpoonJobDelegate (org.pentaho.di.ui.spoon.delegates.SpoonJobDelegate)1 SpoonPartitionsDelegate (org.pentaho.di.ui.spoon.delegates.SpoonPartitionsDelegate)1 SpoonSlaveDelegate (org.pentaho.di.ui.spoon.delegates.SpoonSlaveDelegate)1 SpoonTabsDelegate (org.pentaho.di.ui.spoon.delegates.SpoonTabsDelegate)1 SpoonTransformationDelegate (org.pentaho.di.ui.spoon.delegates.SpoonTransformationDelegate)1