Package io.fabric8.api.mxbean

Examples of io.fabric8.api.mxbean.ProfileState


  /* (non-Javadoc)
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  @Override
  public int compareTo(Version o) {
    return new VersionSequence(getId()).compareTo(new VersionSequence(o.getId()));
  }
View Full Code Here


            Fabric8JMXPlugin.getLogger().warning(ex);
          return null;
        }
        final Set<ObjectName> queryNames = connection.queryNames(fabricObjectName, null);
        for (ObjectName fabric8ObjectName : queryNames) {
          FabricManagerMBean fabricMBean = MBeanServerInvocationHandler.newProxyInstance(connection, fabric8ObjectName, FabricManagerMBean.class, true);
          return callback.doWithFabricManagerMBean(fabricMBean);
        }
        return null;
      }
    });
View Full Code Here

        version10 = VersionBuilder.Factory.create("1.0").addProfiles(Arrays.asList(prfA, prfB)).getVersion();

        ProfileManagement impl = Mockito.mock(ProfileManagement.class);
        Mockito.when(impl.getVersions()).thenReturn(Arrays.asList("1.0"));
        Mockito.when(impl.getVersion("1.0")).thenReturn(new VersionState(version10));
        Mockito.when(impl.getProfile("1.0", "prfA")).thenReturn(new ProfileState(prfA));
        Mockito.when(impl.getProfile("1.0", "prfB")).thenReturn(new ProfileState(prfB));
       
        server = ManagementFactory.getPlatformMBeanServer();
        StandardMBean mxbean = new StandardMBean(impl, ProfileManagement.class, true);
        server.registerMBean(mxbean, ProfileManagement.OBJECT_NAME);
        proxy = JMX.newMXBeanProxy(server, ProfileManagement.OBJECT_NAME, ProfileManagement.class);
View Full Code Here

    @Test
    public void testPlainGetProfile() throws Exception {
        Object[] params = new Object[] {"1.0", "prfB"};
        String[] signature = new String[]{ String.class.getName(), String.class.getName()};
        CompositeData cdata = (CompositeData) server.invoke(ProfileManagement.OBJECT_NAME, "getProfile", params, signature);
        ProfileState prfB = (ProfileState) OpenTypeGenerator.fromOpenData(cdata.getCompositeType(), ProfileState.class.getClassLoader(), cdata);
        Assert.assertEquals(version10.getProfile("prfB"), prfB.toProfile());
    }
View Full Code Here

    }

    @Test
    public void testProfileStateRoundTrip() throws Exception {
        CompositeType ctype = getProfileStateType();
        ProfileState prfB = new ProfileState(version10.getProfile("prfB"));
        ClassLoader classLoader = prfB.getClass().getClassLoader();
        CompositeData cdata = (CompositeData) OpenTypeGenerator.toOpenData(ctype, prfB);
        ProfileState result = (ProfileState) OpenTypeGenerator.fromOpenData(ctype, classLoader, cdata);
        Assert.assertEquals(prfB, result);
       
        Object json = JSONTypeGenerator.toJSON(cdata);
        cdata = (CompositeData) JSONTypeGenerator.toOpenData(ctype, classLoader, json);
        result = (ProfileState) OpenTypeGenerator.fromOpenData(ctype, classLoader, cdata);
View Full Code Here

        // [FABRIC-1172] Jolokia exec operations fail on WildFly
        Assume.assumeFalse(getRuntimeType() == RuntimeType.WILDFLY);
       
        ProfileBuilder pbA10 = ProfileBuilder.Factory.create("1.0", "prfA");
        pbA10.addConfiguration("pidA", Collections.singletonMap("keyA", "valA"));
        ProfileState prfA = getProxy().createProfile(new ProfileState(pbA10.getProfile()));
        try {
            Assert.assertEquals("prfA", prfA.getId());
            Assert.assertEquals("1.0", prfA.getVersion());
            Assert.assertTrue(prfA.getAttributes().isEmpty());
            Assert.assertEquals("valA", prfA.getConfiguration("pidA").get("keyA"));
           
            // getProfile
            Assert.assertEquals(prfA, getProxy().getProfile("1.0", "prfA"));

            // updateProfile
            prfA = getProxy().getProfile("1.0", "prfA");
            pbA10 = ProfileBuilder.Factory.createFrom(prfA.toProfile());
            pbA10.addConfiguration("pidB", "keyB", "valB");
            prfA = getProxy().updateProfile(new ProfileState(pbA10.getProfile()));
            Assert.assertEquals("prfA", prfA.getId());
            Assert.assertEquals("1.0", prfA.getVersion());
            Assert.assertTrue(prfA.getAttributes().isEmpty());
            Assert.assertEquals("valA", prfA.getConfiguration("pidA").get("keyA"));
            Assert.assertEquals("valB", prfA.getConfiguration("pidB").get("keyB"));
        } finally {
            getProxy().deleteProfile("1.0", "prfA", false);
        }
    }
View Full Code Here

    }

    @Override
    public ProfileState createProfile(ProfileState profileState) {
        Profile profile = getProfileManager().createProfile(profileState.toProfile());
        return new ProfileState(profile);
    }
View Full Code Here

    }

    @Override
    public ProfileState getProfile(String versionId, String profileId) {
        Profile profile = getProfileManager().getProfile(versionId, profileId);
        return profile != null ? new ProfileState(profile) : null;
    }
View Full Code Here

    }

    @Override
    public ProfileState updateProfile(ProfileState profileState) {
        Profile profile = getProfileManager().updateProfile(profileState.toProfile());
        return new ProfileState(profile);
    }
View Full Code Here

public class CamelNodeProvider implements NodeProvider {

  @Override
  public void provide(final Root root) {
    if (root.containsDomain("org.apache.camel")) {
      CamelFacade facade = new JmxTemplateCamelFacade(new JmxPluginJmxTemplate(root.getConnection()));
      CamelContextsNode camel = new CamelContextsNode(root, facade);
      root.addChild(camel);
    }
  }
View Full Code Here

TOP

Related Classes of io.fabric8.api.mxbean.ProfileState

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.