Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.ServicePoint


        Log log = (Log) logControl.getMock();

        LoggingInterceptorClassFactory f = new LoggingInterceptorClassFactory(cf);

        MockControl spControl = newControl(ServicePoint.class);
        ServicePoint sp = (ServicePoint) spControl.getMock();
       
        // Training

        sp.getServiceInterface();
        spControl.setReturnValue(Runnable.class);
               
        sp.getExtensionPointId();
        spControl.setReturnValue("foo.bar");
       
        replayControls();

        // Create interceptor
View Full Code Here


    private synchronized void setupFactoryAndParameters(ServicePoint servicePoint, Module contributingModule)
    {
        if (_factory == null)
        {
            ServicePoint factoryPoint = contributingModule.getServicePoint(_factoryServiceId);

            ErrorLog errorLog = servicePoint.getErrorLog();
           
            _factory = (ServiceImplementationFactory) factoryPoint
                .getService(ServiceImplementationFactory.class);

            ServicePointDefinition spd = factoryPoint.getServicePointDefinition();
            if (!(spd instanceof XmlServicePointDefinitionImpl)) {
                // TODO annotations: Externalize message
                throw new ApplicationRuntimeException("ServicePoint used as ServiceImplementationFactory must be of type XmlServicePointDefinitionImpl");
            }
            XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) spd;

            Schema schema = xmlServicePoint.getParametersSchema();
            if (schema != null) {
               
                Occurances expected = xmlServicePoint.getParametersCount();
                checkParameterCounts(errorLog, expected);

                SchemaProcessorImpl processor = new SchemaProcessorImpl(errorLog, schema);
               
                _convertedParameters = constructParametersContainer(schema.getRootElementClassName(), factoryPoint.getModule());
                processor.process(_convertedParameters, _parameters, contributingModule);
            }
        }
    }
View Full Code Here

{

    public void testToString()
    {
        MockControl control = MockControl.createControl(ServicePoint.class);
        ServicePoint mockServicePoint = (ServicePoint) control.getMock();

        ModuleImpl module = new ModuleImpl();
        module.setModuleId("module");
        module.toString();
        new RegistryInfrastructureImpl(null, Locale.ENGLISH).toString();
View Full Code Here

public class TestServiceImplementationFactoryParametersImpl extends HiveMindTestCase
{
    public void testGetFirstParameter()
    {
        final Module m = new ModuleImpl();
        final ServicePoint sp = new ServicePointImpl(m, null);
        final ServiceImplementationFactoryParametersImpl params = new ServiceImplementationFactoryParametersImpl( sp, m, new LinkedList() );
        assertNull( params.getFirstParameter() );
    }
View Full Code Here

    public void testServicePointTranslator()
    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();

        ServicePoint sp = new ServicePointImpl(m, null);

        m.getServicePoint("Fred");
        control.setReturnValue(sp);

        replayControls();

        Translator t = new ServicePointTranslator();

        ServicePoint result = (ServicePoint) t.translate(m, null, "Fred", null);

        assertSame(sp, result);

        verifyControls();
    }
View Full Code Here

    public void testEagerLoaderImpl()
    {
        EagerLoader el = new EagerLoader();
        List l = new ArrayList();

        ServicePoint sp = (ServicePoint) newMock(ServicePoint.class);

        sp.forceServiceInstantiation();
  
    replayControls();

        l.add(sp);
View Full Code Here

    }

    public void createInterceptor(InterceptorStack stack, Module invokingModule, List parameters)
    {
        ServicePoint servicePoint = invokingModule.getServicePoint(stack
                .getServiceExtensionPointId());
        Set methods = getInterceptedMethods(stack, parameters);
        try
        {
            PerformanceCollector counter = createMBean(servicePoint, methods);
View Full Code Here

    {
        MockControl moduleControl = newControl(Module.class);
        Module module = (Module) moduleControl.getMock();

        MockControl factoryPointControl = newControl(ServicePoint.class);
        ServicePoint factoryPoint = (ServicePoint) factoryPointControl.getMock();

        MockControl factoryControl = newControl(ServiceImplementationFactory.class);
        ServiceImplementationFactory factory = (ServiceImplementationFactory) factoryControl
                .getMock();

        MockControl pointControl = newControl(ServicePoint.class);
        ServicePoint point = (ServicePoint) pointControl.getMock();
       
        SchemaImpl schema = new SchemaImpl("module");
        schema.setRootElementClassName(ArrayList.class.getName());
       
        ModuleDefinition md = createModuleDefinition("test");
        XmlServicePointDefinitionImpl xmlSpd = new XmlServicePointDefinitionImpl(md);
        xmlSpd.setParametersCount(Occurances.REQUIRED);
        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);
       
View Full Code Here

    }

    public void createInterceptor(InterceptorStack stack, Module invokingModule, Object parameters)
    {
        ServicePoint servicePoint = invokingModule.getServicePoint(stack
                .getServiceExtensionPointId());
        Set methods = getInterceptedMethods(stack, (List) parameters);
        try
        {
            PerformanceCollector counter = createMBean(servicePoint, methods);
View Full Code Here

    {
        Registry registry = buildFrameworkRegistry("testMBeanRegistry.xml");
        List mBeanList = (List) registry.getConfiguration("hivemind.management.MBeans");

        // Training
        ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
        Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
        ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
        server.registerMBean(mBean1, on1);
        ObjectInstance oin1 = new ObjectInstance(on1, mBean1.getClass().getName());
        serverControl.setReturnValue(oin1);
View Full Code Here

TOP

Related Classes of org.apache.hivemind.internal.ServicePoint

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.