Package io.fabric8.api

Examples of io.fabric8.api.FabricService


        //System.out.println(executeCommand("fabric:info"));
        //System.out.println(executeCommand("fabric:profile-list"));

        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            waitForFabricCommands();
            String profile = "mq-amq";
            Integer expected = 1;
            boolean changed = fabricService.scaleProfile(profile, expected);
            assertProfileMinimumSize(fabricService, profile, expected);

            // lets call the scale method again, should have no effect as already requirements are updated
            // and we've not started an auto-scaler yet
            changed = fabricService.scaleProfile(profile, expected);
            assertProfileMinimumSize(fabricService, profile, expected);
            Assert.assertEquals("should not have changed!", false, changed);

            changed = fabricService.scaleProfile(profile, 2);
            assertProfileMinimumSize(fabricService, profile, 2);

            // now lets scale down
            changed = fabricService.scaleProfile(profile, -1);

            // since we have no instances right now, scaling down just removes the minimumInstances requirements ;)
            assertProfileMinimumSize(fabricService, profile, null);
        } finally {
            fabricProxy.close();
View Full Code Here


        //System.out.println(executeCommand("fabric:info"));
        //System.out.println(executeCommand("fabric:profile-list"));

        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();

            Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("feature-camel").withProfiles("feature-camel").assertProvisioningResult().build();
            try {
                CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
                assertProvisionedFeature(fabricService, curator, containers, "camel-http", "feature-camel", "camel-http");
                assertProvisionedFeature(fabricService, curator, containers, "camel-jetty", "feature-camel", "camel-jetty");
                assertProvisionedFeature(fabricService, curator, containers, "camel-jms", "feature-camel", "camel-jms");
                assertProvisionedFeature(fabricService, curator, containers, "camel-ftp", "feature-camel", "camel-ftp");
                assertProvisionedFeature(fabricService, curator, containers, "camel-quartz", "feature-camel", "camel-quartz");
View Full Code Here

        //System.out.println(executeCommand("fabric:info"));
        //System.out.println(executeCommand("fabric:profile-list"));

        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();

            Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("feature-camel").withProfiles("feature-camel").assertProvisioningResult().build();
            try {
                CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
                assertProvisionedFeature(fabricService, curator, containers, "camel-script-javascript", "feature-camel", "scriptengines-javascript");
            } finally {
                ContainerBuilder.destroy(containers);
            }
        } finally {
View Full Code Here

        //System.out.println(executeCommand("fabric:info"));
        //System.out.println(executeCommand("fabric:profile-list"));

        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            CuratorFramework curator = fabricService.adapt(CuratorFramework.class);

            Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("feautre-camel").withProfiles("default").assertProvisioningResult().build();
            try {
                prepareFeaturesForTesting(containers, "camel-blueprint", "feautre-camel", "camel-blueprint");
                prepareFeaturesForTesting(containers, "camel-jms", "feautre-camel", "camel-jms");
View Full Code Here

        //System.out.println(executeCommand("fabric:info"));
        //System.out.println(executeCommand("fabric:profile-list"));

        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();

            CreateContainerOptions options = CreateSshContainerOptions.builder().name("ssh1").host(host).port(Integer.parseInt(port)).username(username).password(password).build();
            CreateContainerMetadata[] metadata = fabricService.createContainers(options);
            assertNotNull(metadata);
            assertEquals(1, metadata.length);
            if (metadata[0].getFailure() != null) {
                throw metadata[0].getFailure();
            }
            assertTrue("Expected successful creation of remote ssh container", metadata[0].isSuccess());
            assertNotNull("Expected successful creation of remote ssh container", metadata[0].getContainer());
            Provision.containersStatus(Arrays.asList(metadata[0].getContainer()), "success", PROVISION_TIMEOUT);
            System.out.println(executeCommand("fabric:container-list -v"));
            System.out.println(executeCommand("fabric:container-resolver-list"));
            Container ssh1 = fabricService.getContainer("ssh1");
            assertTrue(ssh1.isAlive());
            createAndAssertChildContainer(fabricService, "ssh2", "ssh1", "default");

            //Stop & Start Remote Child
            Container ssh2 = fabricService.getContainer("ssh2");
            ssh2.stop();
            assertFalse(ssh2.isAlive());
            ssh2.start();
            Provision.containersStatus(Arrays.asList(ssh2), "success", PROVISION_TIMEOUT);
            assertTrue(ssh2.isAlive());
View Full Code Here

        }
    }

    protected void updateStatus(String status, Throwable result, List<String> resources) {
        try {
            FabricService fs = fabricService.get();

            if (fs != null) {
                Container container = fs.getCurrentContainer();
                String e;
                if (result == null) {
                    e = null;
                } else {
                    StringWriter sw = new StringWriter();
View Full Code Here

                CreateContainerBasicOptions.Builder builder = (CreateContainerBasicOptions.Builder) mapper.readValue(mapper.writeValueAsString(optionsMap), cl);
                //We always want to pass the obfuscated version of the password to the container provider.
                builder = (CreateContainerBasicOptions.Builder) builder.zookeeperPassword(PasswordEncoder.encode(getZookeeperPassword()));
                final CreateContainerOptions containerOptions = builder.build();
                final CreationStateListener containerListener = listener;
                final FabricService fabricService = this;
                new Thread("Creating container " + containerName) {
                    public void run() {
                        try {
                            if (dataStore.get().hasContainer(containerName)) {
                                CreateContainerBasicMetadata metadata = new CreateContainerBasicMetadata();
View Full Code Here

            String key = entry.getKey();
            Map<String, String> value = new HashMap<>(entry.getValue());
            mutableConfigurations.put(key, value);
        }
       
        final FabricService fabricService = this;
        for (Map.Entry<String, Map<String, String>> entry : mutableConfigurations.entrySet()) {
            final String pid = entry.getKey();
            Map<String, String> props = entry.getValue();
            for (Map.Entry<String, String> e : props.entrySet()) {
                final String key = e.getKey();
View Full Code Here

        //System.out.println(executeCommand("fabric:profile-list"));

        ModuleContext moduleContext = RuntimeLocator.getRequiredRuntime().getModuleContext();
        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(moduleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            System.out.println(CommandSupport.executeCommand("fabric:version-create"));

            Set<Container> containers = ContainerBuilder.child(1).withName("basic_cnt_c").assertProvisioningResult().build(fabricService);
            try {
                CuratorFramework curator = ServiceLocator.awaitService(CuratorFramework.class);
View Full Code Here

        //System.out.println(executeCommand("fabric:profile-list"));

        ModuleContext moduleContext = RuntimeLocator.getRequiredRuntime().getModuleContext();
        ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(moduleContext, FabricService.class);
        try {
            FabricService fabricService = fabricProxy.getService();
            Set<Container> containers = ContainerBuilder.child(1).withName("basic_cnt_d").assertProvisioningResult().build(fabricService);
            try {
                Container cntD = containers.iterator().next();
                System.out.println(
                        CommandSupport.executeCommands(
View Full Code Here

TOP

Related Classes of io.fabric8.api.FabricService

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.