Examples of FeatureObject


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

        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

        final ArtifactObject b1 = createBasicBundleObject("bundle1", "1", null, "10");
        final ArtifactObject b2 = createBasicBundleObject("bundle2", "1", null);
        final ArtifactObject b3 = createBasicBundleObject("bundle3", "1", null, "foo");

        FeatureObject f1 = createBasicFeatureObject("feature1");

        createDynamicBundle2FeatureAssociation(b1, f1);
        createDynamicBundle2FeatureAssociation(b2, f1);
        createDynamicBundle2FeatureAssociation(b3, f1);
View Full Code Here

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

    @Override
    public Artifact2FeatureAssociation createArtifact2FeatureAssociation(String artifactId, String featureId) {
        boolean dynamicRelation = false;

        FeatureObject feature = m_featureRepository.get(featureId);
        ArtifactObject artifact = m_artifactRepository.get(artifactId);
        if (artifact == null) {
            // Maybe a BSN?
            try {
                List<ArtifactObject> artifacts = m_artifactRepository.get(FrameworkUtil.createFilter(String.format("(%s=%s)", Constants.BUNDLE_SYMBOLICNAME, artifactId)));
View Full Code Here

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

        return m_distribution2targetAssociationRepository.create(distribution, target.getTargetObject());
    }

    @Override
    public Feature2DistributionAssociation createFeature2DistributionAssociation(String featureId, String distributionId) {
        FeatureObject feature = m_featureRepository.get(featureId);
        DistributionObject distribution = m_distributionRepository.get(distributionId);
        return m_feature2distributionAssociationRepository.create(feature, distribution);
    }
View Full Code Here

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

        // Create two, rather boring, artifacts.
        ArtifactObject b1 = createBasicArtifactObject("artifact1");
        ArtifactObject b2 = createBasicArtifactObject("artifact2");

        // Create three features.
        FeatureObject g1 = createBasicFeatureObject("feature1");
        FeatureObject g2 = createBasicFeatureObject("feature2");
        FeatureObject g3 = createBasicFeatureObject("feature3");

        // Create some associations.
        Artifact2FeatureAssociation b2g1 = m_artifact2FeatureRepository.create(b1, g2);
        assert b2g1 != null;
        Artifact2FeatureAssociation b2g2 = m_artifact2FeatureRepository.create(b2, g1);
        assert b2g2 != null;
        Artifact2FeatureAssociation b2g3 = m_artifact2FeatureRepository.create(b1, g3);
        assert b2g3 != null;
        Artifact2FeatureAssociation b2g4 = m_artifact2FeatureRepository.create(b2, g3);
        assert b2g4 != null;

        // Do some basic checks on the repositories.
        assert m_artifactRepository.get().size() == 2 : "We should have two artifacts in our repository; we found " + m_artifactRepository.get().size() + ".";
        assert m_featureRepository.get().size() == 3 : "We should have three features in our repository; we found " + m_featureRepository.get().size() + ".";
        assert m_artifact2FeatureRepository.get().size() == 4 : "We should have four associations in our repository; we found " + m_artifact2FeatureRepository.get().size() + ".";

        assert (b2g4.getLeft().size() == 1) && b2g4.getLeft().contains(b2) : "The left side of the fourth association should be artifact 2.";
        assert (b2g4.getRight().size() == 1) && b2g4.getRight().contains(g3) : "The right side of the fourth association should be feature 3.";

        // Check the wiring: what is wired to what?
        List<FeatureObject> b1features = b1.getFeatures();
        List<FeatureObject> b2features = b2.getFeatures();

        List<ArtifactObject> g1artifacts = g1.getArtifacts();
        List<ArtifactObject> g2artifacts = g2.getArtifacts();
        List<ArtifactObject> g3artifacts = g3.getArtifacts();
        List<DistributionObject> g1distributions = g1.getDistributions();
        List<DistributionObject> g2distributions = g2.getDistributions();
        List<DistributionObject> g3distributions = g3.getDistributions();

        assert g1distributions.size() == 0 : "Feature one should not have any associations to distributions; we found " + g1distributions.size() + ".";
        assert g2distributions.size() == 0 : "Feature two should not have any associations to distributions; we found " + g2distributions.size() + ".";
        assert g3distributions.size() == 0 : "Feature three should not have any associations to distributions; we found " + g3distributions.size() + ".";

        List<FeatureObject> b1expectedFeatures = new ArrayList<FeatureObject>();
        b1expectedFeatures.add(g2);
        b1expectedFeatures.add(g3);
        List<FeatureObject> b2expectedFeatures = new ArrayList<FeatureObject>();
        b2expectedFeatures.add(g1);
        b2expectedFeatures.add(g3);

        List<ArtifactObject> g1expectedArtifacts = new ArrayList<ArtifactObject>();
        g1expectedArtifacts.add(b2);
        List<ArtifactObject> g2expectedArtifacts = new ArrayList<ArtifactObject>();
        g2expectedArtifacts.add(b1);
        List<ArtifactObject> g3expectedArtifacts = new ArrayList<ArtifactObject>();
        g3expectedArtifacts.add(b1);
        g3expectedArtifacts.add(b2);

        assert b1features.containsAll(b1expectedFeatures) && b1expectedFeatures.containsAll(b1features) : "b1 should be associated to exactly features 2 and 3.";
        assert b2features.containsAll(b2expectedFeatures) && b2expectedFeatures.containsAll(b2features) : "b2 should be associated to exactly features 1 and 3.";

        assert g1artifacts.containsAll(g1expectedArtifacts) && g1expectedArtifacts.containsAll(g1artifacts) : "g1 should be associated to exactly artifact 2.";
        assert g2artifacts.containsAll(g2expectedArtifacts) && g2expectedArtifacts.containsAll(g2artifacts) : "g2 should be associated to exactly artifact 1.";
        assert g3artifacts.containsAll(g3expectedArtifacts) && g3expectedArtifacts.containsAll(g3artifacts) : "g3 should be associated to exactly artifacts 1 and 2.";

        m_artifact2FeatureRepository.remove(b2g4);

        b1features = b1.getFeatures();
        b2features = b2.getFeatures();
        g1artifacts = g1.getArtifacts();
        g2artifacts = g2.getArtifacts();
        g3artifacts = g3.getArtifacts();

        b2expectedFeatures.remove(g3);
        g3expectedArtifacts.remove(b2);

        assert b1features.containsAll(b1expectedFeatures) && b1expectedFeatures.containsAll(b1features) : "b1 should be associated to exactly features 2 and 3.";
View Full Code Here

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

        return object.getName();
    }

    @Override
    protected void handleEvent(String topic, RepositoryObject entity, org.osgi.service.event.Event event) {
        FeatureObject feature = (FeatureObject) entity;
        if (FeatureObject.TOPIC_ADDED.equals(topic)) {
            addToTable(feature);
        }
        if (FeatureObject.TOPIC_REMOVED.equals(topic)) {
            removeFromTable(feature);
View Full Code Here

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

    }

    @Test(groups = { TestUtils.UNIT })
    public void testAssociationsWithCardinality() {
        ArtifactObject a1 = createBasicArtifactObject("a1");
        FeatureObject f1 = createBasicFeatureObject("f1");
        FeatureObject f2 = createBasicFeatureObject("f2");
        FeatureObject f3 = createBasicFeatureObject("f3");

        Map<String, String> props = new HashMap<String, String>();
        props.put(Association.LEFT_ENDPOINT, "(" + BundleHelper.KEY_SYMBOLICNAME + "=a1)");
        props.put(Association.LEFT_CARDINALITY, "1");
        props.put(Association.RIGHT_ENDPOINT, "(" + FeatureObject.KEY_NAME + "=f*)");
        props.put(Association.RIGHT_CARDINALITY, "2");
        Map<String, String> tags = new HashMap<String, String>();

        try {
            m_artifact2FeatureRepository.create(props, tags);
            assert false : "There are three matches for the feature, but we have a cardinality of 2; we should expect a NPE because no comparator is provided.";
        }
        catch (NullPointerException npe) {
            // expected
        }

        props.put(Association.RIGHT_CARDINALITY, "3");

        Artifact2FeatureAssociation bg = m_artifact2FeatureRepository.create(props, tags);
        assert bg != null : "Assocating artifact to feature failed?!";

        assert a1.getFeatures().size() == 3 : "The artifact should be associated to three features.";
        assert (f1.getArtifacts().size() == 1) && f1.getArtifacts().contains(a1) : "g1 should be associated to only b1.";
        assert (f2.getArtifacts().size() == 1) && f2.getArtifacts().contains(a1) : "g1 should be associated to only b1.";
        assert (f3.getArtifacts().size() == 1) && f3.getArtifacts().contains(a1) : "g1 should be associated to only b1.";
    }
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.