@Test public void testOtherModels() throws VirtualDatabaseException { RestWarGenerator generator = Mockito.mock(RestWarGenerator.class); ResteasyEnabler resteasyEnabler = new ResteasyEnabler(generator) { Admin getAdmin() { return Mockito.mock(Admin.class); } Executor getExecutor() { return ExecutorUtils.getDirectExecutor(); } }; MetadataStore ms = new MetadataStore(); CompositeVDB vdb = TestCompositeVDB.createCompositeVDB(ms, "x"); vdb.getVDB().addProperty("{http: ModelMetaData model = new ModelMetaData(); model.setName("other"); model.setModelType(Type.OTHER); vdb.getVDB().addModel(model); resteasyEnabler.finishedDeployment("x", vdb); }
@Override public void finishedDeployment(String name, CompositeVDB cvdb) { final VDBMetaData vdb = cvdb.getVDB(); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } final String warName = buildName(name, cvdb.getVDB().getVersion()); if (generator.hasRestMetadata(vdb)) { final Runnable job = new Runnable() { @Override public void run() { try { byte[] warContents = generator.getContent(vdb, warName); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } if (warContents != null) { getAdmin().deploy(warName, new ByteArrayInputStream(warContents), false); } } catch (IOException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } catch (AdminException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } } }; getExecutor().execute(job); } }
ResteasyEnabler implements VDBLifeCycleListener, Service<Void> { @Override public void finishedDeployment(String name, CompositeVDB cvdb) { final VDBMetaData vdb = cvdb.getVDB(); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } final String warName = buildName(name, cvdb.getVDB().getVersion()); if (generator.hasRestMetadata(vdb)) { final Runnable job = new Runnable() { @Override public void run() { try { byte[] warContents = generator.getContent(vdb, warName); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } if (warContents != null) { getAdmin().deploy(warName, new ByteArrayInputStream(warContents), false); } } catch (IOException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } catch (AdminException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } } }; getExecutor().execute(job); } } }
ResteasyEnabler implements VDBLifeCycleListener, Service<Void> { @Override public void finishedDeployment(String name, CompositeVDB cvdb) { final VDBMetaData vdb = cvdb.getVDB(); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } final String warName = buildName(name, cvdb.getVDB().getVersion()); if (generator.hasRestMetadata(vdb)) { final Runnable job = new Runnable() { @Override public void run() { try { byte[] warContents = generator.getContent(vdb, warName); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } if (warContents != null) { getAdmin().deploy(warName, new ByteArrayInputStream(warContents), false); } } catch (IOException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } catch (AdminException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } } }; getExecutor().execute(job); } } ResteasyEnabler(RestWarGenerator generator); }
ResteasyEnabler implements VDBLifeCycleListener, Service<Void> { @Override public void finishedDeployment(String name, CompositeVDB cvdb) { final VDBMetaData vdb = cvdb.getVDB(); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } final String warName = buildName(name, cvdb.getVDB().getVersion()); if (generator.hasRestMetadata(vdb)) { final Runnable job = new Runnable() { @Override public void run() { try { byte[] warContents = generator.getContent(vdb, warName); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } if (warContents != null) { getAdmin().deploy(warName, new ByteArrayInputStream(warContents), false); } } catch (IOException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } catch (AdminException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } } }; getExecutor().execute(job); } } ResteasyEnabler(RestWarGenerator generator); @Override void added(String name, CompositeVDB vdb); @Override void beforeRemove(String name, CompositeVDB cvdb); @Override void finishedDeployment(String name, CompositeVDB cvdb); @Override void removed(String name, CompositeVDB cvdb); @Override Void getValue(); @Override void start(StartContext arg0); @Override void stop(StopContext arg0); }
ResteasyEnabler implements VDBLifeCycleListener, Service<Void> { @Override public void finishedDeployment(String name, CompositeVDB cvdb) { final VDBMetaData vdb = cvdb.getVDB(); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } final String warName = buildName(name, cvdb.getVDB().getVersion()); if (generator.hasRestMetadata(vdb)) { final Runnable job = new Runnable() { @Override public void run() { try { byte[] warContents = generator.getContent(vdb, warName); if (!vdb.getStatus().equals(Status.ACTIVE)) { return; } if (warContents != null) { getAdmin().deploy(warName, new ByteArrayInputStream(warContents), false); } } catch (IOException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } catch (AdminException e) { LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50109, warName)); } } }; getExecutor().execute(job); } } ResteasyEnabler(RestWarGenerator generator); @Override void added(String name, CompositeVDB vdb); @Override void beforeRemove(String name, CompositeVDB cvdb); @Override void finishedDeployment(String name, CompositeVDB cvdb); @Override void removed(String name, CompositeVDB cvdb); @Override Void getValue(); @Override void start(StartContext arg0); @Override void stop(StopContext arg0);  }