ActiveVOS9Deployer implements IBPELDeployer { @Override public void deploy(String pathToTest, ProcessUnderTest processUnderTest) throws DeploymentException { checkThatSpecified(this.deploymentLocation, "Location for Deployment Archive (BPR) was not configured."); ActiveVOSAdministrativeFunctions activevos = getAdministrativeFunctions(); if(terminatePendingProcessesBeforeTestSuiteIsRun) { logger.info("Terminating running processes prior to test suite run..."); activevos.terminateAllProcessInstances(); } if(doUndeploy) { logger.info("Fetching current contributions on server..."); previouslyDeployedContributions = activevos.getAllContributions(); } try { File bprFile = new File(getArchiveLocation(pathToTest)); if(!bprFile.isFile() || !bprFile.canRead()) { throw new DeploymentException("Cannot find or read BPR archive '" + bprFile.getAbsolutePath() + "'"); } byte[] bprContents = FileUtil.readFile(bprFile); String fileName = new File(deploymentLocation).getName(); logger.info("Deploying " + fileName + "..."); activevos.deployBpr(fileName, bprContents); } catch(IOException e) { throw new DeploymentException("Error while deploying: " + e.getMessage(), e); } catch (DeployException e) { throw new DeploymentException("Error while deploying: " + e.getMessage(), e); } }  @IBPELDeployerOption( testSuiteSpecific=true, description="The (relative) path to the BPR to be deployed." ) void setDeploymentLocation(String deploymentLocation); @IBPELDeployerOption( defaultValue="http://localhost:8080/active-bpel/services/ActiveBpelAdmin", description="The URL of ActiveVOS' deployment service." ) void setDeploymentServiceEndpoint(String deploymentServiceEndpoint); @IBPELDeployerOption( defaultValue="bpelunit", description="The user name of the user that has deploy rights." ) void setDeployerUserName(String deployerUserName); @IBPELDeployerOption( defaultValue="", description="The password of the user specified in DeployerUserName." ) void setDeployerPassword(String deployerPassword); @IBPELDeployerOption( defaultValue="false", description="Controls whether the process should be undeployed after the test suite has run. Valid values are true/false." ) void setDoUndeploy(String doUndeploy); @IBPELDeployerOption( defaultValue="false", description="If set to true, all running process instances will be terminated before running the test suite. DO USE WITH CARE!" ) void setTerminatePendingProcessesBeforeTestSuiteIsRun(String terminatePendingProcessesBeforeTestSuiteIsRun); @IBPELDeployerOption( defaultValue="false", description="If set to true, all running process instances will be terminated before every test case. DO USE WITH CARE!" ) void setTerminatePendingProcessesAfterTestCaseIsRun(String terminatePendingProcessesAfterEveryTestCase); @Override void deploy(String pathToTest, ProcessUnderTest processUnderTest); @Override void undeploy(String testPath, ProcessUnderTest processUnderTest); IDeployment getDeployment(ProcessUnderTest processUnderTest); @Override void cleanUpAfterTestCase(); synchronized ActiveVOSAdministrativeFunctions getAdministrativeFunctions();  }
@Test(expected = DeploymentException.class) public void testDeploymentFailsIfNoArchiveIsSpecified() throws Exception { deployer.deploy(".", processUnderTest); assertEquals(0, administrativeFunctionMock.getMethodsCalls().size()); }
@Test public void testSimpleDeployWithoutAnyOptions() throws Exception { configureDeployer("DeploymentLocation", BPR_FILENAME); deployer.deploy(".", processUnderTest); assertEquals(1, administrativeFunctionMock.getMethodsCalls().size()); MethodCall methodCall = administrativeFunctionMock.getMethodsCalls().get(0); assertDeployBprUnchangedArchive(methodCall); }