Search in sources :

Example 91 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestEmbeddedServerAdmin method testSource.

@Test
public void testSource() throws AdminException {
    admin.addSource("AdminAPITestVDB", 1, "TestModel", "text-connector-test", "file", "java:/test-file");
    for (VDB vdb : admin.getVDBs()) {
        VDBMetaData vdbMetaData = (VDBMetaData) vdb;
        for (ModelMetaData m : vdbMetaData.getModelMetaDatas().values()) {
            SourceMappingMetadata mapping = m.getSourceMapping("text-connector-test");
            if (mapping != null) {
                assertEquals(mapping.getConnectionJndiName(), "java:/test-file");
                assertEquals(mapping.getTranslatorName(), "file");
            }
        }
    }
    admin.updateSource("AdminAPITestVDB", 1, "text-connector-test", "mysql", "java:/test-jdbc");
    for (VDB vdb : admin.getVDBs()) {
        VDBMetaData vdbMetaData = (VDBMetaData) vdb;
        for (ModelMetaData m : vdbMetaData.getModelMetaDatas().values()) {
            SourceMappingMetadata mapping = m.getSourceMapping("text-connector-test");
            if (mapping != null) {
                assertEquals(mapping.getConnectionJndiName(), "java:/test-jdbc");
                assertEquals(mapping.getTranslatorName(), "mysql");
            }
        }
    }
    admin.removeSource("AdminAPITestVDB", 1, "TestModel", "text-connector-test");
}
Also used : SourceMappingMetadata(org.teiid.adminapi.impl.SourceMappingMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) Test(org.junit.Test)

Example 92 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestSessionServiceImpl method testActiveVDBNameWithVersionAndVersion.

@Test
public void testActiveVDBNameWithVersionAndVersion() throws Exception {
    VDBRepository repo = Mockito.mock(VDBRepository.class);
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("name");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    Mockito.stub(repo.getLiveVDB("name", 1)).toReturn(vdb);
    ssi.setVDBRepository(repo);
    assertNull(ssi.getActiveVDB("name.1", "1"));
    assertNull(ssi.getActiveVDB("name..1", null));
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) VDBRepository(org.teiid.deployers.VDBRepository) Test(org.junit.Test)

Example 93 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestSessionServiceImpl method testAuthenticationType.

@Test
public void testAuthenticationType() throws Exception {
    // this is same as "domain/ANY"
    VDBRepository repo = Mockito.mock(VDBRepository.class);
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("name");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    vdb.addProperty(SessionServiceImpl.SECURITY_DOMAIN_PROPERTY, "domain");
    vdb.addProperty(SessionServiceImpl.GSS_PATTERN_PROPERTY, "x");
    Mockito.stub(repo.getLiveVDB("name", "1")).toReturn(vdb);
    ssi.setVDBRepository(repo);
    // this is transport default
    ssi.setAuthenticationType(AuthenticationType.USERPASSWORD);
    assertEquals(AuthenticationType.GSS, ssi.getAuthenticationType("name", "1", "x"));
    assertEquals(AuthenticationType.USERPASSWORD, ssi.getAuthenticationType("name", "1", "y"));
    assertEquals(AuthenticationType.USERPASSWORD, ssi.getAuthenticationType("name", "1", "z"));
    // testing specific domain, enforcing
    vdb = new VDBMetaData();
    vdb.setName("name1");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    vdb.addProperty(SessionServiceImpl.SECURITY_DOMAIN_PROPERTY, "domain");
    vdb.addProperty(SessionServiceImpl.AUTHENTICATION_TYPE_PROPERTY, "GSS");
    Mockito.stub(repo.getLiveVDB("name1", "1")).toReturn(vdb);
    assertEquals(AuthenticationType.GSS, ssi.getAuthenticationType("name1", "1", "x"));
    assertEquals(AuthenticationType.GSS, ssi.getAuthenticationType("name1", "1", "y"));
    // testing transport default
    vdb = new VDBMetaData();
    vdb.setName("name2");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    Mockito.stub(repo.getLiveVDB("name2", "1")).toReturn(vdb);
    assertEquals(AuthenticationType.USERPASSWORD, ssi.getAuthenticationType("name2", "1", "x"));
    assertEquals(AuthenticationType.USERPASSWORD, ssi.getAuthenticationType("name2", "1", "y"));
    // this is transport default
    ssi.setAuthenticationType(AuthenticationType.GSS);
    assertEquals(AuthenticationType.GSS, ssi.getAuthenticationType("name2", "1", "x"));
    assertEquals(AuthenticationType.GSS, ssi.getAuthenticationType("name2", "1", "y"));
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) VDBRepository(org.teiid.deployers.VDBRepository) Test(org.junit.Test)

Example 94 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestSessionServiceImpl method testActiveVDBWithSemanticVersion.

@Test
public void testActiveVDBWithSemanticVersion() throws Exception {
    VDBRepository repo = Mockito.mock(VDBRepository.class);
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("name.1.2.3");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    Mockito.stub(repo.getLiveVDB("name.1.2.3")).toReturn(vdb);
    ssi.setVDBRepository(repo);
    ssi.getActiveVDB("name.1.2.3", null);
    Mockito.verify(repo, Mockito.times(1)).getLiveVDB("name.1.2.3");
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) VDBRepository(org.teiid.deployers.VDBRepository) Test(org.junit.Test)

Example 95 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestSessionServiceImpl method testActiveVDBWithVersion.

@Test
public void testActiveVDBWithVersion() throws Exception {
    VDBRepository repo = Mockito.mock(VDBRepository.class);
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("name");
    vdb.setVersion(1);
    vdb.setStatus(Status.ACTIVE);
    Mockito.stub(repo.getLiveVDB("name", "1")).toReturn(vdb);
    ssi.setVDBRepository(repo);
    ssi.getActiveVDB("name", "1");
    Mockito.verify(repo, Mockito.times(1)).getLiveVDB("name", "1");
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) VDBRepository(org.teiid.deployers.VDBRepository) Test(org.junit.Test)

Aggregations

VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)121 Test (org.junit.Test)48 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)36 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)16 MetadataStore (org.teiid.metadata.MetadataStore)15 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)14 VDBRepository (org.teiid.deployers.VDBRepository)12 ArrayList (java.util.ArrayList)10 IOException (java.io.IOException)9 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)9 Properties (java.util.Properties)8 XMLStreamException (javax.xml.stream.XMLStreamException)8 VDBImportMetadata (org.teiid.adminapi.impl.VDBImportMetadata)8 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)7 TeiidComponentException (org.teiid.core.TeiidComponentException)7 VDBKey (org.teiid.vdb.runtime.VDBKey)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 VDBTranslatorMetaData (org.teiid.adminapi.impl.VDBTranslatorMetaData)6 Schema (org.teiid.metadata.Schema)6 SessionMetadata (org.teiid.adminapi.impl.SessionMetadata)5