m_repositoryAdmin.commit();
return null;
}
}, false, DeploymentVersionObject.TOPIC_ADDED, TOPIC_STATUS_CHANGED);
DeploymentVersionObject dep = m_deploymentVersionRepository.getMostRecentDeploymentVersion(sgo.getID());
DeploymentArtifact[] toDeploy = dep.getDeploymentArtifacts();
assertEquals("We expect to find four artifacts to deploy;", 4, toDeploy.length);
DeploymentArtifact bundle1 = toDeploy[0];
assertEquals(b1.getURL(), bundle1.getUrl());
DeploymentArtifact bundle2 = toDeploy[1];
assertEquals(b2.getURL(), bundle2.getUrl());
assertEquals("true", bundle2.getDirective(DeploymentArtifact.DIRECTIVE_ISCUSTOMIZER));
DeploymentArtifact artifact1 = toDeploy[2];
assertEquals(a1.getURL(), artifact1.getUrl());
assertEquals("my.processor.pid", artifact1.getDirective(DeploymentArtifact.DIRECTIVE_KEY_PROCESSORID));
DeploymentArtifact artifact2 = toDeploy[3];
assertEquals(a2.getURL(), artifact2.getUrl());
assertEquals("my.processor.pid", artifact2.getDirective(DeploymentArtifact.DIRECTIVE_KEY_PROCESSORID));
assertEquals(a2.getResourceId(), artifact2.getDirective(DeploymentArtifact.DIRECTIVE_KEY_RESOURCE_ID));
// Now, add a new version of the processor (ACE-373)
assertFalse("There should be no changes.", sgo.needsApprove());
attr = new HashMap<String, String>();
attr.put(ArtifactObject.KEY_URL, "http://myprocessor/v2");
attr.put(BundleHelper.KEY_RESOURCE_PROCESSOR_PID, "my.processor.pid");
attr.put(BundleHelper.KEY_SYMBOLICNAME, "my.processor.bundle");
attr.put(BundleHelper.KEY_VERSION, "2.0.0");
attr.put(ArtifactHelper.KEY_MIMETYPE, BundleHelper.MIMETYPE);
ArtifactObject b3 = m_artifactRepository.create(attr, tags);
assertTrue("By adding a resource processor, we should have triggered a change that needs to be approved.", sgo.needsApprove());
sgo.approve();
runAndWaitForEvent(new Callable<Void>() {
public Void call() throws Exception {
m_repositoryAdmin.commit();
return null;
}
}, false, DeploymentVersionObject.TOPIC_ADDED, TOPIC_STATUS_CHANGED);
dep = m_deploymentVersionRepository.getMostRecentDeploymentVersion(sgo.getID());
toDeploy = dep.getDeploymentArtifacts();
assertEquals("We expect to find four artifacts to deploy;", 4, toDeploy.length);
boolean foundBundle = false;
boolean foundProcessor = false;
boolean foundArtifact1 = false;