Search in sources :

Example 1 with BundleInformation

use of org.motechproject.admin.bundles.BundleInformation in project motech by motech.

the class ModuleAdminServiceImpl method restartBundle.

@Override
public BundleInformation restartBundle(long bundleId) throws BundleException {
    Bundle bundle = getBundle(bundleId);
    bundle.stop();
    bundle.start();
    return new BundleInformation(bundle);
}
Also used : Bundle(org.osgi.framework.Bundle) BundleInformation(org.motechproject.admin.bundles.BundleInformation) ExtendedBundleInformation(org.motechproject.admin.bundles.ExtendedBundleInformation)

Example 2 with BundleInformation

use of org.motechproject.admin.bundles.BundleInformation in project motech by motech.

the class ModuleAdminServiceImpl method startBundle.

@Override
public BundleInformation startBundle(long bundleId) throws BundleException {
    Bundle bundle = getBundle(bundleId);
    bundle.start();
    return new BundleInformation(bundle);
}
Also used : Bundle(org.osgi.framework.Bundle) BundleInformation(org.motechproject.admin.bundles.BundleInformation) ExtendedBundleInformation(org.motechproject.admin.bundles.ExtendedBundleInformation)

Example 3 with BundleInformation

use of org.motechproject.admin.bundles.BundleInformation in project motech by motech.

the class BundleAdminControllerTest method testRestartBundle.

@Test
public void testRestartBundle() throws BundleException {
    when(moduleAdminService.restartBundle(BUNDLE_ID)).thenReturn(bundleInformation);
    BundleInformation result = controller.restartBundle(BUNDLE_ID);
    assertEquals(bundleInformation, result);
    verify(moduleAdminService).restartBundle(BUNDLE_ID);
}
Also used : BundleInformation(org.motechproject.admin.bundles.BundleInformation) Test(org.junit.Test)

Example 4 with BundleInformation

use of org.motechproject.admin.bundles.BundleInformation in project motech by motech.

the class BundleAdminControllerTest method testGetBundleInfo.

@Test
public void testGetBundleInfo() {
    when(moduleAdminService.getBundleInfo(BUNDLE_ID)).thenReturn(bundleInformation);
    BundleInformation result = controller.getBundle(BUNDLE_ID);
    assertEquals(bundleInformation, result);
    verify(moduleAdminService).getBundleInfo(BUNDLE_ID);
}
Also used : BundleInformation(org.motechproject.admin.bundles.BundleInformation) Test(org.junit.Test)

Example 5 with BundleInformation

use of org.motechproject.admin.bundles.BundleInformation in project motech by motech.

the class BundleAdminServiceTest method testStartBundle.

@Test
public void testStartBundle() throws BundleException {
    setupBundleRetrieval();
    BundleInformation bundleInfo = moduleAdminService.startBundle(BUNDLE_ID);
    assertEquals(new BundleInformation(bundle), bundleInfo);
    verify(bundleContext).getBundle(BUNDLE_ID);
    verify(bundle).start();
}
Also used : BundleInformation(org.motechproject.admin.bundles.BundleInformation) ExtendedBundleInformation(org.motechproject.admin.bundles.ExtendedBundleInformation) Test(org.junit.Test)

Aggregations

BundleInformation (org.motechproject.admin.bundles.BundleInformation)15 ExtendedBundleInformation (org.motechproject.admin.bundles.ExtendedBundleInformation)10 Test (org.junit.Test)9 Bundle (org.osgi.framework.Bundle)6 ArrayList (java.util.ArrayList)3 ArtifactResult (org.sonatype.aether.resolution.ArtifactResult)2 File (java.io.File)1 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 JarInformation (org.motechproject.admin.bundles.JarInformation)1 MotechException (org.motechproject.commons.api.MotechException)1 ModuleRegistrationData (org.motechproject.osgi.web.ModuleRegistrationData)1 BundleException (org.osgi.framework.BundleException)1 RepositoryException (org.sonatype.aether.RepositoryException)1 Dependency (org.sonatype.aether.graph.Dependency)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1