use of org.pentaho.di.repository.RepositoryObject in project pdi-dataservice-server-plugin by pentaho.
the class ServiceTransTest method testRepoIdStorageMethod.
@Test
public void testRepoIdStorageMethod() throws KettleException {
ObjectId transId = new StringObjectId("transId");
when(repository.loadTransformation(eq(transId), isNull(String.class))).thenReturn(transMeta);
ServiceTrans.StorageMethod method = ServiceTrans.StorageMethod.REPO_ID;
when(repository.getObjectInformation(any(ObjectId.class), eq(RepositoryObjectType.TRANSFORMATION))).thenReturn(mock(RepositoryObject.class)).thenThrow(new KettleException());
assertThat(method.exists(repository, transId.getId()), is(true));
assertThat(method.exists(repository, "/nonExistingTrans"), is(false));
RepositoryObject transInfo = mock(RepositoryObject.class);
when(transInfo.isDeleted()).thenReturn(false, true);
when(repository.getObjectInformation(eq(transId), eq(RepositoryObjectType.TRANSFORMATION))).thenReturn(transInfo);
assertThat(method.load(repository, transId.getId()), is(transMeta));
assertThat(method.load(repository, transId.getId()), is(nullValue()));
}
Aggregations