assertEquals("1.0.0\n", t1versions.get(String.class));
}
public void testDeployConfigurationTemplateToTargets() throws Exception {
try {
Client c = Client.create();
c.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, false);
File config = new File("template.xml");
BufferedWriter bw = new BufferedWriter(new FileWriter(config));
bw.write(
"<MetaData xmlns='http://www.osgi.org/xmlns/metatype/v1.0.0'>\n" +
" <OCD name='ocd' id='ocd'>\n" +
" <AD id='name' type='STRING' cardinality='0' />\n" +
" </OCD>\n" +
" <Designate pid='simple' bundle='osgi-dp:location'>\n" +
" <Object ocdref='ocd'>\n" +
" <Attribute adref='name'>\n" +
" <Value><![CDATA[${context.test}]]></Value>\n" +
" </Attribute>\n" +
" </Object>\n" +
" </Designate>\n" +
"</MetaData>\n"
);
bw.close();
config.deleteOnExit();
File rp = new File("rp.jar");
createBundleOnDisk(rp, "rp", "1.0.0", BundleHelper.KEY_RESOURCE_PROCESSOR_PID, PROCESSOR, "DeploymentPackage-Customizer", "true");
rp.deleteOnExit();
WebResource w1 = createWorkspace(c);
createResourceProcessor(c, w1, "rp", "resourceprocessor", "1.0.0", rp.toURI().toURL().toString(), BundleHelper.MIMETYPE, PROCESSOR);
createConfiguration(c, w1, "c1", config.toURI().toURL().toString(), MIMETYPE, "template.xml", PROCESSOR);
createAssociationA2F(c, w1, "artifact2feature", "c1", "f4");
createFeature(c, w1, "f4");
createAssociationF2D(c, w1, "feature2distribution", "f4", "d2");
createDistribution(c, w1, "d2");
createAssociationD2T(c, w1, "distribution2target", "d2", "t4");
createAssociationD2T(c, w1, "distribution2target", "d2", "t5");
createAssociationD2T(c, w1, "distribution2target", "d2", "t6");
createTarget(c, w1, "t4", "test", "one");
createTarget(c, w1, "t5", "test", "two");
createTarget(c, w1, "t6", "test", "three");
w1.post();
w1.delete();
/* TODO: temporarily disabled these checks, because between test methods nothing
* is cleaned up right now and this part of the test does rely on that
Gson gson = new Gson();
WebResource w2 = createWorkspace(c);
assertResources(gson, w2, "artifact", 1);
assertResources(gson, w2, "artifact2feature", 1);
assertResources(gson, w2, "feature", 1);
assertResources(gson, w2, "feature2distribution", 1);
assertResources(gson, w2, "distribution", 1);
assertResources(gson, w2, "distribution2target", 3);
assertResources(gson, w2, "target", 3);
w2.delete();
*/
// just for debugging
showLog();
showBundles();
WebResource t1versions = c.resource("http://localhost:8080/deployment/t4/versions");
assertEquals("1.0.0\n", t1versions.get(String.class));
}
catch (Exception e) {
showLog();
throw e;