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");
}
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));
}
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"));
}
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");
}
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");
}
Aggregations