Search in sources :

Example 6 with IMetaverseObjectFactory

use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.

the class DocumentControllerTest method testGetMetaverseObjectFactory_nullBuilder.

@Test
public void testGetMetaverseObjectFactory_nullBuilder() throws Exception {
    DocumentController dc = new DocumentController(null);
    IMetaverseObjectFactory factory = mock(IMetaverseObjectFactory.class);
    assertNull(dc.getMetaverseObjectFactory());
    verify(mockBuilder, never()).getMetaverseObjectFactory();
}
Also used : IMetaverseObjectFactory(org.pentaho.metaverse.api.IMetaverseObjectFactory) Test(org.junit.Test)

Example 7 with IMetaverseObjectFactory

use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.

the class DocumentControllerTest method setup.

@Before
public void setup() {
    docController = new DocumentController();
    IMetaverseBuilder builder = mock(IMetaverseBuilder.class);
    docController.setMetaverseBuilder(builder);
    IMetaverseObjectFactory objectFactory = mock(IMetaverseObjectFactory.class);
    docController.setMetaverseObjectFactory(objectFactory);
    initAnalyzers();
}
Also used : IMetaverseObjectFactory(org.pentaho.metaverse.api.IMetaverseObjectFactory) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) Before(org.junit.Before)

Example 8 with IMetaverseObjectFactory

use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.

the class JobEntryAnalyzerTest method setUp.

/**
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
    when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
    JobEntryAnalyzer baseAnalyzer = new JobEntryAnalyzer() {

        @Override
        public Set<Class<? super JobEntryCopy>> getSupportedEntries() {
            return null;
        }

        @Override
        protected void customAnalyze(JobEntryInterface entry, IMetaverseNode rootNode) throws MetaverseAnalyzerException {
        // TODO Auto-generated method stub
        }
    };
    analyzer = spy(baseAnalyzer);
    analyzer.setMetaverseBuilder(mockBuilder);
    when(mockEntry.getEntry()).thenReturn(mockJobEntryInterface);
    when(mockJobEntryInterface.getPluginId()).thenReturn("Base job entry");
    when(mockJobEntryInterface.getParentJob()).thenReturn(mockJob);
    when(mockJob.getJobMeta()).thenReturn(mockJobMeta);
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) IMetaverseObjectFactory(org.pentaho.metaverse.api.IMetaverseObjectFactory) AfterClass(org.junit.AfterClass) BeforeClass(org.junit.BeforeClass) Before(org.junit.Before)

Example 9 with IMetaverseObjectFactory

use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.

the class JobAnalyzerTest method setUp.

/**
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
    when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
    analyzer = new JobAnalyzer();
    analyzer.setMetaverseBuilder(mockBuilder);
    when(namespace.getParentNamespace()).thenReturn(namespace);
    when(mockJobDoc.getType()).thenReturn(DictionaryConst.NODE_TYPE_JOB);
    when(mockJobDoc.getContent()).thenReturn(mockContent);
    when(mockJobDoc.getNamespace()).thenReturn(namespace);
    when(mockContent.nrJobEntries()).thenReturn(1);
    when(mockContent.getJobEntry(0)).thenReturn(mockJobEntry);
    when(mockJobEntry.getEntry()).thenReturn(mockJobEntryInterface);
    when(mockJobEntryInterface.getParentJob()).thenReturn(mockJob);
    when(mockJob.getJobMeta()).thenReturn(mockContent);
    when(mockContent.listVariables()).thenReturn(new String[] {});
    final String PARAM = "param1";
    when(mockContent.listParameters()).thenReturn(new String[] { PARAM });
    when(mockContent.getParameterDefault(PARAM)).thenReturn("default");
    descriptor = new MetaverseComponentDescriptor("name", DictionaryConst.NODE_TYPE_JOB, namespace);
}
Also used : IMetaverseObjectFactory(org.pentaho.metaverse.api.IMetaverseObjectFactory) Matchers.anyString(org.mockito.Matchers.anyString) MetaverseComponentDescriptor(org.pentaho.metaverse.api.MetaverseComponentDescriptor) Before(org.junit.Before)

Example 10 with IMetaverseObjectFactory

use of org.pentaho.metaverse.api.IMetaverseObjectFactory in project pentaho-metaverse by pentaho.

the class MongoDbConnectionAnalyzerTest method setUp.

@Before
public void setUp() throws Exception {
    IMetaverseObjectFactory factory = MetaverseTestUtils.getMetaverseObjectFactory();
    when(mockBuilder.getMetaverseObjectFactory()).thenReturn(factory);
    analyzer = new MongoDbConnectionAnalyzer();
    analyzer.setMetaverseBuilder(mockBuilder);
    when(mockDescriptor.getNamespace()).thenReturn(mock(INamespace.class));
    when(mockDescriptor.getContext()).thenReturn(mock(IAnalysisContext.class));
    when(mongoDbMeta.getHostnames()).thenReturn("localhost");
    when(mongoDbMeta.getDbName()).thenReturn("db");
    when(mongoDbMeta.getAuthenticationUser()).thenReturn("user");
    when(mongoDbMeta.getPort()).thenReturn("12345");
}
Also used : INamespace(org.pentaho.metaverse.api.INamespace) IMetaverseObjectFactory(org.pentaho.metaverse.api.IMetaverseObjectFactory) IAnalysisContext(org.pentaho.metaverse.api.IAnalysisContext) Before(org.junit.Before)

Aggregations

IMetaverseObjectFactory (org.pentaho.metaverse.api.IMetaverseObjectFactory)18 Before (org.junit.Before)10 Test (org.junit.Test)7 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)6 IDocument (org.pentaho.metaverse.api.IDocument)3 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)3 INamespace (org.pentaho.metaverse.api.INamespace)3 Matchers.anyString (org.mockito.Matchers.anyString)2 IConnectionAnalyzer (org.pentaho.metaverse.api.IConnectionAnalyzer)2 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)2 Graph (com.tinkerpop.blueprints.Graph)1 TinkerGraph (com.tinkerpop.blueprints.impls.tg.TinkerGraph)1 AfterClass (org.junit.AfterClass)1 BeforeClass (org.junit.BeforeClass)1 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)1 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)1 IAnalysisContext (org.pentaho.metaverse.api.IAnalysisContext)1 IDocumentAnalyzer (org.pentaho.metaverse.api.IDocumentAnalyzer)1 IDocumentController (org.pentaho.metaverse.api.IDocumentController)1 MetaverseException (org.pentaho.metaverse.api.MetaverseException)1