Examples of DeploymentVersionObject


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

        }
    }

    public DeploymentArtifact[] getArtifactsFromDeployment() {
        synchronized(m_lock) {
            DeploymentVersionObject mostRecentDeploymentVersion = m_repository.getMostRecentDeploymentVersion(getID());
            if (mostRecentDeploymentVersion != null) {
                return mostRecentDeploymentVersion.getDeploymentArtifacts();
            }
            return new DeploymentArtifact[0];
        }
    }
View Full Code Here

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

    private void determineStoreState(DeploymentVersionObject deploymentVersionObject) {
        synchronized(m_lock) {
            List<String> fromShop = new ArrayList<String>();
            ArtifactObject[] artifactsFromShop = m_repository.getNecessaryArtifacts(getID());
            DeploymentVersionObject mostRecentVersion;
            if (deploymentVersionObject == null) {
                mostRecentVersion = m_repository.getMostRecentDeploymentVersion(getID());
            }
            else {
                mostRecentVersion = deploymentVersionObject;
            }
            if (artifactsFromShop == null) {
                if (mostRecentVersion == null) {
                    setStoreState(StoreState.New);
                }
                else {
                    setStoreState(StoreState.Unapproved);
                }
                return;
            }

            for (ArtifactObject ao : artifactsFromShop) {
                fromShop.add(ao.getURL());
            }

            List<String> fromDeployment = new ArrayList<String>();
            for (DeploymentArtifact da : getArtifactsFromDeployment()) {
                fromDeployment.add(da.getDirective(DeploymentArtifact.DIRECTIVE_KEY_BASEURL));
            }

            if ((mostRecentVersion == null) && fromShop.isEmpty()) {
                setStoreState(StoreState.New);
            }
            else if (fromShop.containsAll(fromDeployment) && fromDeployment.containsAll(fromShop)) {
                // great, we have the same artifacts. But... do they need to be reprocessed?
                for (ArtifactObject ao : artifactsFromShop) {
                    if (m_repository.needsNewVersion(ao, getID(), mostRecentVersion.getVersion())) {
                        setStoreState(StoreState.Unapproved);
                        return;
                    }
                }
                setStoreState(StoreState.Approved);
View Full Code Here

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

        assert bundles.size() == 0 : "The bundles list should be empty; if not, the ArtifactObject's equals() could be broken.";
    }

    @Test( groups = { TestUtils.UNIT } )
    public void testDeploymentVersion() {
        DeploymentVersionObject version = createBasicDeploymentVersionObject("gateway1", "1", new String[] {"bundle1", "bundle2"});

        assert version.getDeploymentArtifacts().length == 2 : "We expect to find two bundles, but we find " + version.getDeploymentArtifacts().length;
        assert version.getDeploymentArtifacts()[0].getUrl().equals("bundle1");
        assert version.getDeploymentArtifacts()[1].getUrl().equals("bundle2");

        ((DeploymentArtifactImpl) version.getDeploymentArtifacts()[0]).addDirective("myDirective", "myValue");

        try {
            createBasicDeploymentVersionObject("gateway1", "1", new String[] {"bundle1", "bundle2"});
            assert false : "Creating a deployment version with a gateway and version that already exists should not be allowed.";
        }
View Full Code Here

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

    DeploymentVersionObject generateDeploymentVersion(String gatewayID) throws IOException {
        Map<String, String> attr = new HashMap<String, String>();
        attr.put(DeploymentVersionObject.KEY_GATEWAYID, gatewayID);
        Map<String, String> tags = new HashMap<String, String>();

        DeploymentVersionObject mostRecentDeploymentVersion = getMostRecentDeploymentVersion(gatewayID);
        String nextVersion;
        if (mostRecentDeploymentVersion == null) {
            nextVersion = nextVersion(null);
        }
        else {
            nextVersion = nextVersion(mostRecentDeploymentVersion.getVersion());
        }
        attr.put(DeploymentVersionObject.KEY_VERSION, nextVersion);

        synchronized(m_repository) {
            DeploymentVersionObject result = m_deploymentRepository.create(attr, tags, getNecessaryDeploymentArtifacts(gatewayID, nextVersion));

            StatefulGatewayObjectImpl sgoi = getStatefulGatewayObject(gatewayID);
            if (sgoi == null) {
                createStateful(gatewayID);
            }
View Full Code Here

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

                }
            }
        }
        else if (event.getTopic().equals(DeploymentVersionObject.TOPIC_ADDED) || event.getTopic().equals(DeploymentVersionObject.TOPIC_REMOVED)) {
            synchronized(m_repository) {
                DeploymentVersionObject deploymentVersionObject = ((DeploymentVersionObject) event.getProperty(RepositoryObject.EVENT_ENTITY));
                String id = deploymentVersionObject.getGatewayID();
                StatefulGatewayObjectImpl sgoi = getStatefulGatewayObject(id);
                if (sgoi == null) {
                    createStateful(id);
                }
                else {
View Full Code Here

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

        assert m_deploymentVersionRepository.get().get(0).getDeploymentArtifacts()[1].getUrl().equals("bundle2");
    }

    @Test( groups = { TestUtils.UNIT } )
    public void testDeploymentRepository() {
        DeploymentVersionObject version11 = createBasicDeploymentVersionObject("gateway1", "1", new String[] {"bundle1", "bundle2"});
        DeploymentVersionObject version12 = createBasicDeploymentVersionObject("gateway1", "2", new String[] {"bundle3", "bundle4"});
        // Note the different order in adding the versions for gateway2.
        DeploymentVersionObject version22 = createBasicDeploymentVersionObject("gateway2", "2", new String[] {"bundleC", "bundleD"});
        DeploymentVersionObject version21 = createBasicDeploymentVersionObject("gateway2", "1", new String[] {"bundleA", "bundleB"});

        assert m_deploymentVersionRepository.getDeploymentVersions("NotMyGateway").size() == 0 : "The deployment repository should not return" +
            "any versions when we ask for a gateway that does not exist, but it returns " + m_deploymentVersionRepository.getDeploymentVersions("NotMyGateway").size();

        List<DeploymentVersionObject> for1 = m_deploymentVersionRepository.getDeploymentVersions("gateway1");
View Full Code Here

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

    @Test( groups = { TestUtils.UNIT } )
    public void testDeploymentRepositoryFilter() {

        String gwId = "\\ ( * ) gateway1)";
        DeploymentVersionObject version1 = createBasicDeploymentVersionObject(gwId, "1", new String[] {"bundle1", "bundle2"});

        List<DeploymentVersionObject> for1 = m_deploymentVersionRepository.getDeploymentVersions( gwId );
        assert for1.size() == 1 : "We expect one version for" + gwId + ", but we find " + for1.size();
        assert for1.get(0) == version1 : "The only version for" + gwId +  "should be version1";
    }
View Full Code Here

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

        return result;
    }

    public DeploymentVersionObject getMostRecentDeploymentVersion(String gatewayID) {
        List<DeploymentVersionObject> versions = getDeploymentVersions(gatewayID);
        DeploymentVersionObject result = null;
        if ((versions != null) && (versions.size() > 0)) {
            result = versions.get(versions.size() - 1);
        }
        return result;
    }
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.