Package java.rmi.activation

Examples of java.rmi.activation.ActivationGroupDesc$CommandEnvironment


import java.util.Properties;
import junit.framework.TestCase;

public class ActivationGroupDescTest extends TestCase {
    public void testActivationGroupDescPropertiesCommandEnvironment() {
        ActivationGroupDesc agd = new ActivationGroupDesc(null, null);
        assertNull(agd.getClassName());
        assertNull(agd.getLocation());
        assertNull(agd.getData());
        assertNull(agd.getPropertyOverrides());
        assertNull(agd.getCommandEnvironment());
        Properties p = new Properties();
        p.setProperty("key", "value");
        CommandEnvironment ce = new ActivationGroupDesc.CommandEnvironment("cmd", new String[] {
                "option1", "option1" });
        agd = new ActivationGroupDesc(p, ce);
        assertNull(agd.getClassName());
        assertNull(agd.getLocation());
        assertNull(agd.getData());
        assertNotSame(p, agd.getPropertyOverrides());
        assertEquals(p, agd.getPropertyOverrides());
        assertEquals(ce, agd.getCommandEnvironment());
    }
View Full Code Here


        assertEquals(p, agd.getPropertyOverrides());
        assertEquals(ce, agd.getCommandEnvironment());
    }

    public void testActivationGroupDescStringStringMarshalledObjectPropertiesCommandEnvironment() {
        ActivationGroupDesc agd = new ActivationGroupDesc(null, null, null, null, null);
        assertNull(agd.getClassName());
        assertNull(agd.getLocation());
        assertNull(agd.getData());
        assertNull(agd.getPropertyOverrides());
        assertNull(agd.getCommandEnvironment());
        Properties p = new Properties();
        p.setProperty("key", "value");
        CommandEnvironment ce = new ActivationGroupDesc.CommandEnvironment("cmd", new String[] {
                "option1", "option1" });
        agd = new ActivationGroupDesc("className", "location", null, p, ce);
        assertEquals("className", agd.getClassName());
        assertEquals("location", agd.getLocation());
        assertNull(agd.getData());
        assertNotSame(p, agd.getPropertyOverrides());
        assertEquals(p, agd.getPropertyOverrides());
        assertEquals(ce, agd.getCommandEnvironment());
    }
View Full Code Here

        assertEquals(p, agd.getPropertyOverrides());
        assertEquals(ce, agd.getCommandEnvironment());
    }

    public void testHashCode() {
        ActivationGroupDesc agd = new ActivationGroupDesc(null, null, null, null, null);
        assertEquals(agd.hashCode(), new ActivationGroupDesc(null, null, null, null, null)
                .hashCode());
        agd = new ActivationGroupDesc("className", "codebase", null, null, null);
        assertEquals(agd.hashCode(), new ActivationGroupDesc("className", "codebase", null,
                null, null).hashCode());
    }
View Full Code Here

        assertEquals(agd.hashCode(), new ActivationGroupDesc("className", "codebase", null,
                null, null).hashCode());
    }

    public void testEqualsObject() {
        ActivationGroupDesc agd = new ActivationGroupDesc(null, null, null, null, null);
        assertEquals(agd, new ActivationGroupDesc(null, null, null, null, null));
        Properties p = new Properties();
        p.setProperty("key", "value");
        CommandEnvironment ce = new ActivationGroupDesc.CommandEnvironment("cmd", new String[] {
                "option1", "option1" });
        agd = new ActivationGroupDesc("className", "location", null, p, ce);
        assertEquals(agd, new ActivationGroupDesc("className", "location", null, p, ce));
    }
View Full Code Here

    }

    public void testSimpleInstall() throws Exception {
        try {
            Properties props = new Properties();
            ActivationGroupDesc groupDesc = new ActivationGroupDesc(props, null);

            System.out.println("groupDesc = " + groupDesc);

            System.out.flush();
            ActivationSystem as = ActivationGroup.getSystem();
View Full Code Here

      Properties props = new Properties();
      props.put("java.security.policy",
          TestParams.testSrc + File.separator +
          "group.security.policy");
      ActivationGroupDesc gdesc = new ActivationGroupDesc(props, null);
      ActivationGroupID gid =
    ActivationGroup.getSystem().registerGroup(gdesc);
     
      testActivate(gid, null);
      testActivate(gid, new CountedSocketFactory());
View Full Code Here

            if (!gid.equals(recovered)) {
          throw new TestException(
                    "Failed -- Group ID improperly stored.");
            }

            ActivationGroupDesc adesc =  null;
      try {
                adesc =
        ActivationGroup.getSystem().getActivationGroupDesc(gid);
    ActivationGroupDesc.CommandEnvironment ce =
        adesc.getCommandEnvironment();
    String[] opts = ce.getCommandOptions();
    List lopts = Arrays.asList(opts);
          System.out.println("Options: " + lopts);
    if (!lopts.contains("-cp") ||
        !lopts.contains(sharedGroupDesc.getClasspath())) {
              throw new TestException(
                        "Failed -- bad opts.");
    }
    String[] userOpts = sharedGroupDesc.getServerOptions();
    for (int i=0; i < userOpts.length; i++) {
        if (!lopts.contains(userOpts[i])) {
                  throw new TestException(
                            "Failed -- bad  user opts.");
        }
    }
    Properties props = adesc.getPropertyOverrides();
          System.out.println("Properties: " + props);
    String pol = props.getProperty("java.security.policy");
    if (pol == null || !pol.equals(sharedGroupDesc.getPolicy())) {
              throw new TestException(
                        "Failed -- bad props.");
    }
    Properties userProps = sharedGroupDesc.getServerProperties();
          System.out.println("User Properties: " + userProps);
    if (userProps != null) {
        Enumeration e = userProps.keys();
        Object key = null;
        Object val = null;
        while (e.hasMoreElements()) {
      key = e.nextElement();
      val = userProps.get(key);
      if (!props.containsKey(key) ||
          !props.contains(val)) {
                      throw new TestException(
                                "Failed -- bad user props.");
      }
        }
    }

    String path = ce.getCommandPath();
          System.out.println("getCommandPath: " + path);
    if (path != null &&
        !path.equals(sharedGroupDesc.getServerCommand())) {
              throw new TestException(
                        "Failed -- bad path.");
    }
    String cp = adesc.getLocation();
          System.out.println("getLocation: " + cp);
    if (cp != null) {
              throw new TestException(
                        "Failed -- bad location.");
    }
View Full Code Here

        } catch (ActivationException t) {
            logger.log(Level.FINEST,
                    "ActivationException in case if group is not active");
        }
        Properties props = new Properties();
        ActivationGroupDesc gd = new ActivationGroupDesc(
            "com.sun.jini.test.spec.activation.util.FakeActivationGroup",
            null,
            null,
            props,
            null);
View Full Code Here

        ActivationGroupID agid = new FakeActivationGroupID(logger, system);
        String program = "java";
        String[] options = {""};
        Properties props = new Properties();
        CommandEnvironment cmd = new CommandEnvironment(program, options);
        ActivationGroupDesc gd = new ActivationGroupDesc(props, cmd);
        try {
            java.rmi.activation.ActivationGroup ag =
                    ActivationGroup.createGroup(agid, gd, 0);
        } catch (ActivationException ae) {
        }
View Full Code Here

    public void run() throws Exception {
        FakeActivationGroup.setLogger(logger);
        ActivationSystem system = new FakeActivationSystem(logger);
        ActivationGroupID agid = new FakeActivationGroupID(logger, system);
        Properties props = new Properties();
        ActivationGroupDesc gd = new ActivationGroupDesc(
            "com.sun.jini.test.spec.activation.util.FakeActivationGroup",
            null,
            null,
            props,
            null);
View Full Code Here

TOP

Related Classes of java.rmi.activation.ActivationGroupDesc$CommandEnvironment

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.