Package org.apache.felix.karaf.admin

Examples of org.apache.felix.karaf.admin.AdminService


import org.apache.felix.karaf.admin.InstanceSettings;
import org.easymock.EasyMock;

public class CreateCommandTest extends TestCase {
    public void testCreateCommandExecute() throws Exception {
        AdminService adminService = EasyMock.createMock(AdminService.class);
        EasyMock.replay(adminService);
       
        CreateCommand cc = new CreateCommand();
        cc.setAdminService(adminService);
        cc.port = 9941;
        cc.location = "top";
        cc.features = Arrays.asList("abc", "def");
        cc.featureURLs = Collections.singletonList("http://something");
        cc.instance = "myInstance";
       
        EasyMock.verify(adminService); // check precondition
        EasyMock.reset(adminService);
        InstanceSettings expectedIS =
            new InstanceSettings(9941, "top", Collections.singletonList("http://something"), Arrays.asList("abc", "def"));
        EasyMock.expect(adminService.createInstance("myInstance", expectedIS)).andReturn(null);
        EasyMock.replay(adminService);
       
        cc.doExecute();
        EasyMock.verify(adminService);
    }
View Full Code Here


    }
   
    public void testDoPostCreate() throws Exception {
        InstanceSettings is =
            new InstanceSettings(1234, null, Collections.singletonList("http://someURL"), Arrays.asList("abc", "def"));
        AdminService adminService = EasyMock.createMock(AdminService.class);
        EasyMock.expect(adminService.createInstance("instance1", is)).andReturn(null);
        EasyMock.expect(adminService.getInstances()).andReturn(new Instance[] {}).anyTimes();
        EasyMock.replay(adminService);
       
        AdminPlugin ap = new AdminPlugin();
        ap.setAdminService(adminService);
View Full Code Here

       
        final Instance inst = EasyMock.createMock(Instance.class);
        EasyMock.expect(inst.getPid()).andReturn(42);
        EasyMock.replay(inst);

        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.createInstance("t1", is)).andReturn(inst);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

   
    public void testCreateInstance2() throws Exception {
        final InstanceSettings is = new InstanceSettings(0, null,
                Collections.<String>emptyList(), Collections.<String>emptyList());
       
        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.createInstance("t1", is)).andReturn(null);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

        EasyMock.replay(i1);
        Instance i2 = EasyMock.createNiceMock(Instance.class);
        EasyMock.expect(i2.getName()).andReturn("i2");
        EasyMock.replay(i2);
       
        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.getInstances()).andReturn(new Instance [] {i1, i2});
        EasyMock.replay(as);

        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
       
View Full Code Here

        Instance inst = EasyMock.createMock(Instance.class);
        inst.start("-x -y -z");
        EasyMock.expectLastCall();
        EasyMock.replay(inst);

        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.getInstance("test instance")).andReturn(inst);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

        Instance inst = EasyMock.createMock(Instance.class);
        inst.stop();
        EasyMock.expectLastCall();
        EasyMock.replay(inst);

        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.getInstance("test instance")).andReturn(inst);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

        Instance inst = EasyMock.createMock(Instance.class);
        inst.destroy();
        EasyMock.expectLastCall();
        EasyMock.replay(inst);

        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.getInstance("test instance")).andReturn(inst);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

        Instance inst = EasyMock.createMock(Instance.class);
        inst.changePort(7788);
        EasyMock.expectLastCall();
        EasyMock.replay(inst);

        AdminService as = EasyMock.createMock(AdminService.class);
        EasyMock.expect(as.getInstance("test instance")).andReturn(inst);
        EasyMock.replay(as);
       
        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
        Assert.assertSame(as, ab.getAdminService());
View Full Code Here

TOP

Related Classes of org.apache.felix.karaf.admin.AdminService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.