Search in sources :

Example 1 with UIRepositoryObjects

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects in project pentaho-kettle by pentaho.

the class UIEERepositoryDirectoryTest method testDelete.

@Test
public void testDelete() throws Exception {
    UIRepositoryDirectories mockUIRepositoryDirectories = mock(UIRepositoryDirectories.class);
    when(mockUIRepositoryDirectories.contains(uiRepDir)).thenReturn(true);
    when(mockParent.getChildren()).thenReturn(mockUIRepositoryDirectories);
    UIRepositoryObjects mockUIRepositoryObjects = mock(UIRepositoryObjects.class);
    when(mockUIRepositoryObjects.contains(uiRepDir)).thenReturn(true);
    when(mockParent.getRepositoryObjects()).thenReturn(mockUIRepositoryObjects);
    uiRepDir.delete(false);
    verify(mockRepository).deleteRepositoryDirectory(mockRepositoryDirectory);
    verify(mockUIRepositoryDirectories, times(1)).remove(uiRepDir);
    verify(mockUIRepositoryObjects, times(1)).remove(uiRepDir);
    verify(mockParent, times(1)).refresh();
    uiPurRepDir.delete(false);
    verify(mockPurRepository).deleteRepositoryDirectory(mockRepositoryDirectory, false);
    verify(mockUIRepositoryDirectories, times(2)).remove(uiPurRepDir);
    verify(mockUIRepositoryObjects, times(2)).remove(uiPurRepDir);
    verify(mockParent, times(2)).refresh();
}
Also used : UIRepositoryObjects(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects) UIRepositoryDirectories(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectories) Test(org.junit.Test)

Example 2 with UIRepositoryObjects

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects in project pentaho-kettle by pentaho.

the class BrowseController method setRepositoryDirectories.

public void setRepositoryDirectories(List<UIRepositoryDirectory> selectedFolderItems) {
    List<UIRepositoryDirectory> previousVal = null;
    UIRepositoryObjects previousRepoObjects = null;
    try {
        if (repositoryDirectories != null && repositoryDirectories.size() > 0) {
            previousVal = new ArrayList<UIRepositoryDirectory>();
            previousVal.addAll(repositoryDirectories);
            previousRepoObjects = getSelectedRepoDirChildren();
        }
        // Remove children listener
        if (this.repositoryDirectories != null && this.repositoryDirectories.size() > 0) {
            this.repositoryDirectories.get(0).getRepositoryObjects().removePropertyChangeListener(fileChildrenListener);
        }
        this.repositoryDirectories = selectedFolderItems;
        // Add children Listener
        if (this.repositoryDirectories != null && this.repositoryDirectories.size() > 0) {
            this.repositoryDirectories.get(0).getRepositoryObjects().addPropertyChangeListener("children", fileChildrenListener);
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            throw new RuntimeException(e);
        }
    }
    fireFoldersAndItemsChange(previousVal, previousRepoObjects);
}
Also used : UIRepositoryDirectory(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory) KettleException(org.pentaho.di.core.exception.KettleException) UIRepositoryObjects(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects)

Example 3 with UIRepositoryObjects

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects in project pdi-dataservice-server-plugin by pentaho.

the class DeleteRepositoryObjectExtensionPointPluginTest method setUp.

@Before
public void setUp() throws Exception {
    when(context.getMetaStoreUtil()).thenReturn(metaStoreUtil);
    plugin = new DeleteRepositoryObjectExtensionPointPlugin(context);
    repoObjects = new UIRepositoryObjects(asList(repositoryObject));
    repoDirectories = new UIRepositoryDirectories();
    repoDirectories.add(repositorySubDirectory);
}
Also used : UIRepositoryObjects(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects) UIRepositoryDirectories(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectories) Before(org.junit.Before)

Example 4 with UIRepositoryObjects

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects in project pdi-dataservice-server-plugin by pentaho.

the class DeleteRepositoryObjectExtensionPointPluginTest method testCallExtensionPointWEmptyDirectory.

@Test
public void testCallExtensionPointWEmptyDirectory() throws Exception {
    when(repositoryExtension.getRepositoryObject()).thenReturn(repositoryEmptyDirectory);
    when(repositoryEmptyDirectory.getChildren()).thenReturn(null);
    when(repositoryEmptyDirectory.getRepositoryObjects()).thenReturn(new UIRepositoryObjects());
    plugin.callExtensionPoint(log, repositoryExtension);
    verify(repositoryExtension).getRepositoryObject();
    verify(repositoryEmptyDirectory).getChildren();
    verify(repositoryEmptyDirectory).getChildren();
    verify(repositoryEmptyDirectory).getRepositoryObjects();
    verify(metaStoreUtil, never()).clearReferences(any(TransMeta.class));
}
Also used : UIRepositoryObjects(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Aggregations

UIRepositoryObjects (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObjects)4 Test (org.junit.Test)2 UIRepositoryDirectories (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectories)2 Before (org.junit.Before)1 KettleException (org.pentaho.di.core.exception.KettleException)1 TransMeta (org.pentaho.di.trans.TransMeta)1 UIRepositoryDirectory (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory)1