当前位置: 首页>>代码示例>>Java>>正文


Java Runtime.getProperty方法代码示例

本文整理汇总了Java中org.jboss.gravia.runtime.Runtime.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Runtime.getProperty方法的具体用法?Java Runtime.getProperty怎么用?Java Runtime.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.gravia.runtime.Runtime的用法示例。


在下文中一共展示了Runtime.getProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testManagedKaraf

import org.jboss.gravia.runtime.Runtime; //导入方法依赖的package包/类
@Test
@Ignore
public void testManagedKaraf() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    CreateOptions options = KarafContainerBuilder.create()
            .identity("ManagedKaraf")
            .outputToConsole(true)
            .targetPath(dataDir.toPath())
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:27,代码来源:ManagedContainerTestBase.java

示例2: getIdentity

import org.jboss.gravia.runtime.Runtime; //导入方法依赖的package包/类
/**
 * Get the current runtime identity
 */
public static String getIdentity() {
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    String runtimeId = (String) runtime.getProperty(RuntimeService.RUNTIME_IDENTITY);
    IllegalStateAssertion.assertNotNull(runtimeId, "Cannot obtain: " + RuntimeService.RUNTIME_IDENTITY);
    return runtimeId;
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:10,代码来源:RuntimeIdentity.java

示例3: testManagedTomcat

import org.jboss.gravia.runtime.Runtime; //导入方法依赖的package包/类
@Test
@Ignore
public void testManagedTomcat() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    CreateOptions options = TomcatContainerBuilder.create()
            .identity("ManagedTomcat")
            .outputToConsole(true)
            //.jvmArguments("-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n")
            .targetPath(dataDir.toPath())
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:28,代码来源:ManagedContainerTestBase.java

示例4: testManagedWildFly

import org.jboss.gravia.runtime.Runtime; //导入方法依赖的package包/类
@Test
@Ignore
public void testManagedWildFly() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    // [TODO] #49 Default port of the running WildFly server is available, why?
    CreateOptions options = WildFlyContainerBuilder.create()
            .identity("ManagedWildFly")
            .outputToConsole(true)
            .targetPath(dataDir.toPath())
            .managementNativePort(WildFlyCreateOptions.DEFAULT_MANAGEMENT_NATIVE_PORT + 1)
            .managementHttpPort(WildFlyCreateOptions.DEFAULT_MANAGEMENT_HTTP_PORT + 1)
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:30,代码来源:ManagedContainerTestBase.java

示例5: testCurrentContainer

import org.jboss.gravia.runtime.Runtime; //导入方法依赖的package包/类
@Test
public void testCurrentContainer() throws Exception {

    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    String runtimeId = (String) runtime.getProperty(RuntimeService.RUNTIME_IDENTITY);
    ContainerIdentity currentId = ContainerIdentity.create(runtimeId);

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.getCurrentContainer();
    Assert.assertEquals(currentId, cnt.getIdentity());

    Set<ServiceEndpoint> endpoints = cnt.getServiceEndpoints();
    Assert.assertEquals(3, endpoints.size());

    // Verify JMX ServiceEndpoint
    ServiceEndpoint sep = cnt.getServiceEndpoint(URLServiceEndpoint.JMX_SERVICE_ENDPOINT_IDENTITY);
    JMXServiceEndpoint jmxEndpoint = sep.adapt(JMXServiceEndpoint.class);
    Assert.assertNotNull("JMX service endpoint not null", jmxEndpoint);
    Assert.assertEquals(jmxEndpoint.getServiceURL(), cnt.getAttribute(ContainerAttributes.ATTRIBUTE_KEY_JMX_SERVER_URL));

    // Verify Http ServiceEndpoint
    sep = cnt.getServiceEndpoint(URLServiceEndpoint.HTTP_SERVICE_ENDPOINT_IDENTITY);
    URLServiceEndpoint httpEndpoint = sep.adapt(URLServiceEndpoint.class);
    Assert.assertNotNull("Http service endpoint not null", httpEndpoint);
    Assert.assertEquals(httpEndpoint.getServiceURL(), cnt.getAttribute(ContainerAttributes.ATTRIBUTE_KEY_HTTP_URL));

    // Verify Jolokia ServiceEndpoint
    sep = cnt.getServiceEndpoint(URLServiceEndpoint.JOLOKIA_SERVICE_ENDPOINT_IDENTITY);
    URLServiceEndpoint jolokiaEndpoint = sep.adapt(URLServiceEndpoint.class);
    Assert.assertNotNull("Jolokia service endpoint not null", jolokiaEndpoint);
    Assert.assertEquals(jolokiaEndpoint.getServiceURL(), cnt.getAttribute(ContainerAttributes.ATTRIBUTE_KEY_REMOTE_AGENT_URL));

    String[] userpass = RuntimeType.KARAF == RuntimeType.getRuntimeType() ? karafJmx : otherJmx;
    JMXConnector jmxConnector = jmxEndpoint.getJMXConnector(userpass[0], userpass[1], 200, TimeUnit.MILLISECONDS);
    try {
        // Access containers through JMX
        MBeanServerConnection server = jmxConnector.getMBeanServerConnection();
        ContainerManagement cntManagement = jmxEndpoint.getMBeanProxy(server, ContainerManagement.OBJECT_NAME, ContainerManagement.class);
        Assert.assertNotNull("ContainerManagement not null", cntManagement);
        Set<String> containerIds = cntManagement.getContainerIds();
        Assert.assertEquals("One container", 1, containerIds.size());
        ContainerIdentity cntId = ContainerIdentity.create(containerIds.iterator().next());
        Assert.assertEquals(cnt.getIdentity(), cntId);
    } finally {
        jmxConnector.close();
    }
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:48,代码来源:CurrentContainerTestBase.java


注:本文中的org.jboss.gravia.runtime.Runtime.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。