use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class VDBStatusChecker method resourceAdded.
void resourceAdded(String resourceName) {
List<Runnable> runnables = new ArrayList<Runnable>();
for (CompositeVDB cvdb : getVDBRepository().getCompositeVDBs()) {
VDBMetaData vdb = cvdb.getVDB();
if (vdb.getStatus() == Status.FAILED) {
continue;
}
resourceAdded(resourceName, runnables, vdb);
}
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class VDBStatusChecker method dataSourceAdded.
public void dataSourceAdded(String dataSourceName, VDBKey vdbKey) {
dataSourceName = stripContext(dataSourceName);
if (vdbKey == null) {
// scan all
resourceAdded(dataSourceName);
} else {
CompositeVDB cvdb = getVDBRepository().getCompositeVDB(vdbKey);
if (cvdb == null) {
return;
}
VDBMetaData vdb = cvdb.getVDB();
resourceAdded(dataSourceName, new LinkedList<Runnable>(), vdb);
}
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestRestWebArchiveBuilder method getTestVDBMetaData.
private VDBMetaData getTestVDBMetaData() throws FileNotFoundException, XMLStreamException {
VDBMetaData vdb = VDBMetadataParser.unmarshell(new FileInputStream(UnitTestUtil.getTestDataFile("sample-vdb.xml")));
MetadataStore ms = new MetadataStore();
for (ModelMetaData model : vdb.getModelMetaDatas().values()) {
MetadataFactory mf = TestDDLParser.helpParse(model.getSchemaText(), model.getName());
ms.addSchema(mf.getSchema());
}
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(ms, "Rest");
vdb.addAttchment(QueryMetadataInterface.class, metadata);
vdb.addAttchment(TransformationMetadata.class, metadata);
vdb.addAttchment(MetadataStore.class, ms);
return vdb;
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestRestWebArchiveBuilder method testBuildArchiveSwagger.
@Test
public void testBuildArchiveSwagger() throws Exception {
VDBMetaData vdb = getTestVDBMetaData();
RestASMBasedWebArchiveBuilder builder = new RestASMBasedWebArchiveBuilder();
MetadataStore metadataStore = vdb.getAttachment(TransformationMetadata.class).getMetadataStore();
for (ModelMetaData model : vdb.getModelMetaDatas().values()) {
Schema schema = metadataStore.getSchema(model.getName());
byte[] viewContents = builder.getViewClass(vdb.getName(), vdb.getVersion(), model.getName(), schema, false);
if (viewContents != null) {
Class<?> cls = ASMUtilities.defineClass("org.teiid.jboss.rest.View", viewContents);
Set<Annotation> annotationSet = new HashSet<Annotation>();
for (Annotation annotation : cls.getAnnotations()) {
annotationSet.add(annotation);
}
assertEquals(2, annotationSet.size());
for (Method m : cls.getMethods()) {
if (m.getName().equals("g1Tableapplication_xml")) {
ApiOperation annotation = m.getAnnotation(ApiOperation.class);
assertEquals("g1Table", annotation.value());
} else if (m.getName().equals("sqlQueryxml")) {
ApiOperation annotation = m.getAnnotation(ApiOperation.class);
assertEquals("xml", annotation.value());
} else if (m.getName().equals("sqlQueryjson")) {
ApiOperation annotation = m.getAnnotation(ApiOperation.class);
assertEquals("json", annotation.value());
}
}
}
}
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestRestWebArchiveBuilder method testBuildArchive.
@Test
public void testBuildArchive() throws Exception {
VDBMetaData vdb = getTestVDBMetaData();
RestASMBasedWebArchiveBuilder builder = new RestASMBasedWebArchiveBuilder();
byte[] contents = builder.getContent(vdb);
ArrayList<String> files = new ArrayList<String>();
files.add("WEB-INF/web.xml");
files.add("WEB-INF/jboss-web.xml");
files.add("WEB-INF/classes/org/teiid/jboss/rest/View.class");
files.add("WEB-INF/classes/org/teiid/jboss/rest/TeiidRestApplication.class");
files.add("WEB-INF/classes/org/teiid/jboss/rest/Bootstrap.class");
files.add("META-INF/MANIFEST.MF");
files.add("api.html");
files.add("images/teiid_logo_450px.png");
files.add("swagger/swagger-ui.js");
files.add("swagger/css/print.css");
files.add("swagger/css/reset.css");
files.add("swagger/css/screen.css");
files.add("swagger/css/style.css");
files.add("swagger/css/typography.css");
files.add("swagger/images/favicon-16x16.png");
files.add("swagger/images/favicon-32x32.png");
files.add("swagger/lang/en.js");
files.add("swagger/lang/es.js");
files.add("swagger/lang/pt.js");
files.add("swagger/lang/ru.js");
files.add("swagger/lang/translator.js");
files.add("swagger/lib/backbone-min.js");
files.add("swagger/lib/handlebars-2.0.0.js");
files.add("swagger/lib/highlight.7.3.pack.js");
files.add("swagger/lib/jquery-1.8.0.min.js");
files.add("swagger/lib/jquery.ba-bbq.min.js");
files.add("swagger/lib/jquery.slideto.min.js");
files.add("swagger/lib/jquery.wiggle.min.js");
files.add("swagger/lib/marked.js");
files.add("swagger/lib/swagger-oauth.js");
files.add("swagger/lib/underscore-min.js");
files.add("swagger/lib/underscore-min.map");
ZipInputStream zipIn = new ZipInputStream(new ByteArrayInputStream(contents));
ZipEntry ze;
while ((ze = zipIn.getNextEntry()) != null) {
assertTrue(files.contains(ze.getName()));
zipIn.closeEntry();
}
}
Aggregations