Search in sources :

Example 1 with FileExecutionFactory

use of org.teiid.translator.file.FileExecutionFactory in project teiid by teiid.

the class TestEmbeddedServerAdmin method init.

@BeforeClass
public static void init() throws Exception {
    server = new EmbeddedServer();
    EmbeddedConfiguration config = new EmbeddedConfiguration();
    server.start(config);
    FileExecutionFactory executionFactory = new FileExecutionFactory();
    executionFactory.start();
    server.addTranslator("file", executionFactory);
    server.deployVDB(new FileInputStream(new File("src/test/resources/adminapi-test-vdb.xml")));
    // admin = server.getAdmin();
    admin = EmbeddedAdminFactory.getInstance().createAdmin(server);
}
Also used : FileExecutionFactory(org.teiid.translator.file.FileExecutionFactory) File(java.io.File) FileInputStream(java.io.FileInputStream) BeforeClass(org.junit.BeforeClass)

Example 2 with FileExecutionFactory

use of org.teiid.translator.file.FileExecutionFactory in project teiid by teiid.

the class TestTeiidPlatform method init.

@BeforeClass
public static void init() throws VirtualDatabaseException, ConnectorManagerException, TranslatorException, FileNotFoundException, IOException, ResourceException, SQLException {
    server = new EmbeddedServer();
    FileExecutionFactory executionFactory = new FileExecutionFactory();
    server.addTranslator("file", executionFactory);
    FileManagedConnectionFactory fileManagedconnectionFactory = new FileManagedConnectionFactory();
    fileManagedconnectionFactory.setParentDirectory(UnitTestUtil.getTestDataPath() + File.separator + "file");
    ConnectionFactory connectionFactory = fileManagedconnectionFactory.createConnectionFactory();
    ConnectionFactoryProvider<ConnectionFactory> connectionFactoryProvider = new EmbeddedServer.SimpleConnectionFactoryProvider<ConnectionFactory>(connectionFactory);
    server.addConnectionFactoryProvider("java:/marketdata-file", connectionFactoryProvider);
    EmbeddedConfiguration config = new EmbeddedConfiguration();
    server.start(config);
    DriverManager.registerDriver(server.getDriver());
    server.deployVDB(new FileInputStream(UnitTestUtil.getTestDataFile("vdb" + File.separator + "marketdata-vdb.xml")));
    factory = Persistence.createEntityManagerFactory("org.teiid.eclipselink.test");
}
Also used : ConnectionFactory(javax.resource.cci.ConnectionFactory) FileManagedConnectionFactory(org.teiid.resource.adapter.file.FileManagedConnectionFactory) FileExecutionFactory(org.teiid.translator.file.FileExecutionFactory) EmbeddedServer(org.teiid.runtime.EmbeddedServer) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) FileManagedConnectionFactory(org.teiid.resource.adapter.file.FileManagedConnectionFactory) FileInputStream(java.io.FileInputStream) BeforeClass(org.junit.BeforeClass)

Example 3 with FileExecutionFactory

use of org.teiid.translator.file.FileExecutionFactory in project teiid by teiid.

the class TestDDLMetadataStore method testConvertVDBXML.

@Test
public void testConvertVDBXML() throws Exception {
    EmbeddedConfiguration ec = new EmbeddedConfiguration();
    ec.setUseDisk(false);
    es.addTranslator("file", new FileExecutionFactory());
    es.addTranslator("h2", new ExecutionFactory<>());
    es.start(ec);
    FileInputStream vdb = new FileInputStream(UnitTestUtil.getTestDataPath() + "/" + "portfolio-vdb.xml");
    es.deployVDB(vdb);
    String content = ConvertVDB.convert(new File(UnitTestUtil.getTestDataPath() + "/" + "portfolio-vdb.xml"));
    es.undeployVDB("Portfolio");
    /*
        FileWriter fw = new FileWriter(new File(UnitTestUtil.getTestDataPath() + "/" + "portfolio-vdb.ddl"));
        fw.write(content);
        fw.close();
        */
    String expected = ObjectConverterUtil.convertFileToString(new File(UnitTestUtil.getTestDataPath() + "/" + "portfolio-vdb.ddl"));
    assertEquals(expected, content);
    // make sure the output is valid
    es.deployVDB(new ByteArrayInputStream(content.getBytes("UTF-8")), true);
}
Also used : FileExecutionFactory(org.teiid.translator.file.FileExecutionFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) File(java.io.File) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

FileInputStream (java.io.FileInputStream)3 FileExecutionFactory (org.teiid.translator.file.FileExecutionFactory)3 File (java.io.File)2 BeforeClass (org.junit.BeforeClass)2 EmbeddedConfiguration (org.teiid.runtime.EmbeddedConfiguration)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ConnectionFactory (javax.resource.cci.ConnectionFactory)1 Test (org.junit.Test)1 FileManagedConnectionFactory (org.teiid.resource.adapter.file.FileManagedConnectionFactory)1 EmbeddedServer (org.teiid.runtime.EmbeddedServer)1