Package org.apache.hivemind

Examples of org.apache.hivemind.ErrorLog


        xmlSpd.setParametersSchema(schema);
       
        Location location = newLocation();
        InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor(location, "module");

        ErrorLog log = (ErrorLog) newMock(ErrorLog.class);

        // Training !
       
        point.getErrorLog();
        pointControl.setReturnValue(log);

        module.getServicePoint("foo.bar.Baz");
        moduleControl.setReturnValue(factoryPoint);
       
        module.resolveType(ArrayList.class.getName());
        moduleControl.setReturnValue(ArrayList.class);

        factoryPoint.getService(ServiceImplementationFactory.class);
        factoryPointControl.setReturnValue(factory);

        factoryPoint.getServicePointDefinition();
        factoryPointControl.setReturnValue(xmlSpd);
       
        factoryPoint.getModule();
        factoryPointControl.setReturnValue(module);

        String message = XmlImplMessages
                .wrongNumberOfParameters("foo.bar.Baz", 0, Occurances.REQUIRED);

        log.error(message, location, null);

        factory.createCoreServiceImplementation(new ServiceImplementationFactoryParametersImpl(
                point, module, Collections.EMPTY_LIST));
        factoryControl.setReturnValue("THE SERVICE");
View Full Code Here


    private void executeNonClassContribution(String name, Class objectClass, String message)
    {
        List l = Collections.singletonList(build(name, objectClass));

        ErrorLog el = (ErrorLog) newMock(ErrorLog.class);

        el.error(message, null, null);

        replayControls();

        BeanFactoryImpl f = new BeanFactoryImpl(el, Object.class, l, true);
View Full Code Here

    public void testIncorrectType()
    {
        List l = Collections.singletonList(build("array-list", ArrayList.class));

        ErrorLog el = (ErrorLog) newMock(ErrorLog.class);

        el
                .error(
                        "Contribution 'array-list' (class java.util.ArrayList) is not assignable to interface java.util.Map and has been ignored.",
                        null,
                        null);
View Full Code Here

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl errorLogc = newControl(ErrorLog.class);
        ErrorLog errorLog = (ErrorLog) errorLogc.getMock();

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo.Bar");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("org.apache.hivemind.service.impl.InitializerErrorRunnable");
        mc.setReturnValue(InitializerErrorRunnable.class);

        fp.getErrorLog();
        fpc.setReturnValue(errorLog);

        Throwable cause = new ApplicationRuntimeException("Failure in initializeService().");

        String message = ServiceMessages.unableToInitializeService(
                "foo.Bar",
                "initializeService",
                InitializerErrorRunnable.class,
                cause);

        errorLog.error(message, l, new ApplicationRuntimeException(""));
        errorLogc.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { null, null, new TypeMatcher() }));

        BuilderParameter p = new BuilderParameter();
        p.setClassName(InitializerErrorRunnable.class.getName());
View Full Code Here

        ServiceImplementationFactoryParameters fp = newParameters();
        Module module = newModule();
        ErrorHandler eh = newErrorHandler();
        Log log = newLog();
        Messages messages = newMessages();
        ErrorLog errorLog = newErrorLog();

        // Normally I try and get all the invocations into chronological
        // order ... but with this refactoring, that's painful; these
        // are in an order that appeases junit.
View Full Code Here

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        MockControl logc = newControl(ErrorLog.class);
        ErrorLog log = (ErrorLog) logc.getMock();

        fp.getServiceInterface();
        fpc.setReturnValue(Runnable.class);

        StrategyParameter p = buildParameter(Number.class, adapter, l, null);

        fp.getFirstParameter();
        fpc.setReturnValue(p);

        fp.getErrorLog();
        fpc.setReturnValue(log);

        log.error(
                StrategyMessages.strategyWrongInterface(adapter, Number.class, Runnable.class),
                l,
                new ClassCastException());
        logc.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { null, null, new TypeMatcher() }));
View Full Code Here

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        ErrorLog log = (ErrorLog) newMock(ErrorLog.class);

        fp.getServiceInterface();
        fpc.setReturnValue(Runnable.class);

        factory.newClass("NewClass", Object.class);
        factoryControl.setReturnValue(cf);

        cf.addInterface(Runnable.class);
        cf.addField("_registry", StrategyRegistry.class);

        cf.addConstructor(new Class[]
        { StrategyRegistry.class }, null, "_registry = $1;");
        cfc.setMatcher(new AggregateArgumentsMatcher(new ArrayMatcher()));

        cf.addMethod(
                Modifier.PRIVATE,
                new MethodSignature(Runnable.class, "_getStrategy", new Class[]
                { Object.class }, null),
                "return (java.lang.Runnable) _registry.getStrategy($1.getClass());");
        cfc.setReturnValue(mf);

        MethodSignature sig = new MethodSignature(void.class, "run", null, null);

        cf.addMethod(Modifier.PUBLIC, sig, "{  }");
        cfc.setReturnValue(mf);

        fp.getErrorLog();
        fpc.setReturnValue(log);

        fp.getFirstParameter();
        // Slight fudge: we return the location itself when we should return
        // an object with this location.
        fpc.setReturnValue(l);

        log.error(StrategyMessages.improperServiceMethod(sig), l, null);

        fp.getServiceId();
        fpc.setReturnValue("foo.Bar");

        ClassFabUtils.addToStringMethod(cf, StrategyMessages.toString("foo.Bar", Runnable.class));
View Full Code Here

        }
    }

    public void testTerminatorConflict()
    {
        ErrorLog log = newErrorLog();

        log.error(
                "Terminator ss2 for pipeline service foo.bar conflicts with "
                        + "previous terminator (ss1, at unknown location) and has been ignored.",
                null,
                null);
View Full Code Here

        verifyControls();
    }

    public void testIncorrectTerminatorType()
    {
        ErrorLog log = newErrorLog();

        log.error("-String- is not an instance of interface "
                + "org.apache.hivemind.lib.pipeline.StandardService suitable for "
                + "use as part of the pipeline for service foo.bar.", null, null);

        replayControls();
View Full Code Here

        verifyControls();
    }

    public void testIncorrectFilterType()
    {
        ErrorLog log = newErrorLog();

        log.error("-String- is not an instance of interface "
                + "org.apache.hivemind.lib.pipeline.StandardFilter suitable for "
                + "use as part of the pipeline for service foo.bar.", null, null);

        replayControls();
View Full Code Here

TOP

Related Classes of org.apache.hivemind.ErrorLog

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.