Search in sources :

Example 1 with JMXBundleDeployer

use of aQute.remote.util.JMXBundleDeployer in project bnd by bndtools.

the class RemoteProjectLauncherPlugin method tryJMXDeploy.

@SuppressWarnings("deprecation")
private void tryJMXDeploy(String jmx, String bsn) {
    JMXBundleDeployer jmxBundleDeployer = null;
    int port = -1;
    try {
        port = Integer.parseInt(jmx);
    } catch (Exception e) {
    // not an integer
    }
    try {
        if (port > -1) {
            jmxBundleDeployer = new JMXBundleDeployer(port);
        } else {
            jmxBundleDeployer = new JMXBundleDeployer();
        }
    } catch (Exception e) {
    // ignore if we can't create bundle deployer (no remote osgi.core
    // jmx avail)
    }
    if (jmxBundleDeployer != null) {
        for (String path : this.getRunpath()) {
            File file = new File(path);
            try (Jar jar = new Jar(file)) {
                if (bsn.equals(jar.getBsn())) {
                    long bundleId = jmxBundleDeployer.deploy(bsn, file);
                    trace("agent installed with bundleId=%s", bundleId);
                    break;
                }
            } catch (Exception e) {
            //
            }
        }
    }
}
Also used : Jar(aQute.bnd.osgi.Jar) JMXBundleDeployer(aQute.remote.util.JMXBundleDeployer) File(java.io.File)

Example 2 with JMXBundleDeployer

use of aQute.remote.util.JMXBundleDeployer in project bnd by bndtools.

the class RemoteJMXTest method testJMXBundleDeployer.

public void testJMXBundleDeployer() throws Exception {
    JMXBundleDeployer jmxBundleDeployer = new JMXBundleDeployer();
    long bundleId = jmxBundleDeployer.deploy("biz.aQute.remote.agent", IO.getFile("generated/biz.aQute.remote.agent.jar"));
    assertTrue(bundleId > 0);
    BundleDTO agentBundle = null;
    long state = -1;
    for (BundleDTO bundle : jmxBundleDeployer.listBundles()) {
        if (bundle.symbolicName.equals("biz.aQute.remote.agent")) {
            agentBundle = bundle;
            state = bundle.state;
        }
    }
    assertNotNull(agentBundle);
    assertEquals(Bundle.ACTIVE, state);
}
Also used : JMXBundleDeployer(aQute.remote.util.JMXBundleDeployer) BundleDTO(org.osgi.framework.dto.BundleDTO)

Example 3 with JMXBundleDeployer

use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.

the class BladeServiceBuilderIntegrationTest method create.

@Deployment
public static JavaArchive create() throws Exception {
    final File jarFile = new File(System.getProperty("jarFile"));
    final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
    new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
    return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
Also used : JMXBundleDeployer(aQute.remote.util.JMXBundleDeployer) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 4 with JMXBundleDeployer

use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.

the class BladeSpringMVCPortletTest method cleanUp.

@AfterClass
public static void cleanUp() throws Exception {
    new JMXBundleDeployer().uninstall(_fooApiJarBSN);
    new JMXBundleDeployer().uninstall(_fooServiceJarBSN);
    new JMXBundleDeployer().uninstall(_springmvcPortletWarBSN);
}
Also used : JMXBundleDeployer(aQute.remote.util.JMXBundleDeployer) AfterClass(org.junit.AfterClass)

Example 5 with JMXBundleDeployer

use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.

the class BladeSpringMVCPortletTest method create.

@Deployment
public static JavaArchive create() throws Exception {
    final File jarFile = new File(System.getProperty("jarFile"));
    final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
    final File fooServiceJar = new File(System.getProperty("fooServiceJarFile"));
    final File springmvcPortletWar = new File(System.getProperty("springmvcPortletWarFile"));
    new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
    new JMXBundleDeployer().deploy(_fooServiceJarBSN, fooServiceJar);
    String bundleID = BladeCLIUtil.installBundle(springmvcPortletWar);
    BladeCLIUtil.startBundle(bundleID);
    return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
Also used : JMXBundleDeployer(aQute.remote.util.JMXBundleDeployer) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

JMXBundleDeployer (aQute.remote.util.JMXBundleDeployer)17 File (java.io.File)12 Deployment (org.jboss.arquillian.container.test.api.Deployment)8 AfterClass (org.junit.AfterClass)4 Test (org.junit.Test)3 Jar (aQute.bnd.osgi.Jar)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1 BundleDTO (org.osgi.framework.dto.BundleDTO)1