Search in sources :

Example 11 with BundleInformation

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

the class BundleAdminServiceTest method testStopBundle.

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

Example 12 with BundleInformation

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

the class BundleAdminServiceTest method testRestartBundle.

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

Example 13 with BundleInformation

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

the class BundleAdminControllerTest method testStartBundle.

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

Example 14 with BundleInformation

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

the class BundleAdminControllerTest method testStopBundle.

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

Example 15 with BundleInformation

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

the class BundleAdminControllerTest method testUploadBundle.

@Test
public void testUploadBundle() throws BundleException {
    when(moduleAdminService.installBundle(bundleFile, true)).thenReturn(bundleInformation);
    when(moduleAdminService.installBundle(bundleFile, false)).thenReturn(bundleInformation);
    BundleInformation result = controller.uploadBundle("File", null, bundleFile, "on");
    assertEquals(bundleInformation, result);
    verify(moduleAdminService).installBundle(bundleFile, true);
    result = controller.uploadBundle("File", null, bundleFile, null);
    assertEquals(bundleInformation, result);
    verify(moduleAdminService).installBundle(bundleFile, false);
}
Also used : BundleInformation(org.motechproject.admin.bundles.BundleInformation) 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