Package com.sun.jini.qa.harness

Examples of com.sun.jini.qa.harness.SharedGroupAdmin


public class ServiceStarterCreateSharedBadActServiceTest extends StarterBase {
    public void run() throws Exception {
        SharedGroup sg = null;
        sg = (SharedGroup)manager.startService("sharedGroup");
  SharedGroupAdmin sga = null;
  sga = (SharedGroupAdmin)manager.getAdmin(sg);

        String codebase = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.codebase", null);
        logger.log(Level.INFO, "codebase = " + codebase);
        String policy = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.policyfile", null);
        logger.log(Level.INFO, "policy = " + policy);
        String impl = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.impl", null);
        logger.log(Level.INFO, "impl = " + impl);
        String classpath = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.classpath", null);
        logger.log(Level.INFO, "classpath = " + classpath);
        if (codebase == null || policy == null ||
            impl == null || classpath == null) {
            throw new TestException(
                "Service codebase, classpath, "
                + "impl, or policy was null");
        }

        String config = null;
  config =
          ServiceStarterCreateBadTransientServiceTest.getServiceConfigFile().toString();
 

  SharedActivatableServiceDescriptor badCodebase =
            new SharedActivatableServiceDescriptor(
    codebase.replaceAll("mercury", "mercury-bogus"),
                policy,
                classpath,
                impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    true);
        try {
            Created created =
                (Created)badCodebase.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a badcodebase descriptor: " + badCodebase);
        } catch (UnmarshalException e) {
      logger.log(Level.INFO, "Expected Failure -- with a badcodebase descriptor: "
          + badCodebase);
            e.printStackTrace();
        }

  SharedActivatableServiceDescriptor badPolicy =
            new SharedActivatableServiceDescriptor(
                codebase,
                policy.replaceAll("policy", "policy_bogus"),
                classpath,
                impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    true);
        try {
            Created created =
                (Created)badPolicy.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad policy descriptor: " + badPolicy);
        } catch (ActivationException e) {
      logger.log(Level.INFO, "Expected Failure with a bad policy descriptor: "
          + badPolicy);
            e.printStackTrace();
        }

  SharedActivatableServiceDescriptor badClasspath =
            new SharedActivatableServiceDescriptor(
                codebase,
                policy,
                classpath.replaceAll("mercury", "mercury_bogus"),
                impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    true);
        try {
            Created created =
                (Created)badClasspath.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad classpath descriptor: " + badClasspath);
        } catch (ActivationException ae) {
      if (ae.getCause() instanceof ClassNotFoundException) {
          logger.log(Level.INFO,
        "Expected Failure with a bad classpath descriptor: "
              + badClasspath, ae);
      } else {
          logger.log(Level.INFO,
        "Unexpected Failure with a bad classpath descriptor: "
              + badClasspath);
          throw new TestException(
              "Unexpected exception"
        + " with a bad classpath descriptor: " + badClasspath, ae);
      }
        }

  SharedActivatableServiceDescriptor badImpl =
            new SharedActivatableServiceDescriptor(
                codebase,
                policy,
                classpath,
                impl.replaceAll("Impl", "Impl_bogus"),
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    true);
        try {
            Created created =
                (Created)badImpl.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad impl descriptor: " + badImpl);
        } catch (ActivationException ae) {
      if (ae.getCause() instanceof ClassNotFoundException) {
          logger.log(Level.INFO,
        "Expected Failure with a bad impl descriptor: "
              + badImpl, ae);

      } else {
          logger.log(Level.INFO,
        "Unexpected Failure with a bad impl descriptor: "
              + badImpl);
          throw new TestException(
              "Unexpected exception"
        + " with a bad impl descriptor: " + badImpl, ae);
      }
        }

  SharedActivatableServiceDescriptor badLog =
            new SharedActivatableServiceDescriptor(
                codebase,
                policy,
                classpath,
                impl,
                sga.getSharedGroupLog().toString() + "bogus",
                new String[] { config },
    true);
        try {
            Created created =
                (Created)badLog.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad log descriptor: " + badLog);
        } catch (IOException e) {
      logger.log(Level.INFO, "Expected Failure with a bad log descriptor: "
          + badLog, e);
        }

  SharedActivatableServiceDescriptor badConfig =
            new SharedActivatableServiceDescriptor(
                codebase,
                policy,
                classpath,
                impl,
                sga.getSharedGroupLog().toString(),
                new String[] { sga.getSharedGroupLog().toString() },
    true);
        try {
            Created created =
                (Created)badConfig.create(EmptyConfiguration.INSTANCE);
      throw new TestException(
View Full Code Here


  new BasicProxyPreparer();

    public void run() throws Exception {
        SharedGroup sg = null;
        sg = (SharedGroup)manager.startService("sharedGroup");
  SharedGroupAdmin sga = null;
  sga = (SharedGroupAdmin)manager.getAdmin(sg);

        String codebase =
            getConfig().genIntegrityCodebase(
                getConfig().getStringConfigVal(
                    "net.jini.event.EventMailbox.codebase", null), null);
        logger.log(Level.INFO, "codebase = " + codebase);
        String policy = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.policyfile", null);
        logger.log(Level.INFO, "policy = " + policy);
        String act_impl = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.activatable.impl", null);
        logger.log(Level.INFO, "activatable impl = " + act_impl);
        String trans_impl = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.transient.impl", null);
        logger.log(Level.INFO, "transient impl = " + trans_impl);
        String classpath = getConfig().getStringConfigVal(
            "net.jini.event.EventMailbox.classpath", null);
        logger.log(Level.INFO, "classpath = " + classpath);
        if (codebase == null || policy == null ||
            act_impl == null || trans_impl == null ||
            classpath == null) {
            throw new TestException(
                "Service codebase, classpath, "
                + "impl, or policy was null");
        }

        String config = null;
  config =
      ServiceStarterCreateBadTransientServiceTest.getServiceConfigFile().toString();
 

  SharedActivatableServiceDescriptor antiMercuryInnerProxy =
            new SharedActivatableServiceDescriptor(
    codebase,
                policy,
                classpath,
                act_impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    antiMercuryProxyPreparer,
    noOpProxyPreparer,
    true);
        try {
            SharedActivatableServiceDescriptor.Created created =
                (SharedActivatableServiceDescriptor.Created)antiMercuryInnerProxy.create(
        EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad inner proxy descriptor: "
    + antiMercuryInnerProxy);
        } catch (Exception e) {
      logger.log(Level.INFO,
    "Caught failure -- with a bad inner proxy descriptor: "
          + e);
            e.printStackTrace();
      if (!antiMercuryException.equals(e)) {
          throw new TestException("Caught unexpected exception");
      } else {
          logger.log(Level.INFO,
        "Expected failure caught.");
      }
        }

  config =
      ServiceStarterCreateBadTransientServiceTest.getServiceConfigFile().toString();
  SharedActivatableServiceDescriptor antiMercuryOuterProxy =
            new SharedActivatableServiceDescriptor(
    codebase,
                policy,
                classpath,
                act_impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    noOpProxyPreparer,
                antiMercuryProxyPreparer,
    true);
        try {
            SharedActivatableServiceDescriptor.Created created =
                (SharedActivatableServiceDescriptor.Created)antiMercuryOuterProxy.create(
        EmptyConfiguration.INSTANCE);
      throw new TestException(
          "Created proxy: " + created.proxy
    + " with a bad outer proxy descriptor: "
    + antiMercuryOuterProxy);
        } catch (Exception e) {
      logger.log(Level.INFO,
    "Caught failure -- with a bad outer proxy descriptor: "
          + e);
            e.printStackTrace();
      if (!antiMercuryException.equals(e)) {
          throw new TestException("Caught unexpected exception");
      } else {
          logger.log(Level.INFO,
        "Expected failure caught.");
      }
        }

  config =
      ServiceStarterCreateBadTransientServiceTest.getServiceConfigFile().toString();
  SharedActivatableServiceDescriptor antiMercuryInnerOuterProxy =
            new SharedActivatableServiceDescriptor(
    codebase,
                policy,
                classpath,
                act_impl,
                sga.getSharedGroupLog().toString(),
                new String[] { config },
    antiMercuryProxyPreparer,
                antiMercuryProxyPreparer,
    true);
        try {
View Full Code Here

TOP

Related Classes of com.sun.jini.qa.harness.SharedGroupAdmin

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.