Package org.apache.karaf.admin

Examples of org.apache.karaf.admin.InstanceSettings


    @Argument(index = 0, name = "name", description="The name of the new container instance", required = true, multiValued = false)
    String instance = null;

    protected Object doExecute() throws Exception {
        InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features);
        getAdminService().createInstance(instance, settings);
        return null;
    }
View Full Code Here


import org.easymock.EasyMock;
import org.junit.Assert;

public class AdminServiceMBeanImplTest extends TestCase {
    public void testCreateInstance() throws Exception {
        final InstanceSettings is = new InstanceSettings(123, "somewhere",
                Collections.<String>emptyList(), Arrays.asList("webconsole", "funfeat"));
       
        final Instance inst = EasyMock.createMock(Instance.class);
        EasyMock.expect(inst.getPid()).andReturn(42);
        EasyMock.replay(inst);
View Full Code Here

       
        assertEquals(42, ab.createInstance("t1", 123, "somewhere", " webconsole,  funfeat", ""));
    }
   
    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);
View Full Code Here

import org.apache.karaf.admin.InstanceSettings;
import org.junit.Assert;

public class InstanceSettingsTest extends TestCase {
    public void testInstanceSettings() {
        InstanceSettings is =
            new InstanceSettings(1, null, Collections.<String>emptyList(), Arrays.asList("hi"));
        assertEquals(1, is.getPort());
        Assert.assertNull(is.getLocation());
        assertEquals(Arrays.asList("hi"), is.getFeatures());
        assertEquals(0, is.getFeatureURLs().size());
    }
View Full Code Here

        testEqualsHashCode(1, "top", Collections.<String>emptyList(), Arrays.asList("hi"));
        testEqualsHashCode(0, null, null, null);
    }

    private void testEqualsHashCode(int port, String location, List<String> featureURLs, List<String> features) {
        InstanceSettings is = new InstanceSettings(port, location, featureURLs, features);
        InstanceSettings is2 = new InstanceSettings(port, location, featureURLs, features);
        assertEquals(is, is2);
        assertEquals(is.hashCode(), is2.hashCode());
    }
View Full Code Here

        assertEquals(is, is2);
        assertEquals(is.hashCode(), is2.hashCode());
    }
   
    public void testEqualsHashCode2() {
        InstanceSettings is = new InstanceSettings(1, "top", Collections.<String>emptyList(), Arrays.asList("hi"));
        Assert.assertFalse(is.equals(null));
        Assert.assertFalse(is.equals(new Object()));
        assertEquals(is, is);
    }
View Full Code Here

        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

                p.store(os, "Test comment");
            } finally {
                os.close();
            }
           
            InstanceSettings s = new InstanceSettings(8122, null, null, Arrays.asList("test"));
            as.handleFeatures(f, s);
           
            Properties p2 = new Properties();
            InputStream is = new FileInputStream(f);
            try {
View Full Code Here

     */
    public void testConfigurationFiles() throws Exception {
        AdminServiceImpl service = new AdminServiceImpl();
        service.setStorageLocation(new File("target/instances/" + System.currentTimeMillis()));

        InstanceSettings settings = new InstanceSettings(8122, getName(), null, null);
        Instance instance = service.createInstance(getName(), settings);

        assertFileExists(instance.getLocation(), "etc/config.properties");
        assertFileExists(instance.getLocation(), "etc/users.properties");
        assertFileExists(instance.getLocation(), "etc/startup.properties");
View Full Code Here

        m.setAccessible(true);
        return (List<String>) m.invoke(ap, s);
    }
   
    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);
       
View Full Code Here

TOP

Related Classes of org.apache.karaf.admin.InstanceSettings

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.