Modified: ace/trunk/ace-integrationtests/src/test/java/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java URL: http://svn.apache.org/viewvc/ace/trunk/ace-integrationtests/src/test/java/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java?rev=1301412&r1=1301411&r2=1301412&view=diff ============================================================================== --- ace/trunk/ace-integrationtests/src/test/java/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java (original) +++ ace/trunk/ace-integrationtests/src/test/java/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java Fri Mar 16 10:05:14 2012 @@ -138,11 +138,11 @@ public class RepositoryAdminTest extends .add(createServiceDependency().setService(HttpService.class).setRequired(true)) .add(createServiceDependency().setService(RepositoryAdmin.class).setRequired(true)) .add(createServiceDependency().setService(ArtifactRepository.class).setRequired(true)) - .add(createServiceDependency().setService(Artifact2GroupAssociationRepository.class).setRequired(true)) - .add(createServiceDependency().setService(GroupRepository.class).setRequired(true)) - .add(createServiceDependency().setService(Group2LicenseAssociationRepository.class).setRequired(true)) - .add(createServiceDependency().setService(LicenseRepository.class).setRequired(true)) - .add(createServiceDependency().setService(License2GatewayAssociationRepository.class).setRequired(true)) + .add(createServiceDependency().setService(Artifact2FeatureAssociationRepository.class).setRequired(true)) + .add(createServiceDependency().setService(FeatureRepository.class).setRequired(true)) + .add(createServiceDependency().setService(Feature2DistributionAssociationRepository.class).setRequired(true)) + .add(createServiceDependency().setService(DistributionRepository.class).setRequired(true)) + .add(createServiceDependency().setService(Distribution2TargetAssociationRepository.class).setRequired(true)) .add(createServiceDependency().setService(TargetRepository.class).setRequired(true)) .add(createServiceDependency().setService(DeploymentVersionRepository.class).setRequired(true)) .add(createServiceDependency().setService(StatefulTargetRepository.class).setRequired(true)) @@ -154,11 +154,11 @@ public class RepositoryAdminTest extends private volatile ConfigurationAdmin m_configAdmin; /* Injected by dependency manager */ private volatile RepositoryAdmin m_repositoryAdmin; /* Injected by dependency manager */ private volatile ArtifactRepository m_artifactRepository; /* Injected by dependency manager */ - private volatile Artifact2GroupAssociationRepository m_artifact2groupRepository; /* Injected by dependency manager */ - private volatile GroupRepository m_groupRepository; /* Injected by dependency manager */ - private volatile Group2LicenseAssociationRepository m_group2licenseRepository; /* Injected by dependency manager */ - private volatile LicenseRepository m_licenseRepository; /* Injected by dependency manager */ - private volatile License2GatewayAssociationRepository m_license2gatewayRepository; /* Injected by dependency manager */ + private volatile Artifact2FeatureAssociationRepository m_artifact2groupRepository; /* Injected by dependency manager */ + private volatile FeatureRepository m_groupRepository; /* Injected by dependency manager */ + private volatile Feature2DistributionAssociationRepository m_group2licenseRepository; /* Injected by dependency manager */ + private volatile DistributionRepository m_licenseRepository; /* Injected by dependency manager */ + private volatile Distribution2TargetAssociationRepository m_license2gatewayRepository; /* Injected by dependency manager */ private volatile TargetRepository m_gatewayRepository; /* Injected by dependency manager */ private volatile DeploymentVersionRepository m_deploymentVersionRepository; /* Injected by dependency manager */ private volatile StatefulTargetRepository m_statefulGatewayRepository; /* Injected by dependency manager */ @@ -198,21 +198,21 @@ public class RepositoryAdminTest extends @Test public void testRemoveBundleGroup() throws Exception { final ArtifactObject b1 = createBasicBundleObject("thebundle","1", null); - final GroupObject g1 = createBasicGroupObject("thegroup"); + final FeatureObject g1 = createBasicGroupObject("thegroup"); - final Artifact2GroupAssociation bg = runAndWaitForEvent(new Callable<Artifact2GroupAssociation>() { - public Artifact2GroupAssociation call() throws Exception { + final Artifact2FeatureAssociation bg = runAndWaitForEvent(new Callable<Artifact2FeatureAssociation>() { + public Artifact2FeatureAssociation call() throws Exception { return m_artifact2groupRepository.create("(&(" + BundleHelper.KEY_SYMBOLICNAME + "=thebundle)(|("+BundleHelper.KEY_VERSION+">=1)("+BundleHelper.KEY_VERSION+"=<3))(!("+BundleHelper.KEY_VERSION+"=3)))", "(name=thegroup)"); } - }, false, Artifact2GroupAssociation.TOPIC_ADDED); + }, false, Artifact2FeatureAssociation.TOPIC_ADDED); - final LicenseObject l1 = createBasicLicenseObject("thelicense"); + final DistributionObject l1 = createBasicLicenseObject("thelicense"); - final Group2LicenseAssociation gtl = runAndWaitForEvent(new Callable<Group2LicenseAssociation>() { - public Group2LicenseAssociation call() throws Exception { + final Feature2DistributionAssociation gtl = runAndWaitForEvent(new Callable<Feature2DistributionAssociation>() { + public Feature2DistributionAssociation call() throws Exception { return m_group2licenseRepository.create("(name=thegroup)","(name=thelicense)"); } - }, false, Group2LicenseAssociation.TOPIC_ADDED); + }, false, Feature2DistributionAssociation.TOPIC_ADDED); assert (bg.getLeft().size() == 1) && bg.getLeft().contains(b1) : "The left side of the BG-association should be b1."; assert (bg.getRight().size() == 1) && bg.getRight().contains(g1) : "The right side of the BG-association should be g1."; @@ -229,7 +229,7 @@ public class RepositoryAdminTest extends m_groupRepository.remove(g1); return null; } - }, false,Artifact2GroupAssociation.TOPIC_CHANGED, Group2LicenseAssociation.TOPIC_CHANGED); + }, false,Artifact2FeatureAssociation.TOPIC_CHANGED, Feature2DistributionAssociation.TOPIC_CHANGED); assert !gtl.isSatisfied() : "The bundlegroup association shouldn not be satisfied."; assert !bg.isSatisfied() : "The group2license assocation should not be satisfied."; @@ -244,14 +244,14 @@ public class RepositoryAdminTest extends @Test public void testAssociationsWithMovingEndpoints () throws Exception { final ArtifactObject b1 = createBasicBundleObject("thebundle", "1", null); - final GroupObject g1 = createBasicGroupObject("thegroup"); - final Artifact2GroupAssociation bg = runAndWaitForEvent(new Callable<Artifact2GroupAssociation>() { - public Artifact2GroupAssociation call() throws Exception { + final FeatureObject g1 = createBasicGroupObject("thegroup"); + final Artifact2FeatureAssociation bg = runAndWaitForEvent(new Callable<Artifact2FeatureAssociation>() { + public Artifact2FeatureAssociation call() throws Exception { Map<String, String> properties = new HashMap<String, String>(); properties.put(BundleHelper.KEY_ASSOCIATION_VERSIONSTATEMENT, "[1,3)"); return m_artifact2groupRepository.create(b1, properties, g1, null); } - }, false, Artifact2GroupAssociation.TOPIC_ADDED); + }, false, Artifact2FeatureAssociation.TOPIC_ADDED); assert (bg.getLeft().size() == 1) && bg.getLeft().contains(b1) : "The left side of the association should now be b1; we find " + bg.getLeft().size() + " bundles on the left side of the association."; assert (bg.getRight().size() == 1) && bg.getRight().contains(g1) : "The right side of the association should now be g1."; @@ -262,7 +262,7 @@ public class RepositoryAdminTest extends public ArtifactObject call() throws Exception { return createBasicBundleObject("thebundle", "2", null); } - }, false, Artifact2GroupAssociation.TOPIC_CHANGED); + }, false, Artifact2FeatureAssociation.TOPIC_CHANGED); assert (bg.getLeft().size() == 1) && !bg.getLeft().contains(b1) : "The left side of the association should no longer be b1; we find " + bg.getLeft().size() + " bundles."; assert (bg.getLeft().size() == 1) && bg.getLeft().contains(b2) : "The left side of the association should now be b2."; @@ -303,7 +303,7 @@ public class RepositoryAdminTest extends m_artifactRepository.remove(b2); return null; } - }, false, Artifact2GroupAssociation.TOPIC_CHANGED); + }, false, Artifact2FeatureAssociation.TOPIC_CHANGED); //note that we cannot test anything for b2: this has been removed, and now has no //defined state. @@ -543,19 +543,19 @@ public class RepositoryAdminTest extends final StatefulTargetObject sgo = m_statefulGatewayRepository.get(m_bundleContext.createFilter("(" + TargetObject.KEY_ID + "=" + "testAutoApproveGateway)")).get(0); // Set up some deployment information for the gateway. - final GroupObject g = runAndWaitForEvent(new Callable<GroupObject>() { - public GroupObject call() throws Exception { + final FeatureObject g = runAndWaitForEvent(new Callable<FeatureObject>() { + public FeatureObject call() throws Exception { ArtifactObject b = createBasicBundleObject("myBundle", "1.0", null); - GroupObject g = createBasicGroupObject("myGroup"); - LicenseObject l = createBasicLicenseObject("myLicense"); + FeatureObject g = createBasicGroupObject("myGroup"); + DistributionObject l = createBasicLicenseObject("myLicense"); m_artifact2groupRepository.create(b, g); m_group2licenseRepository.create(g, l); - m_license2gatewayRepository.create(l, sgo.getGatewayObject()); + m_license2gatewayRepository.create(l, sgo.getTargetObject()); return g; } - }, false, ArtifactObject.TOPIC_ADDED, GroupObject.TOPIC_ADDED, LicenseObject.TOPIC_ADDED, - Artifact2GroupAssociation.TOPIC_ADDED, Group2LicenseAssociation.TOPIC_ADDED, - License2GatewayAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED); + }, false, ArtifactObject.TOPIC_ADDED, FeatureObject.TOPIC_ADDED, DistributionObject.TOPIC_ADDED, + Artifact2FeatureAssociation.TOPIC_ADDED, Feature2DistributionAssociation.TOPIC_ADDED, + Distribution2TargetAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED); assert sgo.needsApprove() : "We added some deployment information, so the gateway should need approval."; @@ -578,7 +578,7 @@ public class RepositoryAdminTest extends m_artifact2groupRepository.create(b, g); return null; } - }, false, ArtifactObject.TOPIC_ADDED, Artifact2GroupAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED, TOPIC_STATUS_CHANGED); + }, false, ArtifactObject.TOPIC_ADDED, Artifact2FeatureAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED, TOPIC_STATUS_CHANGED); assert !sgo.needsApprove() : "With autoapprove on, adding new deployment information should still not need approval (at least, after the two CHANGED events)."; @@ -732,21 +732,21 @@ public class RepositoryAdminTest extends final ArtifactObject b11 = createBasicBundleObject("bundle1", "1", null); - GroupObject g1 = createBasicGroupObject("group1"); - GroupObject g2 = createBasicGroupObject("group2"); // note that this group is not associated to a bundle. + FeatureObject g1 = createBasicGroupObject("group1"); + FeatureObject g2 = createBasicGroupObject("group2"); // note that this group is not associated to a bundle. createDynamicBundle2GroupAssociation(b11, g1); - final LicenseObject l1 = createBasicLicenseObject("license1"); + final DistributionObject l1 = createBasicLicenseObject("license1"); m_group2licenseRepository.create(g1, l1); m_group2licenseRepository.create(g2, l1); - runAndWaitForEvent(new Callable<License2GatewayAssociation>() { - public License2GatewayAssociation call() throws Exception { - return m_license2gatewayRepository.create(l1, sgo.getGatewayObject()); + runAndWaitForEvent(new Callable<Distribution2TargetAssociation>() { + public Distribution2TargetAssociation call() throws Exception { + return m_license2gatewayRepository.create(l1, sgo.getTargetObject()); } - }, false, License2GatewayAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED); + }, false, Distribution2TargetAssociation.TOPIC_ADDED, TOPIC_STATUS_CHANGED); assert sgo.needsApprove() : "We added information that influences our gateway, so we should need to approve it."; assert sgo.getRegistrationState().equals(RegistrationState.Registered) : "We expect the registration state to be Registered, but it is " + sgo.getRegistrationState(); @@ -772,7 +772,7 @@ public class RepositoryAdminTest extends public ArtifactObject call() throws Exception { return createBasicBundleObject("bundle1", "2", null); } - }, false, ArtifactObject.TOPIC_ADDED, Artifact2GroupAssociation.TOPIC_CHANGED, TOPIC_STATUS_CHANGED); + }, false, ArtifactObject.TOPIC_ADDED, Artifact2FeatureAssociation.TOPIC_CHANGED, TOPIC_STATUS_CHANGED); assert sgo.needsApprove() : "We added a new version of a bundle that is used by the gateway, so approval should be necessary."; assert sgo.getRegistrationState().equals(RegistrationState.Registered) : "We expect the registration state to be Registered, but it is " + sgo.getRegistrationState(); @@ -929,7 +929,7 @@ public class RepositoryAdminTest extends //do checks assert sgo1.isRegistered() : "Adding auditlog data for a gateway does not influence its isRegistered()."; try { - sgo1.getGatewayObject(); + sgo1.getTargetObject(); } catch (IllegalStateException ise) { assert false : "We should be able to get sgo1's gatewayObject."; @@ -951,14 +951,14 @@ public class RepositoryAdminTest extends //do checks assert sgo1.isRegistered() : "Adding auditlog data for a gateway does not influence its isRegistered()."; try { - sgo1.getGatewayObject(); + sgo1.getTargetObject(); } catch (IllegalStateException ise) { assert false : "We should be able to get sgo1's gatewayObject."; } assert !sgo2.isRegistered() : "sgo2 is only found in the auditlog, so it cannot be in registered."; try { - sgo2.getGatewayObject(); + sgo2.getTargetObject(); assert false : "We should not be able to get sgo2's gatewayObject."; } catch (IllegalStateException ise) { @@ -976,7 +976,7 @@ public class RepositoryAdminTest extends //do checks assert !sgo1.isRegistered() : "sgo1 is now only found in the auditlog, so it cannot be registered."; try { - sgo1.getGatewayObject(); + sgo1.getTargetObject(); assert false : "We should not be able to get sgo1's gatewayObject."; } catch (IllegalStateException ise) { @@ -984,7 +984,7 @@ public class RepositoryAdminTest extends } assert !sgo2.isRegistered() : "sgo2 is only found in the auditlog, so it cannot be in registered."; try { - sgo2.getGatewayObject(); + sgo2.getTargetObject(); assert false : "We should not be able to get sgo2's gatewayObject."; } catch (IllegalStateException ise) { @@ -1002,7 +1002,7 @@ public class RepositoryAdminTest extends //do checks assert !sgo1.isRegistered() : "sgo1 is now only found in the auditlog, so it cannot be in registered."; try { - sgo1.getGatewayObject(); + sgo1.getTargetObject(); assert false : "We should not be able to get sgo1's gatewayObject."; } catch (IllegalStateException ise) { @@ -1010,7 +1010,7 @@ public class RepositoryAdminTest extends } assert sgo2.isRegistered() : "sgo2 has been registered."; try { - sgo2.getGatewayObject(); + sgo2.getTargetObject(); } catch (IllegalStateException ise) { assert false : "We should be able to get sgo2's gatewayObject."; @@ -1020,23 +1020,23 @@ public class RepositoryAdminTest extends assert nrRegistered == 1 : "We expect to filter out one registered gateway, but we find " + nrRegistered; // Finally, create a license object - final LicenseObject l1 = createBasicLicenseObject("thelicense"); + final DistributionObject l1 = createBasicLicenseObject("thelicense"); assert !sgo1.isRegistered() : "We just created a Staful GW object, is should not be registered"; // register sgo1 again and create an association in 1 go - License2GatewayAssociation lgw1 = runAndWaitForEvent(new Callable<License2GatewayAssociation>() { - public License2GatewayAssociation call() throws Exception { + Distribution2TargetAssociation lgw1 = runAndWaitForEvent(new Callable<Distribution2TargetAssociation>() { + public Distribution2TargetAssociation call() throws Exception { sgo1.register(); - return m_license2gatewayRepository.create(l1, sgo1.getGatewayObject()); + return m_license2gatewayRepository.create(l1, sgo1.getTargetObject()); } - }, false, License2GatewayAssociation.TOPIC_ADDED, TargetObject.TOPIC_ADDED, TOPIC_STATUS_CHANGED); + }, false, Distribution2TargetAssociation.TOPIC_ADDED, TargetObject.TOPIC_ADDED, TOPIC_STATUS_CHANGED); // checks nrRegistered = m_statefulGatewayRepository.get(m_bundleContext.createFilter("(" + KEY_REGISTRATION_STATE + "=" + RegistrationState.Registered + ")")).size(); assert nrRegistered == 2 : "We expect to filter out two registered gateways, but we find " + nrRegistered; assert sgo1.isRegistered() : "A stateful gw object should be registered"; - assert sgo1.isAssociated(l1, LicenseObject.class) : "The stateful gw object should be associated to thelicense."; + assert sgo1.isAssociated(l1, DistributionObject.class) : "The stateful gw object should be associated to thelicense."; assert lgw1.isSatisfied() : "Both ends of license - stateful gw should be satisfied."; } @@ -1083,8 +1083,8 @@ public class RepositoryAdminTest extends ArtifactObject a2 = m_artifactRepository.create(attr, tags); - GroupObject g = createBasicGroupObject("group"); - LicenseObject l = createBasicLicenseObject("license"); + FeatureObject g = createBasicGroupObject("group"); + DistributionObject l = createBasicLicenseObject("license"); attr = new HashMap<String, String>(); attr.put(TargetObject.KEY_ID, "myGateway"); @@ -1097,7 +1097,7 @@ public class RepositoryAdminTest extends m_group2licenseRepository.create(g, l); - m_license2gatewayRepository.create(l, sgo.getGatewayObject()); + m_license2gatewayRepository.create(l, sgo.getTargetObject()); try { sgo.approve(); @@ -1391,8 +1391,8 @@ public class RepositoryAdminTest extends loginContext1.addTargetRepository(new URL(HOST + ENDPOINT), "apache", "gateway", true); m_repositoryAdmin.login(loginContext1); - GroupObject g1 = createBasicGroupObject("group1"); - LicenseObject l1 = createBasicLicenseObject("license1"); + FeatureObject g1 = createBasicGroupObject("group1"); + DistributionObject l1 = createBasicLicenseObject("license1"); m_group2licenseRepository.create(g1, l1); @@ -1462,8 +1462,8 @@ public class RepositoryAdminTest extends @Test public void testRepostoryLoginDoubleRepository() throws Exception { RepositoryAdminLoginContext context = m_repositoryAdmin.createLoginContext(new MockUser("user")); - context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "shop", true, ArtifactRepository.class, Artifact2GroupAssociationRepository.class, GroupRepository.class); - context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "deployment", true, GroupRepository.class, Group2LicenseAssociationRepository.class, LicenseRepository.class); + context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "shop", true, ArtifactRepository.class, Artifact2FeatureAssociationRepository.class, FeatureRepository.class); + context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "deployment", true, FeatureRepository.class, Feature2DistributionAssociationRepository.class, DistributionRepository.class); try { m_repositoryAdmin.login(context); assert false : "We tried to log in with two repositories that try to access the same repository service; this should not be allowed."; @@ -1473,14 +1473,14 @@ public class RepositoryAdminTest extends } } - private static interface newRepository extends ObjectRepository<LicenseObject> {} + private static interface newRepository extends ObjectRepository<DistributionObject> {} @SuppressWarnings("unchecked") @Test public void testRepostoryLoginRepositoryWithoutImplementation() throws Exception { RepositoryAdminLoginContext context = m_repositoryAdmin.createLoginContext(new MockUser("user")); - context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "shop", true, ArtifactRepository.class, Artifact2GroupAssociationRepository.class, GroupRepository.class); - context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "deployment", true, GroupRepository.class, Group2LicenseAssociationRepository.class, newRepository.class); + context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "shop", true, ArtifactRepository.class, Artifact2FeatureAssociationRepository.class, FeatureRepository.class); + context.addRepositories(new URL("http://localhost:" + TestConstants.PORT), "apache", "deployment", true, FeatureRepository.class, Feature2DistributionAssociationRepository.class, newRepository.class); try { m_repositoryAdmin.login(context); assert false : "We tried to log in with a repository for which no implementation is available; this should not be allowed."; @@ -1518,8 +1518,8 @@ public class RepositoryAdminTest extends ArtifactObject b1 = createBasicBundleObject("myBundle"); ArtifactObject b2 = createBasicBundleObject("myProcessor", "1.0.0", "myProcessor.pid"); ArtifactObject a1 = createBasicArtifactObject("myArtifact", "mymime", "myProcessor.pid"); - GroupObject go = createBasicGroupObject("mygroup"); - LicenseObject lo = createBasicLicenseObject("mylicense"); + FeatureObject go = createBasicGroupObject("mygroup"); + DistributionObject lo = createBasicLicenseObject("mylicense"); TargetObject gwo = createBasicGatewayObject("templategateway"); m_artifact2groupRepository.create(b1, go); // note that we do not associate b2: this is a resource processor, so it will be packed @@ -1576,12 +1576,12 @@ public class RepositoryAdminTest extends File simpleTemplateFile = createFileWithContents("template", "xml", xmlHeader+simpleTemplate+xmlFooter); // create some tree from artifacts to a gateway - GroupObject go = runAndWaitForEvent(new Callable<GroupObject>() { - public GroupObject call() throws Exception { + FeatureObject go = runAndWaitForEvent(new Callable<FeatureObject>() { + public FeatureObject call() throws Exception { ArtifactObject b1 = createBasicBundleObject("myBundle"); ArtifactObject b2 = createBasicBundleObject("myProcessor", "1.0.0", "org.osgi.deployment.rp.autoconf"); - GroupObject go = createBasicGroupObject("mygroup"); - LicenseObject lo = createBasicLicenseObject("mylicense"); + FeatureObject go = createBasicGroupObject("mygroup"); + DistributionObject lo = createBasicLicenseObject("mylicense"); TargetObject gwo = createBasicGatewayObject("templategateway2"); m_artifact2groupRepository.create(b1, go); // note that we do not associate b2: this is a resource processor, so it will be packed @@ -1593,7 +1593,7 @@ public class RepositoryAdminTest extends }, false, TOPIC_ADDED); ArtifactObject a1 = m_artifactRepository.importArtifact(noTemplateFile.toURI().toURL(), true); - Artifact2GroupAssociation a2g = m_artifact2groupRepository.create(a1, go); + Artifact2FeatureAssociation a2g = m_artifact2groupRepository.create(a1, go); final StatefulTargetObject sgo = m_statefulGatewayRepository.get(m_bundleContext.createFilter("(" + TargetObject.KEY_ID + "=templategateway2)")).get(0); @@ -1748,17 +1748,17 @@ public class RepositoryAdminTest extends return m_artifactRepository.create(attr, tags); } - private GroupObject createBasicGroupObject(String name) { + private FeatureObject createBasicGroupObject(String name) { Map<String, String> attr = new HashMap<String, String>(); - attr.put(GroupObject.KEY_NAME, name); + attr.put(FeatureObject.KEY_NAME, name); Map<String, String> tags = new HashMap<String, String>(); return m_groupRepository.create(attr, tags); } - private LicenseObject createBasicLicenseObject(String name) { + private DistributionObject createBasicLicenseObject(String name) { Map<String, String> attr = new HashMap<String, String>(); - attr.put(LicenseObject.KEY_NAME, name); + attr.put(DistributionObject.KEY_NAME, name); Map<String, String> tags = new HashMap<String, String>(); return m_licenseRepository.create(attr, tags); @@ -1774,7 +1774,7 @@ public class RepositoryAdminTest extends private DeploymentVersionObject createBasicDeploymentVersionObject(String gatewayID, String version, ArtifactObject... bundles) { Map<String, String> attr = new HashMap<String, String>(); - attr.put(DeploymentVersionObject.KEY_GATEWAYID, gatewayID); + attr.put(DeploymentVersionObject.KEY_TARGETID, gatewayID); attr.put(DeploymentVersionObject.KEY_VERSION, version); Map<String, String> tags = new HashMap<String, String>(); @@ -1791,7 +1791,7 @@ public class RepositoryAdminTest extends return m_deploymentVersionRepository.create(attr, tags, artifacts.toArray(new DeploymentArtifact[0])); } - private Artifact2GroupAssociation createDynamicBundle2GroupAssociation(ArtifactObject artifact, GroupObject group) { + private Artifact2FeatureAssociation createDynamicBundle2GroupAssociation(ArtifactObject artifact, FeatureObject group) { Map<String, String> properties = new HashMap<String, String>(); properties.put(BundleHelper.KEY_ASSOCIATION_VERSIONSTATEMENT, "0.0.0"); return m_artifact2groupRepository.create(artifact, properties, group, null);
Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedDistributionObject.java URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedDistributionObject.java?rev=1301412&r1=1301411&r2=1301412&view=diff ============================================================================== --- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedDistributionObject.java (original) +++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedDistributionObject.java Fri Mar 16 10:05:14 2012 @@ -1,13 +1,13 @@ package org.apache.ace.webui.domain; import org.apache.ace.client.repository.RepositoryObject; -import org.apache.ace.client.repository.object.LicenseObject; +import org.apache.ace.client.repository.object.DistributionObject; import org.apache.ace.webui.NamedObject; public class NamedDistributionObject implements NamedObject { - private final LicenseObject m_target; + private final DistributionObject m_target; - public NamedDistributionObject(LicenseObject target) { + public NamedDistributionObject(DistributionObject target) { m_target = target; } Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedFeatureObject.java URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedFeatureObject.java?rev=1301412&r1=1301411&r2=1301412&view=diff ============================================================================== --- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedFeatureObject.java (original) +++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/domain/NamedFeatureObject.java Fri Mar 16 10:05:14 2012 @@ -1,13 +1,13 @@ package org.apache.ace.webui.domain; import org.apache.ace.client.repository.RepositoryObject; -import org.apache.ace.client.repository.object.GroupObject; +import org.apache.ace.client.repository.object.FeatureObject; import org.apache.ace.webui.NamedObject; public class NamedFeatureObject implements NamedObject { - private final GroupObject m_target; + private final FeatureObject m_target; - public NamedFeatureObject(GroupObject target) { + public NamedFeatureObject(FeatureObject target) { m_target = target; } Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java?rev=1301412&r1=1301411&r2=1301412&view=diff ============================================================================== --- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java (original) +++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java Fri Mar 16 10:05:14 2012 @@ -8,8 +8,8 @@ import org.apache.ace.client.repository. import org.apache.ace.client.repository.RepositoryObject; import org.apache.ace.client.repository.object.ArtifactObject; import org.apache.ace.client.repository.object.TargetObject; -import org.apache.ace.client.repository.object.GroupObject; -import org.apache.ace.client.repository.object.LicenseObject; +import org.apache.ace.client.repository.object.FeatureObject; +import org.apache.ace.client.repository.object.DistributionObject; import org.apache.ace.client.repository.stateful.StatefulTargetObject; import org.apache.ace.webui.NamedObject; import org.apache.ace.webui.domain.NamedArtifactObject; @@ -86,11 +86,11 @@ public class Associations { if (object instanceof ArtifactObject) { return new NamedArtifactObject((ArtifactObject) object); } - else if (object instanceof GroupObject) { - return new NamedFeatureObject((GroupObject) object); + else if (object instanceof FeatureObject) { + return new NamedFeatureObject((FeatureObject) object); } - else if (object instanceof LicenseObject) { - return new NamedDistributionObject((LicenseObject) object); + else if (object instanceof DistributionObject) { + return new NamedDistributionObject((DistributionObject) object); } else if (object instanceof StatefulTargetObject) { return new NamedTargetObject((StatefulTargetObject) object); @@ -203,7 +203,7 @@ public class Associations { if (object instanceof StatefulTargetObject) { StatefulTargetObject sgo = (StatefulTargetObject) object; if (sgo.isRegistered()) { - object = sgo.getGatewayObject(); + object = sgo.getTargetObject(); } else { object = null; Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1301412&r1=1301411&r2=1301412&view=diff ============================================================================== --- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java (original) +++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java Fri Mar 16 10:05:14 2012 @@ -37,19 +37,19 @@ import org.apache.ace.client.repository. import org.apache.ace.client.repository.RepositoryObject; import org.apache.ace.client.repository.SessionFactory; import org.apache.ace.client.repository.helper.bundle.BundleHelper; -import org.apache.ace.client.repository.object.Artifact2GroupAssociation; +import org.apache.ace.client.repository.object.Artifact2FeatureAssociation; import org.apache.ace.client.repository.object.ArtifactObject; import org.apache.ace.client.repository.object.TargetObject; -import org.apache.ace.client.repository.object.Group2LicenseAssociation; -import org.apache.ace.client.repository.object.GroupObject; -import org.apache.ace.client.repository.object.License2GatewayAssociation; -import org.apache.ace.client.repository.object.LicenseObject; -import org.apache.ace.client.repository.repository.Artifact2GroupAssociationRepository; +import org.apache.ace.client.repository.object.Feature2DistributionAssociation; +import org.apache.ace.client.repository.object.FeatureObject; +import org.apache.ace.client.repository.object.Distribution2TargetAssociation; +import org.apache.ace.client.repository.object.DistributionObject; +import org.apache.ace.client.repository.repository.Artifact2FeatureAssociationRepository; import org.apache.ace.client.repository.repository.ArtifactRepository; -import org.apache.ace.client.repository.repository.Group2LicenseAssociationRepository; -import org.apache.ace.client.repository.repository.GroupRepository; -import org.apache.ace.client.repository.repository.License2GatewayAssociationRepository; -import org.apache.ace.client.repository.repository.LicenseRepository; +import org.apache.ace.client.repository.repository.Feature2DistributionAssociationRepository; +import org.apache.ace.client.repository.repository.FeatureRepository; +import org.apache.ace.client.repository.repository.Distribution2TargetAssociationRepository; +import org.apache.ace.client.repository.repository.DistributionRepository; import org.apache.ace.client.repository.stateful.StatefulTargetObject; import org.apache.ace.client.repository.stateful.StatefulTargetRepository; import org.apache.ace.test.utils.FileUtils; @@ -127,22 +127,22 @@ public class VaadinClient extends com.va private volatile SessionFactory m_sessionFactory; private volatile UserAdmin m_userAdmin; private volatile ArtifactRepository m_artifactRepository; - private volatile GroupRepository m_featureRepository; - private volatile LicenseRepository m_distributionRepository; + private volatile FeatureRepository m_featureRepository; + private volatile DistributionRepository m_distributionRepository; private volatile StatefulTargetRepository m_statefulTargetRepository; - private volatile Artifact2GroupAssociationRepository m_artifact2GroupAssociationRepository; - private volatile Group2LicenseAssociationRepository m_group2LicenseAssociationRepository; - private volatile License2GatewayAssociationRepository m_license2GatewayAssociationRepository; + private volatile Artifact2FeatureAssociationRepository m_artifact2GroupAssociationRepository; + private volatile Feature2DistributionAssociationRepository m_group2LicenseAssociationRepository; + private volatile Distribution2TargetAssociationRepository m_license2GatewayAssociationRepository; private volatile RepositoryAdmin m_admin; private volatile LogService m_log; private String m_sessionID; - private volatile List<LicenseObject> m_distributions; + private volatile List<DistributionObject> m_distributions; private ObjectPanel m_artifactsPanel; private ObjectPanel m_featuresPanel; private ObjectPanel m_distributionsPanel; private ObjectPanel m_targetsPanel; private List<ArtifactObject> m_artifacts; - private List<GroupObject> m_features; + private List<FeatureObject> m_features; private List<StatefulTargetObject> m_targets; private final Associations m_associations = new Associations(); @@ -174,12 +174,12 @@ public class VaadinClient extends com.va m_sessionDir = dir; m_sessionFactory.createSession(m_sessionID); addDependency(component, RepositoryAdmin.class); - addDependency(component, LicenseRepository.class); + addDependency(component, DistributionRepository.class); addDependency(component, ArtifactRepository.class); - addDependency(component, GroupRepository.class); - addDependency(component, Artifact2GroupAssociationRepository.class); - addDependency(component, Group2LicenseAssociationRepository.class); - addDependency(component, License2GatewayAssociationRepository.class); + addDependency(component, FeatureRepository.class); + addDependency(component, Artifact2FeatureAssociationRepository.class); + addDependency(component, Feature2DistributionAssociationRepository.class); + addDependency(component, Distribution2TargetAssociationRepository.class); addDependency(component, StatefulTargetRepository.class); } @@ -309,17 +309,17 @@ public class VaadinClient extends com.va m_grid.addComponent(progress, 0, 3); m_artifactsPanel.addListener(m_associations.createSelectionListener(m_artifactsPanel, m_artifactRepository, - new Class[] {}, new Class[] { GroupObject.class, LicenseObject.class, TargetObject.class }, + new Class[] {}, new Class[] { FeatureObject.class, DistributionObject.class, TargetObject.class }, new Table[] { m_featuresPanel, m_distributionsPanel, m_targetsPanel })); m_featuresPanel.addListener(m_associations.createSelectionListener(m_featuresPanel, m_featureRepository, - new Class[] { ArtifactObject.class }, new Class[] { LicenseObject.class, TargetObject.class }, + new Class[] { ArtifactObject.class }, new Class[] { DistributionObject.class, TargetObject.class }, new Table[] { m_artifactsPanel, m_distributionsPanel, m_targetsPanel })); m_distributionsPanel .addListener(m_associations.createSelectionListener(m_distributionsPanel, m_distributionRepository, - new Class[] { GroupObject.class, ArtifactObject.class }, new Class[] { TargetObject.class }, + new Class[] { FeatureObject.class, ArtifactObject.class }, new Class[] { TargetObject.class }, new Table[] { m_artifactsPanel, m_featuresPanel, m_targetsPanel })); m_targetsPanel.addListener(m_associations.createSelectionListener(m_targetsPanel, m_statefulTargetRepository, - new Class[] { LicenseObject.class, GroupObject.class, ArtifactObject.class }, new Class[] {}, + new Class[] { DistributionObject.class, FeatureObject.class, ArtifactObject.class }, new Class[] {}, new Table[] { m_artifactsPanel, m_featuresPanel, m_distributionsPanel })); m_artifactsPanel.setDropHandler(new AssociationDropHandler((Table) null, m_featuresPanel) { @@ -386,7 +386,7 @@ public class VaadinClient extends com.va target.register(); target.setAutoApprove(true); } - m_license2GatewayAssociationRepository.create(getDistribution(left), target.getGatewayObject()); + m_license2GatewayAssociationRepository.create(getDistribution(left), target.getTargetObject()); } }); m_targetsPanel.setDropHandler(new AssociationDropHandler(m_distributionsPanel, (Table) null) { @@ -397,7 +397,7 @@ public class VaadinClient extends com.va target.register(); target.setAutoApprove(true); } - m_license2GatewayAssociationRepository.create(getDistribution(left), target.getGatewayObject()); + m_license2GatewayAssociationRepository.create(getDistribution(left), target.getTargetObject()); } @Override @@ -406,8 +406,8 @@ public class VaadinClient extends com.va }); addListener(m_artifactsPanel, ArtifactObject.TOPIC_ALL); - addListener(m_featuresPanel, GroupObject.TOPIC_ALL); - addListener(m_distributionsPanel, LicenseObject.TOPIC_ALL); + addListener(m_featuresPanel, FeatureObject.TOPIC_ALL); + addListener(m_distributionsPanel, DistributionObject.TOPIC_ALL); addListener(m_targetsPanel, StatefulTargetObject.TOPIC_ALL); m_mainWindow.addComponent(m_grid); } @@ -532,9 +532,9 @@ public class VaadinClient extends com.va @Override protected void removeLinkFromRight(ArtifactObject object, RepositoryObject other) { - List<Artifact2GroupAssociation> associations = object - .getAssociationsWith((GroupObject) other); - for (Artifact2GroupAssociation association : associations) { + List<Artifact2FeatureAssociation> associations = object + .getAssociationsWith((FeatureObject) other); + for (Artifact2FeatureAssociation association : associations) { m_artifact2GroupAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -570,37 +570,37 @@ public class VaadinClient extends com.va public void populate() { removeAllItems(); - for (GroupObject feature : m_featureRepository.get()) { + for (FeatureObject feature : m_featureRepository.get()) { add(feature); } } public void handleEvent(org.osgi.service.event.Event event) { - GroupObject feature = (GroupObject) event.getProperty(GroupObject.EVENT_ENTITY); + FeatureObject feature = (FeatureObject) event.getProperty(FeatureObject.EVENT_ENTITY); String topic = (String) event.getProperty(EventConstants.EVENT_TOPIC); - if (GroupObject.TOPIC_ADDED.equals(topic)) { + if (FeatureObject.TOPIC_ADDED.equals(topic)) { add(feature); } - if (GroupObject.TOPIC_REMOVED.equals(topic)) { + if (FeatureObject.TOPIC_REMOVED.equals(topic)) { remove(feature); } - if (GroupObject.TOPIC_CHANGED.equals(topic)) { + if (FeatureObject.TOPIC_CHANGED.equals(topic)) { change(feature); } } - private void add(GroupObject feature) { + private void add(FeatureObject feature) { Item item = addItem(feature.getDefinition()); if (item != null) { item.getItemProperty(OBJECT_NAME).setValue(feature.getName()); item.getItemProperty(OBJECT_DESCRIPTION).setValue(feature.getDescription()); - Button removeLinkButton = new RemoveLinkButton<GroupObject>(feature, m_artifactsPanel, + Button removeLinkButton = new RemoveLinkButton<FeatureObject>(feature, m_artifactsPanel, m_distributionsPanel) { @Override - protected void removeLinkFromLeft(GroupObject object, RepositoryObject other) { - List<Artifact2GroupAssociation> associations = object + protected void removeLinkFromLeft(FeatureObject object, RepositoryObject other) { + List<Artifact2FeatureAssociation> associations = object .getAssociationsWith((ArtifactObject) other); - for (Artifact2GroupAssociation association : associations) { + for (Artifact2FeatureAssociation association : associations) { m_artifact2GroupAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -608,10 +608,10 @@ public class VaadinClient extends com.va } @Override - protected void removeLinkFromRight(GroupObject object, RepositoryObject other) { - List<Group2LicenseAssociation> associations = object - .getAssociationsWith((LicenseObject) other); - for (Group2LicenseAssociation association : associations) { + protected void removeLinkFromRight(FeatureObject object, RepositoryObject other) { + List<Feature2DistributionAssociation> associations = object + .getAssociationsWith((DistributionObject) other); + for (Feature2DistributionAssociation association : associations) { m_group2LicenseAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -620,20 +620,20 @@ public class VaadinClient extends com.va }; HorizontalLayout buttons = new HorizontalLayout(); buttons.addComponent(removeLinkButton); - buttons.addComponent(new RemoveItemButton<GroupObject, GroupRepository>(feature, + buttons.addComponent(new RemoveItemButton<FeatureObject, FeatureRepository>(feature, m_featureRepository)); item.getItemProperty(ACTIONS).setValue(buttons); } } - private void change(GroupObject go) { + private void change(FeatureObject go) { Item item = getItem(go.getDefinition()); if (item != null) { item.getItemProperty(OBJECT_DESCRIPTION).setValue(go.getDescription()); } } - private void remove(GroupObject go) { + private void remove(FeatureObject go) { removeItem(go.getDefinition()); } }; @@ -692,37 +692,37 @@ public class VaadinClient extends com.va public void populate() { removeAllItems(); - for (LicenseObject distribution : m_distributionRepository.get()) { + for (DistributionObject distribution : m_distributionRepository.get()) { add(distribution); } } public void handleEvent(org.osgi.service.event.Event event) { - LicenseObject distribution = (LicenseObject) event.getProperty(LicenseObject.EVENT_ENTITY); + DistributionObject distribution = (DistributionObject) event.getProperty(DistributionObject.EVENT_ENTITY); String topic = (String) event.getProperty(EventConstants.EVENT_TOPIC); - if (LicenseObject.TOPIC_ADDED.equals(topic)) { + if (DistributionObject.TOPIC_ADDED.equals(topic)) { add(distribution); } - if (LicenseObject.TOPIC_REMOVED.equals(topic)) { + if (DistributionObject.TOPIC_REMOVED.equals(topic)) { remove(distribution); } - if (LicenseObject.TOPIC_CHANGED.equals(topic)) { + if (DistributionObject.TOPIC_CHANGED.equals(topic)) { change(distribution); } } - private void add(LicenseObject distribution) { + private void add(DistributionObject distribution) { Item item = addItem(distribution.getDefinition()); if (item != null) { item.getItemProperty(OBJECT_NAME).setValue(distribution.getName()); item.getItemProperty(OBJECT_DESCRIPTION).setValue(distribution.getDescription()); - Button removeLinkButton = new RemoveLinkButton<LicenseObject>(distribution, m_featuresPanel, + Button removeLinkButton = new RemoveLinkButton<DistributionObject>(distribution, m_featuresPanel, m_targetsPanel) { @Override - protected void removeLinkFromLeft(LicenseObject object, RepositoryObject other) { - List<Group2LicenseAssociation> associations = object - .getAssociationsWith((GroupObject) other); - for (Group2LicenseAssociation association : associations) { + protected void removeLinkFromLeft(DistributionObject object, RepositoryObject other) { + List<Feature2DistributionAssociation> associations = object + .getAssociationsWith((FeatureObject) other); + for (Feature2DistributionAssociation association : associations) { m_group2LicenseAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -730,10 +730,10 @@ public class VaadinClient extends com.va } @Override - protected void removeLinkFromRight(LicenseObject object, RepositoryObject other) { - List<License2GatewayAssociation> associations = object + protected void removeLinkFromRight(DistributionObject object, RepositoryObject other) { + List<Distribution2TargetAssociation> associations = object .getAssociationsWith((TargetObject) other); - for (License2GatewayAssociation association : associations) { + for (Distribution2TargetAssociation association : associations) { m_license2GatewayAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -742,20 +742,20 @@ public class VaadinClient extends com.va }; HorizontalLayout buttons = new HorizontalLayout(); buttons.addComponent(removeLinkButton); - buttons.addComponent(new RemoveItemButton<LicenseObject, LicenseRepository>(distribution, + buttons.addComponent(new RemoveItemButton<DistributionObject, DistributionRepository>(distribution, m_distributionRepository)); item.getItemProperty(ACTIONS).setValue(buttons); } } - private void change(LicenseObject distribution) { + private void change(DistributionObject distribution) { Item item = getItem(distribution.getDefinition()); if (item != null) { item.getItemProperty(OBJECT_DESCRIPTION).setValue(distribution.getDescription()); } } - private void remove(LicenseObject distribution) { + private void remove(DistributionObject distribution) { removeItem(distribution.getDefinition()); } }; @@ -799,9 +799,9 @@ public class VaadinClient extends com.va m_distributionsPanel, null) { @Override protected void removeLinkFromLeft(StatefulTargetObject object, RepositoryObject other) { - List<License2GatewayAssociation> associations = object - .getAssociationsWith((LicenseObject) other); - for (License2GatewayAssociation association : associations) { + List<Distribution2TargetAssociation> associations = object + .getAssociationsWith((DistributionObject) other); + for (Distribution2TargetAssociation association : associations) { m_license2GatewayAssociationRepository.remove(association); } m_associations.removeAssociatedItem(object); @@ -994,8 +994,8 @@ public class VaadinClient extends com.va */ private void createFeature(String name, String description) { Map<String, String> attributes = new HashMap<String, String>(); - attributes.put(GroupObject.KEY_NAME, name); - attributes.put(GroupObject.KEY_DESCRIPTION, description); + attributes.put(FeatureObject.KEY_NAME, name); + attributes.put(FeatureObject.KEY_DESCRIPTION, description); Map<String, String> tags = new HashMap<String, String>(); m_featureRepository.create(attributes, tags); } @@ -1024,8 +1024,8 @@ public class VaadinClient extends com.va */ private void createDistribution(String name, String description) { Map<String, String> attributes = new HashMap<String, String>(); - attributes.put(LicenseObject.KEY_NAME, name); - attributes.put(LicenseObject.KEY_DESCRIPTION, description); + attributes.put(DistributionObject.KEY_NAME, name); + attributes.put(DistributionObject.KEY_DESCRIPTION, description); Map<String, String> tags = new HashMap<String, String>(); m_distributionRepository.create(attributes, tags); } @@ -1034,11 +1034,11 @@ public class VaadinClient extends com.va return m_artifactRepository.get(definition); } - private GroupObject getFeature(String name) { + private FeatureObject getFeature(String name) { return m_featureRepository.get(name); } - private LicenseObject getDistribution(String name) { + private DistributionObject getDistribution(String name) { return m_distributionRepository.get(name); } @@ -1047,7 +1047,7 @@ public class VaadinClient extends com.va } private void deleteFeature(String name) { - GroupObject feature = getFeature(name); + FeatureObject feature = getFeature(name); if (feature != null) { m_featureRepository.remove(feature); // TODO cleanup links?
