Examples of FeatureObject


Examples of org.apache.ace.client.repository.object.FeatureObject

   
    /**
     * {@inheritDoc}
     */
    protected void handleEvent(String topic, RepositoryObject entity, org.osgi.service.event.Event event) {
        FeatureObject feature = (FeatureObject) entity;
        if (FeatureObject.TOPIC_ADDED.equals(topic)) {
            add(feature);
        }
        if (FeatureObject.TOPIC_REMOVED.equals(topic)) {
            remove(feature);
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

    assertEquals("We expect the registration state to be New;", StoreState.New, sgo.getStoreState());
    assertEquals(UNKNOWN_VERSION, sgo.getCurrentVersion());
   
    final ArtifactObject b11 = createBasicBundleObject("bundle1", "1", null);
   
    FeatureObject g1 = createBasicFeatureObject("feature1");
    FeatureObject g2 = createBasicFeatureObject("feature2"); // note that this feature is not associated to a bundle.
   
    createDynamicBundle2FeatureAssociation(b11, g1);
   
    final DistributionObject l1 = createBasicDistributionObject("distribution1");
   
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

public class RepositoryAdminTest extends BaseRepositoryAdminTest {

    public void testAssociationsWithMovingEndpoints() throws Exception {
        final ArtifactObject b1 = createBasicBundleObject("thebundle", "1", null);
        final FeatureObject g1 = createBasicFeatureObject("thefeature");
       
        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_artifact2featureRepository.create(b1, properties, g1, null);
            }
        }, false, Artifact2FeatureAssociation.TOPIC_ADDED);

        assertTrue("The left side of the association should now be b1; we find "
            + bg.getLeft().size() + " bundles on the left side of the association.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b1));
        assertTrue("The right side of the association should now be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
        assertEquals("b1 should be assocated with g1", g1, b1.getFeatures().get(0));
        assertEquals("g1 should be assocated with b1", b1, g1.getArtifacts().get(0));

        final ArtifactObject b2 = runAndWaitForEvent(new Callable<ArtifactObject>() {
            public ArtifactObject call() throws Exception {
                return createBasicBundleObject("thebundle", "2", null);
            }
        }, false, Artifact2FeatureAssociation.TOPIC_CHANGED);

        assertTrue("The left side of the association should no longer be b1; we find "
            + bg.getLeft().size() + " bundles.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b1));
        assertTrue("The left side of the association should now be b2.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b2));
        assertTrue("The right side of the association should now be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
        assertEquals("b1 should not be associated with any feature.", 0, b1.getFeatures().size());
        assertEquals("b2 should now be assocation with g1", g1, b2.getFeatures().get(0));
        assertEquals("g1 should be assocation with b2", b2, g1.getArtifacts().get(0));
        assertEquals("g1 should be associated with one bundle", 1, g1.getArtifacts().size());

        ArtifactObject b3 = createBasicBundleObject("thebundle", "3", null);

        assertTrue("The left side of the association should no longer be b1.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b1));
        assertTrue("The left side of the association should now be b2.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b2));
        assertTrue("The left side of the association should not be b3.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b3));
        assertTrue("The right side of the association should now be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
        assertEquals("b1 should not be associated with any feature.", 0, b1.getFeatures().size());
        assertEquals("b2 should now be assocation with g1", g1, b2.getFeatures().get(0));
        assertEquals("b3 should not be associated with any feature.", 0, b3.getFeatures().size());
        assertEquals("g1 should be assocation with b2", b2, g1.getArtifacts().get(0));
        assertEquals("g1 should be associated with one bundle", 1, g1.getArtifacts().size());

        ArtifactObject b15 = createBasicBundleObject("thebundle", "1.5", null);

        assertTrue("The left side of the association should no longer be b1.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b1));
        assertTrue("The left side of the association should not be b15.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b15));
        assertTrue("The left side of the association should now be b2.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b2));
        assertTrue("The left side of the association should not be b3.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b3));
        assertTrue("The right side of the association should now be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
        assertEquals("b1 should not be associated with any feature.", 0, b1.getFeatures().size());
        assertEquals("b15 should not be associated with any feature.", 0, b15.getFeatures().size());
        assertEquals("b2 should now be assocation with g1", g1, b2.getFeatures().get(0));
        assertEquals("b3 should not be associated with any feature.", 0, b3.getFeatures().size());
        assertEquals("g1 should be assocation with b2", b2, g1.getArtifacts().get(0));
        assertEquals("g1 should be associated with one bundle", 1, g1.getArtifacts().size());

        runAndWaitForEvent(new Callable<Object>() {
            public Object call() throws Exception {
                m_artifactRepository.remove(b2);
                return null;
            }
        }, false, Artifact2FeatureAssociation.TOPIC_CHANGED);

        // note that we cannot test anything for b2: this has been removed, and now has no
        // defined state.
        assertTrue("The left side of the association should no longer be b1.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b1));
        assertTrue("The left side of the association should now be b15.", (bg.getLeft().size() == 1) && bg.getLeft().contains(b15));
        assertTrue("The left side of the association should not be b3.", (bg.getLeft().size() == 1) && !bg.getLeft().contains(b3));
        assertTrue("The right side of the association should now be g1.", (bg.getRight().size() == 1) && bg.getRight().contains(g1));
        assertEquals("b1 should not be associated with any feature.", 0, b1.getFeatures().size());
        assertEquals("b15 should now be assocation with g1", g1, b15.getFeatures().get(0));
        assertEquals("b3 should not be associated with any feature.", 0, b3.getFeatures().size());
        assertEquals("g1 should be assocation with b15", b15, g1.getArtifacts().get(0));
        assertEquals("g1 should be associated with one bundle", 1, g1.getArtifacts().size());

        cleanUp();
    }
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

        final StatefulTargetObject sgo =
            m_statefulTargetRepository.get(
                m_bundleContext.createFilter("(" + TargetObject.KEY_ID + "=" + "testAutoApproveTarget)")).get(0);

        // Set up some deployment information for the target.
        final FeatureObject g = runAndWaitForEvent(new Callable<FeatureObject>() {
            public FeatureObject call() throws Exception {
                ArtifactObject b = createBasicBundleObject("myBundle", "1.0", null);
                FeatureObject g = createBasicFeatureObject("myFeature");
                DistributionObject l = createBasicDistributionObject("myDistribution");
                m_artifact2featureRepository.create(b, g);
                m_feature2distributionRepository.create(g, l);
                m_distribution2targetRepository.create(l, sgo.getTargetObject());
                return g;
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

            .add(loginContext1.createTargetRepositoryContext()
                .setLocation(m_endpoint).setCustomer("apache").setName("target").setWriteable());

        m_repositoryAdmin.login(loginContext1);

        FeatureObject g1 = createBasicFeatureObject("feature1");
        DistributionObject l1 = createBasicDistributionObject("distribution1");

        m_feature2distributionRepository.create(g1, l1);

        m_repositoryAdmin.logout(false);
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

     *
     * @throws Exception
     */
    public void testRemoveBundleFeature() throws Exception {
        final ArtifactObject b1 = createBasicBundleObject("thebundle", "1", null);
        final FeatureObject g1 = createBasicFeatureObject("thefeature");

        final Artifact2FeatureAssociation bg = runAndWaitForEvent(new Callable<Artifact2FeatureAssociation>() {
            public Artifact2FeatureAssociation call() throws Exception {
                return m_artifact2featureRepository.create("(&(" + BundleHelper.KEY_SYMBOLICNAME + "=thebundle)(|("
                    + BundleHelper.KEY_VERSION + ">=1)(" + BundleHelper.KEY_VERSION + "=<3))(!("
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

        attr.put(ArtifactObject.KEY_RESOURCE_ID, "mymime");
        attr.put(ArtifactHelper.KEY_MIMETYPE, "mymime");

        ArtifactObject a2 = m_artifactRepository.create(attr, tags);

        FeatureObject g = createBasicFeatureObject("feature");
        DistributionObject l = createBasicDistributionObject("distribution");

        attr = new HashMap<String, String>();
        attr.put(TargetObject.KEY_ID, "myTarget");
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

        String simpleTemplate = "<Attribute content=\"http://$context.name\"/>";
        String simpleTemplateProcessed = "<Attribute content=\"http://mydistribution\"/>";
        File simpleTemplateFile = createFileWithContents("template", ".xml", xmlHeader + simpleTemplate + xmlFooter);

        // create some tree from artifacts to a target
        FeatureObject go = runAndWaitForEvent(new Callable<FeatureObject>() {
            public FeatureObject call() throws Exception {
                ArtifactObject b1 = createBasicBundleObject("myBundle");
                createBasicBundleObject("myProcessor", "1.0.0", "org.osgi.deployment.rp.autoconf");
                FeatureObject go = createBasicFeatureObject("myfeature");
                DistributionObject lo = createBasicDistributionObject("mydistribution");
                TargetObject gwo = createBasicTargetObject("templatetarget2");
                m_artifact2featureRepository.create(b1, go);
                // note that we do not associate b2: this is a resource processor, so it will be packed
                // implicitly. It should not be available to a preprocessor either.
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

        String targetId = "templatetarget";

        createBasicBundleObject("myProcessor", "1.0.0", "myProcessor.pid");
        final ArtifactObject b1 = createBasicBundleObject("myBundle");
        final ArtifactObject a1 = createBasicArtifactObject("myArtifact", "mymime", "myProcessor.pid");
        final FeatureObject go = createBasicFeatureObject("myfeature");
        final DistributionObject lo = createBasicDistributionObject("mydistribution");
    final TargetObject gwo = createBasicTargetObject(targetId);

        // create some tree from artifacts to a target
        runAndWaitForEvent(new Callable<Object>() {
View Full Code Here

Examples of org.apache.ace.client.repository.object.FeatureObject

    public void testSerialization() throws IOException {
        ArtifactObject b1 = createBasicArtifactObject("artifact1");
        ArtifactObject b2 = createBasicArtifactObject("artifact2");
        ArtifactObject b3 = createBasicArtifactObject("artifact3");

        FeatureObject g1 = createBasicFeatureObject("feature1");
        FeatureObject g2 = createBasicFeatureObject("feature2");

        m_artifact2FeatureRepository.create(b1, g1);
        m_artifact2FeatureRepository.create(b2, g2);
        m_artifact2FeatureRepository.create(b3, g2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.