Package org.apache.hivemind.service

Examples of org.apache.hivemind.service.MethodFab


        ClassFactory factory = (ClassFactory) factoryControl.getMock();

        MockControl cfc = newControl(ClassFab.class);
        ClassFab cf = (ClassFab) cfc.getMock();

        MethodFab mf = (MethodFab) newMock(MethodFab.class);

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();
View Full Code Here


        ClassFactory factory = (ClassFactory) factoryControl.getMock();

        MockControl cfc = newControl(ClassFab.class);
        ClassFab cf = (ClassFab) cfc.getMock();

        MethodFab mf = (MethodFab) newMock(MethodFab.class);

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();
View Full Code Here

        ClassFactory factory = (ClassFactory) factoryControl.getMock();

        MockControl cfc = newControl(ClassFab.class);
        ClassFab cf = (ClassFab) cfc.getMock();

        MethodFab mf = (MethodFab) newMock(MethodFab.class);

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();
View Full Code Here

    {
        Iterator i = _methods.values().iterator();
        while (i.hasNext())
        {

            MethodFab mf = (MethodFab) i.next();

            buffer.append("\n");
            buffer.append(mf);
            buffer.append("\n");
        }
View Full Code Here

                    ex), ex);
        }

        // Return a MethodFab so the caller can add catches.

        MethodFab result = new MethodFabImpl(getSource(), ms, method, body);

        _methods.put(ms, result);

        return result;
    }
View Full Code Here

            builder.addln("return result;");
        }

        builder.end();

        MethodFab methodFab = classFab.addMethod(Modifier.PUBLIC, sig, builder.toString());

        builder.clear();

        builder.begin();
        builder.add("org.apache.hivemind.service.impl.LoggingUtils.exception(_log, ");
        builder.addQuoted(methodName);
        builder.addln(", $e);");
        builder.addln("throw $e;");
        builder.end();

        String body = builder.toString();

        Class[] exceptions = sig.getExceptionTypes();

        int count = exceptions.length;

        for (int i = 0; i < count; i++)
        {
            methodFab.addCatch(exceptions[i], body);
        }

        // Catch and log any runtime exceptions, in addition to the
        // checked exceptions.

        methodFab.addCatch(RuntimeException.class, body);
    }
View Full Code Here

    {
        MethodSignature sig = new MethodSignature(returnClass, "run", null, null);

        MockControl control = newControl(ClassFab.class);
        ClassFab cf = (ClassFab) control.getMock();
        MethodFab mf = (MethodFab) newMock(MethodFab.class);

        cf.addMethod(Modifier.PUBLIC, sig, expectedBody);
        control.setReturnValue(mf);

        replayControls();
View Full Code Here

            builder.addln("return result;");
        }

        builder.end();

        MethodFab methodFab = classFab.addMethod(Modifier.PUBLIC, sig, builder.toString());

        builder.clear();

        builder.begin();
        builder.add("_logException(");
        builder.addQuoted(methodName);
        builder.addln(", $e);");
        builder.addln("throw $e;");
        builder.end();

        String body = builder.toString();

        Class[] exceptions = sig.getExceptionTypes();

        int count = exceptions.length;

        for (int i = 0; i < count; i++)
        {
            methodFab.addCatch(exceptions[i], body);
        }

        // Catch and log any runtime exceptions, in addition to the
        // checked exceptions.

        methodFab.addCatch(RuntimeException.class, body);
    }
View Full Code Here

            builder.addln("return result;");
        }

        builder.end();

        MethodFab methodFab = classFab.addMethod(Modifier.PUBLIC, sig, builder.toString());

        builder.clear();

        builder.begin();
        builder.add("org.apache.hivemind.service.impl.LoggingUtils.exception(_log, ");
        builder.addQuoted(methodName);
        builder.addln(", $e);");
        builder.addln("throw $e;");
        builder.end();

        String body = builder.toString();

        Class[] exceptions = sig.getExceptionTypes();

        int count = exceptions.length;

        for (int i = 0; i < count; i++)
        {
            methodFab.addCatch(exceptions[i], body);
        }

        // Catch and log any runtime exceptions, in addition to the
        // checked exceptions.

        methodFab.addCatch(RuntimeException.class, body);
    }
View Full Code Here

    public void testGetMethodFab() throws Exception
    {
        ClassFab cf = newClassFab("GetMethodFab", Object.class);

        MethodSignature s = new MethodSignature(void.class, "run", null, null);
        MethodFab mf = cf.addMethod(Modifier.PUBLIC, s, null);

        assertSame(mf, cf.getMethodFab(s));

        assertNull(cf.getMethodFab(new MethodSignature(void.class, "skip", null, null)));
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.service.MethodFab

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.