Package net.jini.constraint.BasicMethodConstraints

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc


            int testCase,
            String name,
            Class[] types,
            InvocationConstraints constraints) {
        if (testCase == 1) { // constructor without arguments
            return new MethodDesc(constraints);
        } else if (testCase == 2) { // constructor with 2 arguments
            return new MethodDesc(name, constraints);
        } else { // constructor with 3 arguments
            return new MethodDesc(name, types, constraints);
        }
    }
View Full Code Here


                name = "someMethod";
                Class[] types2 = new Class[types.length];
                for (int j = 0; j < types.length; ++j) {
                    types2[j] = types[j];
                }
                MethodDesc md1 =
                    callConstructor(testCase, name, types, constraints);
                MethodDesc md2 =
                    callConstructor(testCase, name, types2, constraints);
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
                types2[0] = long.class;
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
            }
           
            // 6
            name = "someMethod";
            InvocationConstraints emptyConstraints = new InvocationConstraints(
                    (InvocationConstraint) null, null);
            MethodDesc md1 =
                callConstructor(testCase, name, types, emptyConstraints);
            MethodDesc md2 =
                callConstructor(testCase, name, types, null);
            if (!md1.equals(md2)) {
                throw new TestException(
                        "MethodDesc objects should be equal");
            }
View Full Code Here

            String name = "someMethod";
            Class[] types = new Class[] {int.class, Object.class};
            InvocationConstraint ic = Delegation.YES;
            InvocationConstraints constraints = new InvocationConstraints(
                    ic, null);
            MethodDesc md = callConstructor(testCase, name, types, constraints);
            String result = md.toString();
            if (result.length() == 0) {
                throw new TestException(
                        "result should not be empty string");
            }
           
           
            // 2
            if (testCase == case2arg) {
                name = "*someMethod";
                md = callConstructor(testCase, name, types, constraints);
                result = md.toString();
                if (result.length() == 0) {
                    throw new TestException(
                            "result should not be empty string");
                }

                name = "*5someMethod";
                md = callConstructor(testCase, name, types, constraints);
                result = md.toString();
                if (result.length() == 0) {
                    throw new TestException(
                            "result should not be empty string");
                }
            }
           
            // 3
            if (testCase == case2arg) {
                name = "someMethod*";
                md = callConstructor(testCase, name, types, constraints);
                result = md.toString();
                if (result.length() == 0) {
                    throw new TestException(
                            "result should not be empty string");
                }
            }
View Full Code Here

            int testCase,
            String name,
            Class[] types,
            InvocationConstraints constraints) {
        if (testCase == 1) { // constructor without arguments
            return new MethodDesc(constraints);
        } else if (testCase == 2) { // constructor with 2 arguments
            return new MethodDesc(name, constraints);
        } else { // constructor with 3 arguments
            return new MethodDesc(name, types, constraints);
        }
    }
View Full Code Here

                name = "someMethod";
                Class[] types2 = new Class[types.length];
                for (int j = 0; j < types.length; ++j) {
                    types2[j] = types[j];
                }
                MethodDesc md1 =
                    callConstructor(testCase, name, types, constraints);
                MethodDesc md2 =
                    callConstructor(testCase, name, types2, constraints);
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
                types2[0] = long.class;
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
            }
           
            // 6
            name = "someMethod";
            InvocationConstraints emptyConstraints = new InvocationConstraints(
                    (InvocationConstraint) null, null);
            MethodDesc md1 =
                callConstructor(testCase, name, types, emptyConstraints);
            MethodDesc md2 =
                callConstructor(testCase, name, types, null);
            if (!md1.equals(md2)) {
                throw new TestException(
                        "MethodDesc objects should be equal");
            }
View Full Code Here

public class Ordering {

    static MethodDesc desc(String n, Class[] t) {
  if (t == null) {
      return new MethodDesc(n, null);
  } else {
      return new MethodDesc(n, t, null);
  }
    }
View Full Code Here

  legal(n1, n2);
  illegal(n2, n1);
    }

    static void def(String n) {
  MethodDesc d = new MethodDesc(null);
  legal(desc(n, null), d);
  illegal(d, desc(n, null));
  if (n.indexOf('*') < 0) {
      legal(desc(n, types1), d);
      illegal(d, desc(n, types1));
View Full Code Here

        "constraints cannot be empty");
  check(new BMC(null), null);
  check(new BMC(new MethodDesc[0]),
        "must have at least one descriptor");
  check(new BMC(new MethodDesc[]{
      new MethodDesc(null),
      new MethodDesc("foo", null)}),
        "default descriptor must be last");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("foo*", null),
      new MethodDesc("foo", null)}),
        "foo* cannot precede foo");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("foo", null),
      new MethodDesc("foo", noClasses, null)}),
        "foo cannot precede foo()");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("*bar", null),
      new MethodDesc("*foobar", null)}),
        "*bar cannot precede *foobar");
    }
View Full Code Here

  int count = mappings.length / 2;
  MethodDesc[] descs = new MethodDesc[count];
  for (int i = mappings.length - 1; i >= 0; i-= 2) {
      Method from = mappings[i - 1];
      Method to = mappings[i];
      descs[--count] = new MethodDesc(
    to.getName(), to.getParameterTypes(),
    methodConstraints.getConstraints(from));
  }
  return new BasicMethodConstraints(descs);
    }
View Full Code Here

    static final InvocationConstraints sc =
      new InvocationConstraints(Integrity.YES, null);

    static MethodDesc desc(String n) {
  return new MethodDesc(n, sc);
    }
View Full Code Here

TOP

Related Classes of net.jini.constraint.BasicMethodConstraints.MethodDesc

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.