use of org.apache.karaf.instance.core.internal.InstancesMBeanImpl in project karaf by apache.
the class Activator method doStart.
@Override
protected void doStart() throws Exception {
InstanceService instanceService = new InstanceServiceImpl();
register(InstanceService.class, instanceService);
RegexCommandLoggingFilter filter = new RegexCommandLoggingFilter();
filter.addCommandOption("--password", "connect");
filter.addCommandOption("-p", "connect");
register(CommandLoggingFilter.class, filter);
InstancesMBeanImpl mbean = new InstancesMBeanImpl(instanceService);
registerMBean(mbean, "type=instance");
}
use of org.apache.karaf.instance.core.internal.InstancesMBeanImpl 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);
}
use of org.apache.karaf.instance.core.internal.InstancesMBeanImpl in project karaf by apache.
the class InstanceServiceMBeanImplTest method testCreateInstance.
public void testCreateInstance() throws Exception {
final InstanceSettings instanceSettings = new InstanceSettings(123, 456, 789, "somewhere", "someopts", Collections.emptyList(), Arrays.asList("webconsole", "funfeat"), "localhost");
final Instance inst = EasyMock.createMock(Instance.class);
EasyMock.expect(inst.getPid()).andReturn(42);
EasyMock.replay(inst);
org.apache.karaf.instance.core.InstanceService instanceService = EasyMock.createMock(org.apache.karaf.instance.core.InstanceService.class);
EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(inst);
EasyMock.replay(instanceService);
InstancesMBeanImpl ab = new InstancesMBeanImpl(instanceService);
assertEquals(42, ab.createInstance("t1", 123, 456, 789, "somewhere", "someopts", " webconsole, funfeat", ""));
}
use of org.apache.karaf.instance.core.internal.InstancesMBeanImpl 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);
}
use of org.apache.karaf.instance.core.internal.InstancesMBeanImpl 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);
}
Aggregations