|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Junit Mock classesHi,
Are there Mock classes available or a short intro how to junit-test my own MyCapabilites class, etc. ? Or is the Miniservlet the (only/easiest) way to start up a muse application? Thanks, Jan -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany |
|
|
RE: Junit Mock classesHi Jan,
There is nothing officially downloadable but I created an "in process" isolation layer that I added to issue 270 : https://issues.apache.org/jira/browse/MUSE-270 Its a pretty good foundation for unit tests. For the actual calling of your capabitilites you could make client proxies and use the "in process" soap client to make your calls. As I know that you are using subscriptions you'll also have to make sure that you use the custom NotificationProducerClient from the tests as this uses the SoapClient from the environment (i.e. the "in process" one), whereas the default one will always try to create an http connection. I also suspect the unit testing work for Muse 2.3 contains something similar but I've not checked. cheers, Chris -----Original Message----- From: Jan Torben Heuer [mailto:jan.heuer@...] Sent: Wednesday, May 28, 2008 11:52 AM To: muse-user@... Subject: Junit Mock classes Hi, Are there Mock classes available or a short intro how to junit-test my own MyCapabilites class, etc. ? Or is the Miniservlet the (only/easiest) way to start up a muse application? Thanks, Jan -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany --------------------------------------------------------------------- To unsubscribe, e-mail: muse-user-unsubscribe@... For additional commands, e-mail: muse-user-help@... |
|
|
Re: Junit Mock classesOn Wednesday 28 May 2008 11:59:46 Chris.Twiner@... wrote:
Hallo, > There is nothing officially downloadable but I created an "in process" > isolation layer that I added to issue 270 : > https://issues.apache.org/jira/browse/MUSE-270 great, there is some interesting stuff... Is there a command which "starts" muse? I want it to check if the muse.xml can be read etc... I don't need any SOAP, yet, I just want to check if interfaces, wsdl and muse.xml fit together. like "new Muse();" ;-) -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany |
|
|
SV: Junit Mock classesHi Jan
As far as I know (and understand) Muse starts, or rather the Muse resource gets initialized with the first incoming SOAP call to that specific resource. Meaning that while you can use the Muse libs for many other things, to start the actual framework it's required to utilize a incoming SOAP message, that accesses one of the functions of the resource, described in the resources wsdl. To test you interfaces I think you would require a SOAP message as well as your interfaces utilizes this message format to work. To test your resource in a Junit environment this might get you started: public void testCreateFactory() throws SoapFault, IOException{ factory = new WsFactoryProxy(new EndpointReference(URI.create(factoryUrl))); factory.setTrace(false); } public void testCreateWithEpr() throws SoapFault, IOException{ EndpointReference clientEpr = factory.createWithEprOperation("TestResourceID-1","WsExtended"); clientResource = new WsExtendedProxy(clientEpr); clientResource.setTrace(false); } public void testWSN() throws SoapFault, IOException { factory.runtimeEventOperation("transaction"); clientResource.runtimeEventOperation(); } public void testDestroy() throws SoapFault, IOException { clientResource.destroy(); } In this I've a factory resource that creates a new resource of the type WsExtended. The functions I've exposed on my factory resource (in the wsdl) is runtimeEventOperation and createWithEprOperation. In my WsExtended I've expose (likewise in the wsdl) runtimeEventOperation() and destroy() (this one is free with WSRF). I hope this helps rather than confuse. /Lenni "Cake is not a dual-use food stuff" -----Oprindelig meddelelse----- Fra: Jan Torben Heuer [mailto:jan.heuer@...] Sendt: 28. maj 2008 17:43 Til: muse-user@... Emne: Re: Junit Mock classes On Wednesday 28 May 2008 11:59:46 Chris.Twiner@... wrote: Hallo, > There is nothing officially downloadable but I created an "in process" > isolation layer that I added to issue 270 : > https://issues.apache.org/jira/browse/MUSE-270 great, there is some interesting stuff... Is there a command which "starts" muse? I want it to check if the muse.xml can be read etc... I don't need any SOAP, yet, I just want to check if interfaces, wsdl and muse.xml fit together. like "new Muse();" ;-) -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany --------------------------------------------------------------------- To unsubscribe, e-mail: muse-user-unsubscribe@... For additional commands, e-mail: muse-user-help@... |
|
|
Re: SV: Junit Mock classesOn Thursday 29 May 2008 08:31:29 Lenni Madsen wrote:
Hallo, > public void testCreateFactory() throws SoapFault, IOException{ > factory = new WsFactoryProxy(new > EndpointReference(URI.create(factoryUrl))); > factory.setTrace(false); > } Ok, I simply did: @Override protected void setUp() throws Exception { EndpointReference epr = new EndpointReference(URI.create(RegisterPublisher.resourceType)); factory = new RegisterPublisher(epr); } public final void testRegister() { Object epr = factory.registerPublisher(null, null, false, null); } But I don't get the point when the system should actually get initialized. I get a NPE at the line: ResourceManager manager = getResource().getResourceManager(); later. Which is abvoius, because nothing has beed initialized, yet. Which point in you code did I miss? Jan -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany |
|
|
RE: Junit Mock classesHi Lenni / Jan / All,
Just to point out, the first SOAP message isn't a requirement of Muse, its an artifact of the framework that wraps it. In the example I gave no server is required and the muse is started immediately. When Muse is actually started then all resources types are loaded and a resource created for them. They are immediately available upon start up. To use the code I pointed to as an example the thing that starts Muse up is just: in InlineIsolationLayer main... InlineIsolationLayer iso = new InlineIsolationLayer(); iso.initialize(); that will verify all muse.xml and related code is correct for initialisation. Of course it can't verify you're code is all correct :-) cheers, Chris -----Original Message----- From: Lenni Madsen [mailto:l.madsen@...] Sent: Thursday, May 29, 2008 8:31 AM To: muse-user@... Subject: SV: Junit Mock classes Hi Jan As far as I know (and understand) Muse starts, or rather the Muse resource gets initialized with the first incoming SOAP call to that specific resource. Meaning that while you can use the Muse libs for many other things, to start the actual framework it's required to utilize a incoming SOAP message, that accesses one of the functions of the resource, described in the resources wsdl. To test you interfaces I think you would require a SOAP message as well as your interfaces utilizes this message format to work. To test your resource in a Junit environment this might get you started: public void testCreateFactory() throws SoapFault, IOException{ factory = new WsFactoryProxy(new EndpointReference(URI.create(factoryUrl))); factory.setTrace(false); } public void testCreateWithEpr() throws SoapFault, IOException{ EndpointReference clientEpr = factory.createWithEprOperation("TestResourceID-1","WsExtended"); clientResource = new WsExtendedProxy(clientEpr); clientResource.setTrace(false); } public void testWSN() throws SoapFault, IOException { factory.runtimeEventOperation("transaction"); clientResource.runtimeEventOperation(); } public void testDestroy() throws SoapFault, IOException { clientResource.destroy(); } In this I've a factory resource that creates a new resource of the type WsExtended. The functions I've exposed on my factory resource (in the wsdl) is runtimeEventOperation and createWithEprOperation. In my WsExtended I've expose (likewise in the wsdl) runtimeEventOperation() and destroy() (this one is free with WSRF). I hope this helps rather than confuse. /Lenni "Cake is not a dual-use food stuff" -----Oprindelig meddelelse----- Fra: Jan Torben Heuer [mailto:jan.heuer@...] Sendt: 28. maj 2008 17:43 Til: muse-user@... Emne: Re: Junit Mock classes On Wednesday 28 May 2008 11:59:46 Chris.Twiner@... wrote: Hallo, > There is nothing officially downloadable but I created an "in process" > isolation layer that I added to issue 270 : > https://issues.apache.org/jira/browse/MUSE-270 great, there is some interesting stuff... Is there a command which "starts" muse? I want it to check if the muse.xml can be read etc... I don't need any SOAP, yet, I just want to check if interfaces, wsdl and muse.xml fit together. like "new Muse();" ;-) -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany --------------------------------------------------------------------- To unsubscribe, e-mail: muse-user-unsubscribe@... For additional commands, e-mail: muse-user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: muse-user-unsubscribe@... For additional commands, e-mail: muse-user-help@... |
|
|
Re: Junit Mock classesOn Thursday 29 May 2008 11:42:08 Chris.Twiner@... wrote:
Hallo, > Hi Lenni / Jan / All, > > Just to point out, the first SOAP message isn't a requirement of Muse, its > an artifact of the framework that wraps it. In the example I gave no server > is required and the muse is started immediately. > > When Muse is actually started then all resources types are loaded and a > resource created for them. They are immediately available upon start up. > > To use the code I pointed to as an example the thing that starts Muse up is > just: > > in InlineIsolationLayer main... > > InlineIsolationLayer iso = new InlineIsolationLayer(); > iso.initialize(); > > that will verify all muse.xml and related code is correct for > initialisation. Of course it can't verify you're code is all correct :-) time and finally muse says: | May 29, 2008 12:45:41 PM org.apache.muse.core.routing.SimpleResourceRouter | initialize | INFO: [ID = 'RouterIsInitialized'] The resource router has been initialized. great! But my Resource's #initialize() is not called. So is it triggered by the first request or should it have been triggered automatically? Any what do I have to initialzie so that WsResource resource = getWsResource(); ResourceManager manager = resource.getResourceManager(); returns something different than null? Jan -- Jan Torben Heuer Institute for Geoinformatics jan.heuer@... Robert-Koch-Strasse 26-28 +49 251 83-31960 48151 Münster, Germany |
|
|
RE: Junit Mock classesHi Jan / All,
| May 29, 2008 12:45:41 PM | org.apache.muse.core.routing.SimpleResourceRouter | initialize | INFO: [ID = 'RouterIsInitialized'] The resource router has been initialized. great! But my Resource's #initialize() is not called. So is it triggered by the first request or should it have been triggered automatically? Any what do I have to initialzie so that WsResource resource = getWsResource(); ResourceManager manager = resource.getResourceManager(); returns something different than null? ^^^^^ If you haven't got the initializeCompleted or initialize called then either the resource-type isn't entered in the muse.xml properly OR there isn't a resource added. I should have been clearer when replying to Lenni's comment. For most uses you want an existing resource, in your specific case the factory resource should have an entry since you always want it to be available. Typically this is just, as per the 270 project structure: router-entries/resourceName/resource-instance-X.xml You will need one for the factory, which should contain something similar to the WsResource/resource-instance-1.xml contents in the issue. In addition there should be a use-router-persistence="true" attribute in the resource-type. This allows muse to know that it should load the resources. Sorry for any confusion that might have caused. For getting this to work can I suggest you contact me directly? Then when we know what extra steps were taken we can send a post back on the mailing list with the solution. cheers, chris --------------------------------------------------------------------- To unsubscribe, e-mail: muse-user-unsubscribe@... For additional commands, e-mail: muse-user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |