Package org.apache.ace.client.repository.object

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


            }
        }, 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());
View Full Code Here


    @Test( groups = { TestUtils.UNIT } )
    public void TestFeature2DistributionAssociations() {
        initializeRepositoryAdmin();
        FeatureObject f1 = createBasicFeatureObject("feature1");
        DistributionObject d1 = createBasicDistributionObject("distribution1");
        Feature2DistributionAssociation f2d1 = m_feature2DistributionRepository.create(f1, d1);

        assert (f2d1.getLeft().size() == 1) && f2d1.getLeft().contains(f1) : "Left side of the association should be our feature.";
        assert (f2d1.getRight().size() == 1) &&  f2d1.getRight().contains(d1) : "Right side of the association should be our distribution.";

        assert f1.getArtifacts().size() == 0 : "Feature 1 should not be associated with any artifacts; it is associated with " + f1.getArtifacts().size() + ".";
        assert f1.getDistributions().size() == 1 : "Feature 1 should be associated with exactly one distribution; it is associated with " + f1.getDistributions().size() + ".";

        assert d1.getFeatures().size() == 1 : "Distribution 1 should be associated with exactly one feature; it is associated with " + d1.getFeatures().size() + ".";
View Full Code Here

            }
        }, 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());
View Full Code Here

    @Test(groups = { TestUtils.UNIT })
    public void TestFeature2DistributionAssociations() {
        initializeRepositoryAdmin();
        FeatureObject f1 = createBasicFeatureObject("feature1");
        DistributionObject d1 = createBasicDistributionObject("distribution1");
        Feature2DistributionAssociation f2d1 = m_feature2DistributionRepository.create(f1, d1);

        assert (f2d1.getLeft().size() == 1) && f2d1.getLeft().contains(f1) : "Left side of the association should be our feature.";
        assert (f2d1.getRight().size() == 1) && f2d1.getRight().contains(d1) : "Right side of the association should be our distribution.";

        assert f1.getArtifacts().size() == 0 : "Feature 1 should not be associated with any artifacts; it is associated with " + f1.getArtifacts().size() + ".";
        assert f1.getDistributions().size() == 1 : "Feature 1 should be associated with exactly one distribution; it is associated with " + f1.getDistributions().size() + ".";

        assert d1.getFeatures().size() == 1 : "Distribution 1 should be associated with exactly one feature; it is associated with " + d1.getFeatures().size() + ".";
View Full Code Here

TOP

Related Classes of org.apache.ace.client.repository.object.Feature2DistributionAssociation

Copyright © 2018 www.massapicom. 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.