Package io.fabric8.api

Examples of io.fabric8.api.Container


        verify(c1, c2);
    }

    @Test
    public void testMultipleContainerStatusWithTimeout() throws Exception {
        Container c1 = createMock(Container.class);
        expect(c1.getId()).andReturn("c1").anyTimes();
        expect(c1.isManaged()).andReturn(true).anyTimes();
        expect(c1.isAlive()).andReturn(true).anyTimes();
        expect(c1.getProvisionStatus()).andReturn("").times(3);
        expect(c1.getProvisionStatus()).andReturn("analyzing").times(3);
        expect(c1.getProvisionStatus()).andReturn("installing").times(3);
        expect(c1.getProvisionStatus()).andReturn("success").anyTimes();
        expect(c1.getSshUrl()).andReturn("container:8181").anyTimes();
        expect(c1.getProvisionException()).andReturn(null).anyTimes();

        Container c2 = createMock(Container.class);
        expect(c2.getId()).andReturn("c2").anyTimes();
        expect(c2.isManaged()).andReturn(true).anyTimes();
        expect(c2.isAlive()).andReturn(false).times(3);
        expect(c2.isAlive()).andReturn(true).anyTimes();
        expect(c2.getProvisionStatus()).andReturn("").times(3);
        expect(c2.getProvisionStatus()).andReturn("analyzing").times(3);
        expect(c2.getProvisionStatus()).andReturn("installing").times(3);
        expect(c2.getProvisionStatus()).andReturn("finalizing").anyTimes();
        expect(c2.getSshUrl()).andReturn("container2:8181").anyTimes();
        expect(c2.getProvisionException()).andReturn(null).anyTimes();

        replay(c1, c2);

        assertFalse(Provision.containerStatus(Arrays.asList(c1, c2), 10000L));
        verify(c1, c2);
View Full Code Here


            setData(curator.get(), CONTAINER_IP.getPath(runtimeIdentity), ip);

            createDefault(curator.get(), CONTAINER_GEOLOCATION.getPath(runtimeIdentity), geoLocationService.get().getGeoLocation());

            //We are creating a dummy container object, since this might be called before the actual container is ready.
            Container current = new ImmutableContainerBuilder().id(runtimeIdentity).ip(ip).build();
            registerHttp(current);
            registerJmx(current);

            //Set the port range values
            String minimumPort = sysprops.getProperty(ZkDefs.MINIMUM_PORT);
View Full Code Here

            controller = null;
        }
    }

    protected Profile getProcessProfile(ProcessRequirements requirements, boolean includeController) {
        Container container = fabricService.getCurrentContainer();
        ProfileService profileService = fabricService.adapt(ProfileService.class);
        Profile processProfile = getProcessProfile(requirements, includeController, container);
        return Profiles.getEffectiveProfile(fabricService, profileService.getOverlayProfile(processProfile));
    }
View Full Code Here

        this.fabricService = fabricService;
    }

    @Override
    public List<Installation> listInstallations(final ContainerInstallOptions options) {
        Container container = options.getContainer();
        ProcessManagerJmxTemplate jmxTemplate = getJmxTemplate(container, options.getUser(), options.getPassword());
        return jmxTemplate.execute(new ProcessManagerCallback<List<Installation>>() {
            @Override
            public List<Installation> doWithProcessManager(ProcessManagerServiceMBean processManagerService) throws Exception {
                return processManagerService.listInstallations();
View Full Code Here

        });
    }

    @Override
    public Installation install(final ContainerInstallOptions options, final InstallTask postInstall) throws Exception {
        Container container = options.getContainer();
        ProcessManagerJmxTemplate jmxTemplate = getJmxTemplate(container, options.getUser(), options.getPassword());
        return jmxTemplate.execute(new ProcessManagerCallback<Installation>() {
            @Override
            public Installation doWithProcessManager(ProcessManagerServiceMBean processManagerService) throws Exception {
                return processManagerService.install(options.asInstallOptions(), postInstall);
View Full Code Here

        });
    }

    @Override
    public Installation installJar(final ContainerInstallOptions options, final InstallTask postInstall) throws Exception {
        Container container = options.getContainer();
        ProcessManagerJmxTemplate jmxTemplate = getJmxTemplate(container, options.getUser(), options.getPassword());
        return jmxTemplate.execute(new ProcessManagerCallback<Installation>() {
            @Override
            public Installation doWithProcessManager(ProcessManagerServiceMBean processManagerService) throws Exception {
                return processManagerService.installJar(options.asInstallOptions(), postInstall);
View Full Code Here

        });
    }

    @Override
    public ImmutableMap<String, Installation> listInstallationMap(final ContainerInstallOptions options) {
        Container container = options.getContainer();
        ProcessManagerJmxTemplate jmxTemplate = getJmxTemplate(container, options.getUser(), options.getPassword());
        return jmxTemplate.execute(new ProcessManagerCallback<ImmutableMap<String, Installation>>() {
            @Override
            public ImmutableMap<String, Installation> doWithProcessManager(ProcessManagerServiceMBean processManagerService) throws Exception {
                return processManagerService.listInstallationMap();
View Full Code Here

                    ZooKeeperUtils.setData(curator.get(), CONTAINER_ADDRESS.getPath(runtimeIdentity, resolver), address);
                }
            }

            //We are creating a dummy container object, since this might be called before the actual container is ready.
            Container current = new ImmutableContainerBuilder().id(runtimeIdentity).ip(ip).build();
            //Read all tomcat connectors
            initializeConnectors();
            registerHttp(current);

            //Set the port range values
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();
                    result.printStackTrace(new PrintWriter(sw));
                    e = sw.toString();
                }
                if (resources != null) {
                    container.setProvisionList(resources);
                }
                container.setProvisionResult(status);
                container.setProvisionException(e);
            } else {
                LOGGER.info("FabricService not available");
            }
        } catch (Throwable e) {
            LOGGER.warn("Unable to set provisioning result");
View Full Code Here

        displayContainers(metadata);
        return null;
    }

    protected void validateParentContainer(String parent) {
        Container container = fabricService.getContainer(parent);
        if (container == null) {
            throw new IllegalArgumentException("Parent container " + parent + " does not exists!");
        }
        if (!container.isRoot()) {
            throw new IllegalArgumentException("Parent container " + parent + " must be a root container!");
        }
    }
View Full Code Here

TOP

Related Classes of io.fabric8.api.Container

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.