Search in sources :

Example 1 with InstancesMBean

use of org.apache.karaf.instance.core.InstancesMBean in project karaf by apache.

the class InstanceServiceMBeanImplTest method testSshChangePort.

public void testSshChangePort() throws Exception {
    Instance inst = EasyMock.createMock(Instance.class);
    inst.changeSshPort(7788);
    EasyMock.expectLastCall();
    EasyMock.replay(inst);
    InstanceService instanceService = EasyMock.createMock(InstanceService.class);
    EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
    EasyMock.replay(instanceService);
    InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
    instanceServiceMBean.changeSshPort("test instance", 7788);
    EasyMock.verify(instanceService);
    EasyMock.verify(inst);
}
Also used : Instance(org.apache.karaf.instance.core.Instance) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) InstancesMBean(org.apache.karaf.instance.core.InstancesMBean) InstanceService(org.apache.karaf.instance.core.InstanceService)

Example 2 with InstancesMBean

use of org.apache.karaf.instance.core.InstancesMBean in project karaf by apache.

the class InstanceServiceMBeanImplTest method testRmiServerChangePort.

public void testRmiServerChangePort() throws Exception {
    Instance inst = EasyMock.createMock(Instance.class);
    inst.changeRmiServerPort(44444);
    EasyMock.expectLastCall();
    EasyMock.replay(inst);
    InstanceService instanceService = EasyMock.createMock(InstanceService.class);
    EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
    EasyMock.replay(instanceService);
    InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
    instanceServiceMBean.changeRmiServerPort("test instance", 44444);
    EasyMock.verify(instanceService);
    EasyMock.verify(inst);
}
Also used : Instance(org.apache.karaf.instance.core.Instance) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) InstancesMBean(org.apache.karaf.instance.core.InstancesMBean) InstanceService(org.apache.karaf.instance.core.InstanceService)

Example 3 with InstancesMBean

use of org.apache.karaf.instance.core.InstancesMBean in project karaf by apache.

the class InstanceServiceMBeanImplTest method testStopInstance.

public void testStopInstance() throws Exception {
    Instance inst = EasyMock.createMock(Instance.class);
    inst.stop();
    EasyMock.expectLastCall();
    EasyMock.replay(inst);
    InstanceService instanceService = EasyMock.createMock(InstanceService.class);
    EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
    EasyMock.replay(instanceService);
    InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
    instanceServiceMBean.stopInstance("test instance");
    EasyMock.verify(instanceService);
    EasyMock.verify(inst);
}
Also used : Instance(org.apache.karaf.instance.core.Instance) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) InstancesMBean(org.apache.karaf.instance.core.InstancesMBean) InstanceService(org.apache.karaf.instance.core.InstanceService)

Example 4 with InstancesMBean

use of org.apache.karaf.instance.core.InstancesMBean in project karaf by apache.

the class InstanceServiceMBeanImplTest method testStartInstanceWithJavaOpts.

public void testStartInstanceWithJavaOpts() throws Exception {
    Instance inst = EasyMock.createMock(Instance.class);
    inst.start("-x -y -z");
    EasyMock.expectLastCall();
    EasyMock.replay(inst);
    InstanceService instanceService = EasyMock.createMock(InstanceService.class);
    EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
    EasyMock.replay(instanceService);
    InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
    instanceServiceMBean.startInstance("test instance", "-x -y -z");
    EasyMock.verify(instanceService);
    EasyMock.verify(inst);
}
Also used : Instance(org.apache.karaf.instance.core.Instance) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) InstancesMBean(org.apache.karaf.instance.core.InstancesMBean) InstanceService(org.apache.karaf.instance.core.InstanceService)

Example 5 with InstancesMBean

use of org.apache.karaf.instance.core.InstancesMBean in project karaf by apache.

the class InstanceServiceMBeanImplTest method testCreateInstance2.

public void testCreateInstance2() throws Exception {
    final InstanceSettings instanceSettings = new InstanceSettings(0, 0, 0, null, null, Collections.emptyList(), Collections.emptyList(), "localhost");
    InstanceService instanceService = EasyMock.createMock(InstanceService.class);
    EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(null);
    EasyMock.replay(instanceService);
    InstancesMBean ab = new InstancesMBeanImpl(instanceService);
    assertEquals(-1, ab.createInstance("t1", 0, 0, 0, "", "", "", ""));
}
Also used : InstanceSettings(org.apache.karaf.instance.core.InstanceSettings) InstancesMBeanImpl(org.apache.karaf.instance.core.internal.InstancesMBeanImpl) InstancesMBean(org.apache.karaf.instance.core.InstancesMBean) InstanceService(org.apache.karaf.instance.core.InstanceService)

Aggregations

InstanceService (org.apache.karaf.instance.core.InstanceService)9 InstancesMBean (org.apache.karaf.instance.core.InstancesMBean)9 InstancesMBeanImpl (org.apache.karaf.instance.core.internal.InstancesMBeanImpl)9 Instance (org.apache.karaf.instance.core.Instance)8 InstanceSettings (org.apache.karaf.instance.core.InstanceSettings)1