Search in sources :

Example 6 with FabricMBean

use of io.fabric8.jolokia.facade.mbeans.FabricMBean in project fabric8 by jboss-fuse.

the class JolokiaFabricConnector method connect.

/**
 * connects to a fabric
 */
public void connect() {
    if (this.j4p != null || this.fabricServiceFacade != null) {
        disconnect();
    }
    this.j4p = J4pClient.url(this.url).user(this.userName).password(this.password).build();
    /* This needs further investigation...
        DefaultHttpClient httpClient = (DefaultHttpClient) j4p.getHttpClient();
        httpClient.setRedirectStrategy(new DefaultRedirectStrategy() {
            @Override
            public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
                return true;
            }
        });
        */
    this.fabricServiceFacade = new FabricServiceFacade(this);
    this.fabricMBeanFacade = new FabricMBean(this);
}
Also used : FabricMBean(io.fabric8.jolokia.facade.mbeans.FabricMBean) FabricServiceFacade(io.fabric8.jolokia.facade.facades.FabricServiceFacade)

Example 7 with FabricMBean

use of io.fabric8.jolokia.facade.mbeans.FabricMBean in project fabric8 by jboss-fuse.

the class FabricMBeanFacadeTest method testRequirements.

@Test
public void testRequirements() {
    // this can only be run if you have a fabric running...
    Assume.assumeTrue(Boolean.valueOf(System.getProperty("hasFabric")));
    FabricMBean facade = getFabricMBean();
    String json = facade.requirements();
    try {
        FabricRequirementsDTO dto = Helpers.getObjectMapper().readValue(json, FabricRequirementsDTO.class);
        Assume.assumeNotNull(dto);
        System.out.println(dto);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FabricMBean(io.fabric8.jolokia.facade.mbeans.FabricMBean) Test(org.junit.Test)

Example 8 with FabricMBean

use of io.fabric8.jolokia.facade.mbeans.FabricMBean in project fabric8 by jboss-fuse.

the class FabricMBeanFacadeTest method testGetProfiles.

@Test
public void testGetProfiles() {
    // this can only be run if you have a fabric running...
    Assume.assumeTrue(Boolean.valueOf(System.getProperty("hasFabric")));
    FabricMBean facade = getFabricMBean();
    String json = facade.getProfiles("1.0");
    try {
        Collection<ProfileDTO> profiles = Helpers.getObjectMapper().readValue(json, TypeFactory.defaultInstance().constructParametricType(Collection.class, ProfileDTO.class));
        Assume.assumeNotNull(profiles);
        for (ProfileDTO profile : profiles) {
            System.out.println(profile);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FabricMBean(io.fabric8.jolokia.facade.mbeans.FabricMBean) Collection(java.util.Collection) Test(org.junit.Test)

Example 9 with FabricMBean

use of io.fabric8.jolokia.facade.mbeans.FabricMBean in project fabric8 by jboss-fuse.

the class FabricMBeanFacadeTest method testContainersWithFields.

@Test
public void testContainersWithFields() {
    // this can only be run if you have a fabric running...
    Assume.assumeTrue(Boolean.valueOf(System.getProperty("hasFabric")));
    FabricMBean facade = getFabricMBean();
    String json = facade.containers(Helpers.toList("id"));
    try {
        Collection<ContainerDTO> containers = Helpers.getObjectMapper().readValue(json, TypeFactory.defaultInstance().constructParametricType(Collection.class, ContainerDTO.class));
        Assume.assumeNotNull(containers);
        for (ContainerDTO container : containers) {
            System.out.println(container);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FabricMBean(io.fabric8.jolokia.facade.mbeans.FabricMBean) Collection(java.util.Collection) Test(org.junit.Test)

Example 10 with FabricMBean

use of io.fabric8.jolokia.facade.mbeans.FabricMBean in project fabric8 by jboss-fuse.

the class FabricMBeanFacadeTest method testContainers.

@Test
public void testContainers() {
    // this can only be run if you have a fabric running...
    Assume.assumeTrue(Boolean.valueOf(System.getProperty("hasFabric")));
    FabricMBean facade = getFabricMBean();
    String json = facade.containers();
    try {
        Collection<ContainerDTO> containers = Helpers.getObjectMapper().readValue(json, TypeFactory.defaultInstance().constructParametricType(Collection.class, ContainerDTO.class));
        Assume.assumeNotNull(containers);
        for (ContainerDTO container : containers) {
            System.out.println(container);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FabricMBean(io.fabric8.jolokia.facade.mbeans.FabricMBean) Collection(java.util.Collection) Test(org.junit.Test)

Aggregations

FabricMBean (io.fabric8.jolokia.facade.mbeans.FabricMBean)12 Test (org.junit.Test)10 Collection (java.util.Collection)7 FabricServiceFacade (io.fabric8.jolokia.facade.facades.FabricServiceFacade)1