Examples of FabricRequirements


Examples of io.fabric8.api.FabricRequirements

    public void testMaximumProfileCountPerHost() throws Exception {
        String hostSmall = "small";
        String hostMedium = "medium";
        String hostBig = "big";

        FabricRequirements requirements = new FabricRequirements();
        requirements.sshConfiguration().defaultPath("/opt/fuse").defaultUsername("root").defaultPassword("adminuser").defaultPassPhrase("cheese");
        requirements.sshHost(hostSmall).hostName(hostSmall).maximumContainerCount(1);
        requirements.sshHost(hostMedium).hostName(hostMedium).maximumContainerCount(2);
        requirements.sshHost(hostBig).hostName(hostBig).maximumContainerCount(8);
        requirements.profile(mqProfileId).minimumInstances(2).maximumInstancesPerHost(1).sshScaling().hostPatterns("!small");
        requirements.profile(exampleProfileId).minimumInstances(5).dependentProfiles(mqProfileId);

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        assertHostHasProfileCount(hostProfileCounter, hostSmall, exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostMedium, exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostMedium, mqProfileId, 1);
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

    @Test
    public void testAllocateEquallyUsingTags() throws Exception {
        String[] mqBoxes = {"mq1", "mq2"};
        String[] esbBoxes = {"esb1", "esb2", "esb3", "esb4"};

        FabricRequirements requirements = new FabricRequirements();
        requirements.sshConfiguration().defaultUsername("root");

        for (String box : mqBoxes) {
            requirements.sshHost(box).tags("mq");
        }
        for (String box : esbBoxes) {
            requirements.sshHost(box).tags("esb");
        }
        requirements.profile(mqProfileId).minimumInstances(2).sshScaling().hostTags("mq");
        requirements.profile(exampleProfileId).minimumInstances(8).dependentProfiles(mqProfileId).sshScaling().hostTags("esb");

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        for (String box : mqBoxes) {
            assertHostHasProfileCount(hostProfileCounter, box, mqProfileId, 1);
        }
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

    @Test
    public void testAllocateInHostListOrder() throws Exception {
        String[] esbBoxes = {"esb1", "esb2", "esb3", "esb4"};

        FabricRequirements requirements = new FabricRequirements();
        requirements.sshConfiguration().defaultUsername("root");

        for (String box : esbBoxes) {
            requirements.sshHost(box);
        }
        requirements.profile(exampleProfileId).minimumInstances(2);

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        assertHostHasProfileCount(hostProfileCounter, "esb1", exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, "esb2", exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, "esb3", exampleProfileId, 0);
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

        profile = profileService.updateProfile(builder.getProfile());

        Integer minimumInstances = requirements.getMinimumInstances();
        if (minimumInstances != null) {
            FabricRequirements fabricRequirements = fabricService.get().getRequirements();
            ProfileRequirements profileRequirements = fabricRequirements.getOrCreateProfileRequirement(profile.getId());
            profileRequirements.setMinimumInstances(minimumInstances);
            fabricService.get().setRequirements(fabricRequirements);
        }

        // lets find a hawtio profile and version
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

        String profile = request.getProfile();
        String version = request.getVersion();
        FabricService fabricService = request.getFabricService();

        Container[] containers = fabricService.getContainers();
        FabricRequirements requirements = request.getFabricRequirements();
        List<? extends HostConfiguration> hostConfigurations = requirements.getSshHosts();
        HostProfileCounter hostProfileCounter = new HostProfileCounter();
        AutoScalers.createHostToProfileScaleMap(hostProfileCounter, hostConfigurations, containers);

        for (int i = 0; i < count; i++) {
            CreateSshContainerOptions.Builder builder = null;
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

    /**
     * This method is public for easier testing
     */
    public static CreateSshContainerOptions.Builder chooseHostContainerOptions(AutoScaleRequest request, HostProfileCounter hostProfileCounter) {
        CreateSshContainerOptions.Builder builder = CreateSshContainerOptions.builder();
        FabricRequirements requirements = request.getFabricRequirements();
        ProfileRequirements profileRequirements = request.getProfileRequirements();
        SshScalingRequirements sshScalingRequirements = profileRequirements.getSshScalingRequirements();
        List<SshHostConfiguration> hosts = requirements.getSshHosts();
        SortedSet<LoadSortedHostConfiguration<SshHostConfiguration>> sortedHostConfigurations = AutoScalers.filterHosts(profileRequirements, sshScalingRequirements, hostProfileCounter, hosts);
        SshHostConfiguration sshHostConfig = null;
        if (!sortedHostConfigurations.isEmpty()) {
            LoadSortedHostConfiguration<SshHostConfiguration> first = sortedHostConfigurations.first();
            sshHostConfig = first.getConfiguration();
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

        workDir.mkdirs();

        String profileId = assertGenerateArchetype(archetype, workDir, mavenSettingsFile);
        assertNotNull("Should have a profile ID for " + archetype, profileId);

        FabricRequirements requirements = fabricController.getRequirements();
        if (!addedBroker) {
            addedBroker = true;
            requirements.profile("mq-default").minimumInstances(1);
            FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);
        }

        // deploying each profile should have caused the requirements to be updated to add them all now
        // so lets load the requirements and assert they are satisfied
        requirements.profile(profileId).minimumInstances(1);
        FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);
        System.out.println();
        System.out.println("Managed to create a container for " + profileId + ". Now lets stop it");
        System.out.println();

        // now lets force the container to be stopped
        requirements.profile(profileId).minimumInstances(0).maximumInstances(0);
        FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);
        System.out.println();
        System.out.println("Stopped a container for " + profileId + ". Now lets clear requirements");
        System.out.println();
        requirements.removeProfileRequirements(profileId);
        FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);

        System.out.println();
        System.out.println("Removed requirements for profile " + profileId);
        System.out.println();
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

        try {
            Thread.sleep(2000);
        } catch (Exception e) {
            // ignore
        }
        FabricRequirements requirements = fabricService.getRequirements();
        ProfileRequirements profileRequirements = requirements.getOrCreateProfileRequirement(profile);
        Assert.assertNotNull("Should have profile requirements for profile " + profile, profileRequirements);
        Assert.assertEquals("profile " + profile + " minimum instances", expected, profileRequirements.getMinimumInstances());
        System.out.println("Profile " + profile + " now has requirements " + profileRequirements);
    }
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

    @Test
    public void createProvisionedFabric() throws Exception {
        System.out.println("The fabric has now been created somewhere and we have a controller for it, so lets define our requirements");

        FabricRequirements requirements = new FabricRequirements();
        requirements.profile("mq-default").minimumInstances(1);

        FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);

        // now lets ensure that the autoscaler can scale back down again, stopping the broker
        requirements.profile("mq-default").minimumInstances(0).maximumInstances(0);
        FabricAssertions.assertRequirementsSatisfied(fabricController, requirements);
    }
View Full Code Here

Examples of io.fabric8.api.FabricRequirements

    }

    @Override
    public FabricRequirements getRequirements() {
        assertValid();
        FabricRequirements requirements = dataStore.get().getRequirements();
        requirements.setVersion(getDefaultVersionId());
        return requirements;
    }
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.