You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Howard M. Lewis Ship" <hl...@comcast.net> on 2004/07/19 23:36:46 UTC

RE: Stuck w/hivemind, please help :-)

HiveMind CVS should be passing all unit tests.  I don't check in unless it does.

Not sure what you are trying to create;  sounds to me like you want a ServiceImplementationFactory
that uses EasyMock to create the service implementation?

That's really easy:

create a service that implements ServiceImplementationFactory, i.e.

public class MockServiceFactory implements ServiceImplementationFactory
{

    public Object createCoreServiceImplementation(
        String serviceId,
        Class serviceInterface,
        Module invokingModule,
        List parameters)
    {
 		MockControl control = MockControl.createStrictControl(serviceInterace);
 		
 		control.replay();
 		
 		return control.getMock();
    }

}

That'll return a service implementation that will throw an exception if you invoke any methods on
it.  You can then use invoke-factory on this service, instead of hivemind.BuilderFactory.  Sweet!

hivemind.lib includes a factory that creates an empty/default implementation that does nothing ...
all the methods just return void, 0 or false.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: sixtus42@gmx.de [mailto:sixtus42@gmx.de] 
> Sent: Monday, July 19, 2004 5:13 PM
> To: hlship@apache.org
> Subject: Stuck w/hivemind, please help :-)
> 
> 
> Hi Howard,
> 
> 
> just talked my project into using Hivemind and now I have to eat my 
> words...
> 
> 
> We're in the starting phase, all we have is interfaces. To 
> get started, 
> we want Hivemind to return an Easymock object. I guess, I need an 
> object provider? The docs are thin, the mailing list doesn't have an 
> archive... pretty please?
> 
> so, maybe like this?
> 
> module (id=foo version="0.0.1")
> {
>      service-point (id=Repository interface=foo.repository.Repository)
> 
>      provider 
> (prefix=service-property:testing.foo.MockService:getRepository)
> 
> 
>      service-point (id=MockService 
> interface=testing.plaengine.MockService) {
>          create-instance (class=test.plaengine.MockServiceImpl)
>      }
> 
> }
> 
> public interface MockService {
> 
> 	foo.repository.Repository getRepository(); // impl 
> creates an easymock 
> instance
> }
> 
> Well, hivemind-1.0-beta-1 doesn't like the colons, 
> hivemind-cvs doesn't 
> pass the unit tests...
> 
> 
> Many thanks in advance,
> 
> )-(agen
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org