@Override public void before(AbstractDeployment deployment) { if (deployment instanceof SimpleTestDeployment) { // Not a user defined configuration based test... deploy the Services and Transformers // found by the CDI discovery process... @SuppressWarnings("unchecked") Class<? extends AbstractDeployment> simpleCdiDeploymentType = (Class<? extends AbstractDeployment>) Classes.forName("org.switchyard.component.bean.internal.SimpleCDIDeployment", getClass()); if (simpleCdiDeploymentType == null) { if (getTestKit() != null && getTestKit().getTestInstance().getClass().getPackage() == CDIMixIn.class.getPackage()) { return; // not fatal for unit tests of CDIMixIn since they can't depend on the bean component as this would create a cyclic Maven dependency. } else { Assert.fail("Failed to locate the SimpleCDIDeployment class on the classpath. Module must include the SwitchYard Bean Component as one of its depedencies."); } } try { _simpleCdiDeployment = simpleCdiDeploymentType.newInstance(); _simpleCdiDeployment.setParentDeployment(deployment); ServiceDomain domain = new ServiceDomainManager().createDomain(); _simpleCdiDeployment.init(domain, getTestKit().getActivators()); _simpleCdiDeployment.start(); } catch (Exception e) { e.printStackTrace(); Assert.fail("Failed to manually deploy Bean Service. Exception: " + e.getMessage()); } } }
@Override public void before(AbstractDeployment deployment) { if (deployment instanceof SimpleTestDeployment) { // Not a user defined configuration based test... deploy the Services and Transformers // found by the CDI discovery process... @SuppressWarnings("unchecked") Class<? extends AbstractDeployment> simpleCdiDeploymentType = (Class<? extends AbstractDeployment>) Classes.forName("org.switchyard.component.bean.internal.SimpleCDIDeployment", getClass()); if (simpleCdiDeploymentType == null) { if (getTestKit() != null && getTestKit().getTestInstance().getClass().getPackage() == CDIMixIn.class.getPackage()) { return; // not fatal for unit tests of CDIMixIn since they can't depend on the bean component as this would create a cyclic Maven dependency. } else { Assert.fail("Failed to locate the SimpleCDIDeployment class on the classpath. Module must include the SwitchYard Bean Component as one of its depedencies."); } } try { _simpleCdiDeployment = simpleCdiDeploymentType.newInstance(); _simpleCdiDeployment.setParentDeployment(deployment); ServiceDomain domain = new ServiceDomainManager().createDomain(); _simpleCdiDeployment.init(domain, getTestKit().getActivators()); _simpleCdiDeployment.start(); } catch (Exception e) { e.printStackTrace(); Assert.fail("Failed to manually deploy Bean Service. Exception: " + e.getMessage()); } } }