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

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


        GroupObject g1 = createBasicGroupObject("group1");
        GroupObject g2 = createBasicGroupObject("group2");
        GroupObject g3 = createBasicGroupObject("group3");

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

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

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

        // Check the wiring: what is wired to what?
        List<GroupObject> b1groups = b1.getGroups();
        List<GroupObject> b2groups = b2.getGroups();
View Full Code Here


    @Test( groups = { TestUtils.UNIT } )
    public void testGetAssociationsWith() {
        initializeRepositoryAdmin();
        ArtifactObject b1 = createBasicBundleObject("bundle1");
        GroupObject g1 = createBasicGroupObject("group1");
        Artifact2GroupAssociation b2g1 = m_artifact2groupRepository.create(b1, g1);

        List<Artifact2GroupAssociation> b1Associations = b1.getAssociationsWith(g1);
        List<Artifact2GroupAssociation> g1Associations = g1.getAssociationsWith(b1);

        assert b1Associations.size() == 1 : "The bundle has exactly one association to the group, but it shows " + b1Associations.size() + ".";
View Full Code Here

        bundles.add(b2);
        List<GroupObject> groups = new ArrayList<GroupObject>();
        groups.add(g1);
        groups.add(g3);

        Artifact2GroupAssociation bg = m_artifact2groupRepository.create(bundles, groups);

        assert bg.getLeft().size() == 2 : "We expect two bundles on the left side of the association.";
        assert bg.getRight().size() == 2 : "We expect two groups on the right side of the association.";

        assert bg.getLeft().contains(b1) : "b1 should be on the left side of the association.";
        assert bg.getLeft().contains(b2) : "b2 should be on the left side of the association.";
        assert !bg.getLeft().contains(b3) : "b3 should not be on the left side of the association.";
        assert bg.getRight().contains(g1) : "g1 should be on the right side of the association.";
        assert !bg.getRight().contains(g2) : "g2 should not be on the right side of the association.";
        assert bg.getRight().contains(g3) : "g3 should be on the right side of the association.";

        List<GroupObject> foundGroups = b1.getGroups();
        assert foundGroups.size() == 2 : "b1 should be associated with two groups.";
        assert foundGroups.contains(g1) : "b1 should be associated with g1";
        assert !foundGroups.contains(g2) : "b1 not should be associated with g2";
View Full Code Here

            //expected
        }

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

        Artifact2GroupAssociation bg = m_artifact2groupRepository.create(props, tags);
        assert b1.getGroups().size() == 3 : "The bundle should be associated to three groups.";
        assert (g1.getArtifacts().size() == 1) && g1.getArtifacts().contains(b1) : "g1 should be associated to only b1.";
        assert (g2.getArtifacts().size() == 1) && g2.getArtifacts().contains(b1) : "g1 should be associated to only b1.";
        assert (g3.getArtifacts().size() == 1) && g3.getArtifacts().contains(b1) : "g1 should be associated to only b1.";
    }
View Full Code Here

TOP

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

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.