Package org.apache.karaf.admin

Examples of org.apache.karaf.admin.InstanceSettings


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

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


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

    private void testEqualsHashCode(int sshPort, int rmiRegistryPort, int rmiServerPort, String location, String javaOpts, List<String> featureURLs, List<String> features) {
        InstanceSettings is = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features);
        InstanceSettings is2 = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, 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, 1, 1,"top", "foo", Collections.<String>emptyList(), Arrays.asList("hi"));
        Assert.assertFalse(is.equals(null));
        Assert.assertFalse(is.equals(new Object()));
        assertEquals(is, is);
    }
View Full Code Here

                p.store(os, "Test comment");
            } finally {
                os.close();
            }
           
            InstanceSettings s = new InstanceSettings(8122, 1122, 44444, null, 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, 1122, 44444, getName(), null, 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

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

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

        service.renameInstance(getName(), getName() + "b");
        assertNotNull(service.getInstance(getName() + "b"));
    }
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, 1122, 44444, "top", "foo", 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

        }
        if ("".equals(javaOpts)) {
            javaOpts = null;
        }

        InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts,
                parseStringList(featureURLs), parseStringList(features));

        Instance inst = adminService.createInstance(name, settings);
        if (inst != null) {
            return inst.getPid();
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, 456, 789, "somewhere", "someopts",
                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, 456, 789, "somewhere", "someopts", " webconsole,  funfeat", ""));
    }
   
    public void testCreateInstance2() throws Exception {
        final InstanceSettings is = new InstanceSettings(0, 0, 0, null, 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

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.