Package io.fabric8.api

Examples of io.fabric8.api.Version


    public void testContainerProfileWithMissingParents() throws Exception {
        String v = "1.0";
        String profile1Id = "feature-camel";
        String profile2Id = "feature-cxf";
        String missing = "missing";
        Version version = null; //new VersionImpl(v, fabricService);
        List<String> profiles = Arrays.asList(profile1Id, profile2Id, missing);

        expect(profileService.getRequiredVersion(eq(v))).andReturn(version).anyTimes();
        expect(fabricService.getEnvironment()).andReturn("").anyTimes();
        expect(dataStore.getContainerVersion(eq(CONTAINER_ID))).andReturn(v).anyTimes();
View Full Code Here


        String v = "1.0";
        String defaultProfile = "default";
        String camelProfile = "feature-camel";
        String cxfProfile = "feature-cxf";
        Version version = null; //new VersionImpl(v, fabricService);
        List<String> profiles = Arrays.asList(camelProfile, cxfProfile);

        Map<String, String> defaultAttributes = new HashMap<String, String>();
        Map<String, String> camelAttributes = new HashMap<String, String>();
        Map<String, String> cxfAttributes = new HashMap<String, String>();
View Full Code Here

            // we do not want exception in the server log, so print the error message to the console
            System.out.println(e.getMessage());
            return null;
        }

        Version version;
        if (versionId != null) {
            version = profileService.getRequiredVersion(versionId);
        } else {
            version = fabricService.getDefaultVersion();
        }
        if (!version.hasProfile(profileName)) {
            System.out.println("Profile " + profileName + " not found.");
            return null;
        } else if (version.hasProfile(newName)) {
            if (!force) {
                System.out.println("New name " + newName + " already exists. Use --force if you want to overwrite.");
                return null;
            }
        }
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        FabricValidations.validateContainerNames(containerIds);

        // check and validate version
        Version version = profileService.getRequiredVersion(this.version);

        if (containerIds == null || containerIds.isEmpty()) {
            if (all) {
                containerIds = new ArrayList<String>();
                for (Container container : fabricService.getContainers()) {
                    containerIds.add(container.getId());
                }
            } else {
                containerIds = Arrays.asList(fabricService.getCurrentContainer().getId());
            }
        } else {
            if (all) {
                throw new IllegalArgumentException("Can not use --all with a list of containers simultaneously");
            }
        }

        List<Container> toUpgrade = new ArrayList<Container>();
        List<Container> same = new ArrayList<Container>();
        for (String containerName : containerIds) {
            Container container = FabricCommand.getContainer(fabricService, containerName);

            // check first that all can upgrade
            int num = ContainerUpgradeSupport.canUpgrade(version, container);
            if (num < 0) {
                throw new IllegalArgumentException("Container " + container.getId() + " already has a higher version " + container.getVersion()
                        + " than the requested version " + version.getId() + ".");
            } else if (num == 0) {
                // same version
                same.add(container);
            } else {
                // needs upgrade
                toUpgrade.add(container);
            }
        }

        // report same version
        for (Container container : same) {
            System.out.println("Container " + container.getId() + " is already at version " + version.getId());
        }

        // report and do upgrades
        for (Container container : toUpgrade) {
            Version oldVersion = container.getVersion();
            // upgrade version first
            container.setVersion(version);
            // get the profile for version 1.1
            log.info("Upgraded container {} from {} to {}", new Object[]{container.getId(), oldVersion.getId(), version.getId()});
            System.out.println("Upgraded container " + container.getId() + " from version " + oldVersion.getId() + " to " + version.getId());
        }

        if (all) {
            fabricService.setDefaultVersionId(version.getId());
            System.out.println("Changed default version to " + version.getId());
View Full Code Here

    }

    @Test
    public void testCheckRequirementsSatisfied() throws IOException {
        PatchServiceImpl.PatchDescriptor descriptor = getPatchDescriptor("test3.patch");
        Version version =
                buildVersion("1.1").withProfiles("karaf", "default", "patch-prereq3", "patch-somethingelse").done();

        // this should not throw a RuntimeException
        PatchServiceImpl.checkRequirements(version, descriptor);
    }
View Full Code Here

    }

    @Test
    public void testCheckRequirementsMissingPatches() throws IOException {
        PatchServiceImpl.PatchDescriptor descriptor = getPatchDescriptor("test4.patch");
        Version version =
                buildVersion("1.1").withProfiles("karaf", "default", "patch-prereq4a", "patch-somethingelse").done();

        try {
            PatchServiceImpl.checkRequirements(version, descriptor);
            fail("Patch should not have passed requirements check - required patch is missing");
View Full Code Here

    public void testCheckRequirementsMultiplePatches() throws IOException {
        Collection<PatchServiceImpl.PatchDescriptor> patches = new LinkedList<PatchServiceImpl.PatchDescriptor>();
        patches.add(getPatchDescriptor("test3.patch"));
        patches.add(getPatchDescriptor("test4.patch"));

        Version version =
                buildVersion("1.1").withProfiles("karaf", "default", "patch-prereq4a", "patch-prereq3").done();

        try {
            PatchServiceImpl.checkRequirements(version, patches);
            fail("Patch should not have passed requirements check - required patch is missing");
View Full Code Here

    @Test
    public void testGetPatchProfile() throws IOException {
        PatchServiceImpl.PatchDescriptor test1 = getPatchDescriptor("test1.patch");
        PatchServiceImpl.PatchDescriptor test3 = getPatchDescriptor("test3.patch");
        Version version =
                buildVersion("1.1").withProfiles("karaf", "default", "patch-test3").done();

        Profile profile = PatchServiceImpl.getPatchProfile(version, test3);
        assertNotNull("test3 patch profile should be found", profile);
        assertEquals("patch-test3", profile.getId());
View Full Code Here

    @Override
    public List<MQBrokerStatusDTO> loadBrokerStatus() throws Exception {
        FabricRequirements requirements = fabricService.getRequirements();
        List<MQBrokerStatusDTO> answer = new ArrayList<MQBrokerStatusDTO>();
        Version defaultVersion = fabricService.getDefaultVersion();
        Container[] containers = fabricService.getContainers();
        List<Profile> values = getActiveOrRequiredBrokerProfileMap(defaultVersion, requirements);
        for (Profile profile : values) {
            List<MQBrokerConfigDTO> list = createConfigDTOs(mqService, profile);
            for (MQBrokerConfigDTO configDTO : list) {
View Full Code Here

        containers = CommandUtils.filterContainers(containers, filter);

        // we want the list to be sorted
        containers = CommandUtils.sortContainers(containers);

        Version ver = null;
        if (version != null) {
            // limit containers to only with same version
            ver = profileService.getRequiredVersion(version);
        }
View Full Code Here

TOP

Related Classes of io.fabric8.api.Version

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.