Examples of LicenseObject


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

     */
    @Test( groups = { TestUtils.UNIT } )
    public void TestGroup2LicenseAssociations() {
        initializeRepositoryAdmin();
        GroupObject g1 = createBasicGroupObject("group1");
        LicenseObject l1 = createBasicLicenseObject("license1");
        Group2LicenseAssociation g2l1 = m_group2licenseRepository.create(g1, l1);

        assert (g2l1.getLeft().size() == 1) && g2l1.getLeft().contains(g1) : "Left side of the association should be our group.";
        assert (g2l1.getRight().size() == 1) &&  g2l1.getRight().contains(l1) : "Right side of the association should be our license.";

        assert g1.getArtifacts().size() == 0 : "Group 1 should not be associated with any bundles; it is associated with " + g1.getArtifacts().size() + ".";
        assert g1.getLicenses().size() == 1 : "Group 1 should be associated with exactly one license; it is associated with " + g1.getLicenses().size() + ".";

        assert l1.getGroups().size() == 1 : "License 1 should be associated with exactly one group; it is associated with " + l1.getGroups().size() + ".";
        assert l1.getGateways().size() == 0 : "License 1 should not be associated with any gateways; it is associated with " + l1.getGateways().size() + ".";
    }
View Full Code Here

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

     * by TestAssociations.
     */
    @Test( groups = { TestUtils.UNIT } )
    public void testLicense2GatewayAssociations() {
        initializeRepositoryAdmin();
        LicenseObject l1 = createBasicLicenseObject("license1");
        GatewayObject g1 = createBasicGatewayObject("gateway1");
        m_license2gatewayRepository.create(l1, g1);

        assert l1.getGroups().size() == 0 : "License 1 should not be associated with any groups; it is associated with " + l1.getGroups().size() + ".";
        assert l1.getGateways().size() == 1 : "License 1 should be associated with exactly one gateway; it is associated with " + l1.getGateways().size() + ".";

        assert g1.getLicenses().size() == 1 : "Gateway 1 should be associated with exactly one license; it is associated with " + g1.getLicenses().size() + ".";
    }
View Full Code Here

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

                for (LicenseObject distribution : m_distributionRepository.get()) {
                    add(distribution);
                }
            }
            public void handleEvent(org.osgi.service.event.Event event) {
                LicenseObject distribution = (LicenseObject) event.getProperty(LicenseObject.EVENT_ENTITY);
                String topic = (String) event.getProperty(EventConstants.EVENT_TOPIC);
                if (LicenseObject.TOPIC_ADDED.equals(topic)) {
                    add(distribution);
                }
                if (LicenseObject.TOPIC_REMOVED.equals(topic)) {
                    remove(distribution);
                }
                if (LicenseObject.TOPIC_CHANGED.equals(topic)) {
                    change(distribution);
                }
            }
            private void add(LicenseObject distribution) {
                Item item = addItem(distribution.getName());
                item.getItemProperty(OBJECT_NAME).setValue(distribution.getName());
                item.getItemProperty(OBJECT_DESCRIPTION).setValue(distribution.getDescription());
                Button removeLinkButton = new RemoveLinkButton<LicenseObject>(distribution, m_featuresPanel, m_targetsPanel) {
                    @Override
                    protected void removeLinkFromLeft(LicenseObject object, RepositoryObject other) {
                        List<Group2LicenseAssociation> associations = object.getAssociationsWith((GroupObject) other);
                        for (Group2LicenseAssociation association : associations) {
                            m_group2LicenseAssociationRepository.remove(association);
                        }
                        m_associations.removeAssociatedItem(object);
                        m_table.requestRepaint();
                    }

                    @Override
                    protected void removeLinkFromRight(LicenseObject object, RepositoryObject other) {
                        List<License2GatewayAssociation> associations = object.getAssociationsWith((GatewayObject) other);
                        for (License2GatewayAssociation association : associations) {
                            m_license2GatewayAssociationRepository.remove(association);
                        }
                        m_associations.removeAssociatedItem(object);
                        m_table.requestRepaint();
                    }
                };
                HorizontalLayout buttons = new HorizontalLayout();
                buttons.addComponent(removeLinkButton);
                buttons.addComponent(new RemoveItemButton<LicenseObject, LicenseRepository>(distribution, m_distributionRepository));
                item.getItemProperty(ACTIONS).setValue(buttons);
            }
            private void change(LicenseObject distribution) {
                Item item = getItem(distribution.getName());
                item.getItemProperty(OBJECT_DESCRIPTION).setValue(distribution.getDescription());
            }
            private void remove(LicenseObject distribution) {
                removeItem(distribution.getName());
            }
        };
    }
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.