+ BundleHelper.KEY_VERSION + ">=1)(" + BundleHelper.KEY_VERSION + "=<3))(!("
+ BundleHelper.KEY_VERSION + "=3)))", "(name=thefeature)");
}
}, false, Artifact2FeatureAssociation.TOPIC_ADDED);
final DistributionObject l1 = createBasicDistributionObject("thedistribution");
final Feature2DistributionAssociation gtl = runAndWaitForEvent(new Callable<Feature2DistributionAssociation>() {
public Feature2DistributionAssociation call() throws Exception {
return m_feature2distributionRepository.create("(name=thefeature)", "(name=thedistribution)");
}
}, false, Feature2DistributionAssociation.TOPIC_ADDED);
assertTrue("The left side of the BG-association should be b1.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b1));
assertTrue("The right side of the BG-association should be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
assertTrue("The left side of the GtL-association should be g1.", (gtl.getLeft().size() == 1) && gtl.getLeft().contains(g1));
assertTrue("The right side of the GtL-association should be l1.", (gtl.getRight().size() == 1) && gtl.getRight().contains(l1));
assertTrue("The bundlefeature association should be satisfied.", bg.isSatisfied());
assertTrue("The feature2distribution association should be satisfied.", gtl.isSatisfied());
assertEquals("Bundle b1 should be associated to one feature.", 1, b1.getFeatures().size());
assertEquals("Distribution l1 should be associated to one feature.", 1, l1.getFeatures().size());
// remove the feature
runAndWaitForEvent(new Callable<Object>() {
public Object call() throws Exception {
m_featureRepository.remove(g1);
return null;
}
}, false, Artifact2FeatureAssociation.TOPIC_CHANGED, Feature2DistributionAssociation.TOPIC_CHANGED);
assertFalse("The bundlefeature association shouldn not be satisfied.", gtl.isSatisfied());
assertFalse("The feature2distribution assocation should not be satisfied.", bg.isSatisfied());
assertEquals("Bundle b1 shouldn't be associated to any feature, but is associated to " + b1.getFeatures(), 0, b1.getFeatures().size());
assertEquals("Distribution l1 shouldn't be associated to any feature.", 0, l1.getFeatures().size());
cleanUp();
}