JBossWS SVN: r5071 - in stack/native/branches/rest/src/main/java/org/jboss/rs: runtime and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 06:48:04 -0500 (Tue, 20 Nov 2007)
New Revision: 5071
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
Log:
Introduce invocation mediator
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 11:34:38 UTC (rev 5070)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 11:48:04 UTC (rev 5071)
@@ -25,11 +25,9 @@
import org.jboss.rs.ResourceError;
import org.jboss.rs.ResourceRegistry;
import org.jboss.rs.ResourceRegistryFactory;
-import org.jboss.rs.model.ResourceMethod;
import org.jboss.rs.model.ResourceModel;
-import org.jboss.rs.model.StatefulResourceResolver;
-import org.jboss.rs.model.ResourceLocator;
-import org.jboss.rs.runtime.*;
+import org.jboss.rs.runtime.InvocationMediator;
+import org.jboss.rs.runtime.RuntimeContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -41,7 +39,6 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
-import java.util.Stack;
/**
* @author Heiko.Braun(a)jboss.com
@@ -95,43 +92,11 @@
RuntimeContext rt = new RuntimeContext(method, uri, rootResources);
parseAcceptHeader(req, rt);
- // locate the resource to be invoked
- StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(rt);
- ResourceMethod resourceMethod = resolver.resolve();
+ // mediate the invocation
+ InvocationMediator mediator = new InvocationMediator(rt);
+ Object result = mediator.invoke();
- // evaluate locator stack
- Object subResourceInstance = null;
- Stack<ResourceLocator> visitedLocators = resolver.getVisitedLocator();
- while(!visitedLocators.isEmpty())
- {
- ResourceLocator loc = visitedLocators.pop();
- rt.setWorkingPath(resolver.getLocatorWorkingPath(loc));
-
- InvocationBuilder builder = new DefaultInvocationBuilder();
- builder.addInvocationModel(loc.getParameterBinding());
- builder.addInvocationModel(loc.getOperationBinding());
- Invocation locatorInvocation = builder.build(rt);
-
- InvocationHandler bridgeInvoker = new DefaultInvocationHandler();
- subResourceInstance = bridgeInvoker.invoke(locatorInvocation);
-
- }
-
- // create an Invocation instance
- InvocationBuilder builder = new DefaultInvocationBuilder();
- rt.setWorkingPath(resolver.getMethodWorkingPath());
-
- if(subResourceInstance!=null)
- builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
-
- builder.addInvocationModel( resourceMethod.getParameterBinding() );
- builder.addInvocationModel( resourceMethod.getOperationBinding() );
- Invocation invocation = builder.build(rt);
-
- // invoke it
- InvocationHandler invoker = new DefaultInvocationHandler();
- Object result = invoker.invoke(invocation);
-
+ // write to output stream
if(result instanceof String)
{
res.setContentType("text/plain");
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java 2007-11-20 11:48:04 UTC (rev 5071)
@@ -0,0 +1,65 @@
+package org.jboss.rs.runtime;
+
+import org.jboss.rs.model.ResourceLocator;
+import org.jboss.rs.model.StatefulResourceResolver;
+import org.jboss.rs.model.ResourceMethod;
+import org.jboss.rs.ResourceError;
+
+import java.util.Stack;
+
+/**
+ * A resource invocation can go through many locator invocations
+ * before invoking the final resource method. A mediator hides the implementation
+ * details of this process from outermost components.
+ *
+ */
+public class InvocationMediator
+{
+ private RuntimeContext runtimeContext;
+
+ public InvocationMediator(RuntimeContext rt)
+ {
+ this.runtimeContext = rt;
+ }
+
+ public Object invoke() throws ResourceError
+ {
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(runtimeContext);
+ ResourceMethod resourceMethod = resolver.resolve();
+
+ // evaluate locator stack
+ Object subResourceInstance = null;
+ Stack<ResourceLocator> visitedLocators = resolver.getVisitedLocator();
+ while(!visitedLocators.isEmpty())
+ {
+ ResourceLocator loc = visitedLocators.pop();
+ runtimeContext.setWorkingPath(resolver.getLocatorWorkingPath(loc));
+
+ InvocationBuilder builder = new DefaultInvocationBuilder();
+ builder.addInvocationModel(loc.getParameterBinding());
+ builder.addInvocationModel(loc.getOperationBinding());
+ Invocation locatorInvocation = builder.build(runtimeContext);
+
+ InvocationHandler bridgeInvoker = new DefaultInvocationHandler();
+ subResourceInstance = bridgeInvoker.invoke(locatorInvocation);
+
+ }
+
+ // create an Invocation instance
+ InvocationBuilder builder = new DefaultInvocationBuilder();
+ runtimeContext.setWorkingPath(resolver.getMethodWorkingPath());
+
+ if(subResourceInstance!=null)
+ builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
+
+ builder.addInvocationModel( resourceMethod.getParameterBinding() );
+ builder.addInvocationModel( resourceMethod.getOperationBinding() );
+ Invocation invocation = builder.build(runtimeContext);
+
+ // invoke it
+ InvocationHandler invoker = new DefaultInvocationHandler();
+ Object result = invoker.invoke(invocation);
+
+ return result;
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 6 months
JBossWS SVN: r5070 - in stack/native/branches/rest/src: main/java/org/jboss/rs/media and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 06:34:38 -0500 (Tue, 20 Nov 2007)
New Revision: 5070
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java
Removed:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
stack/native/branches/rest/src/main/java/org/jboss/rs/media/ContentNegotiation.java
stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
Log:
Renamed to StatefulResourceResolver
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -27,7 +27,7 @@
import org.jboss.rs.ResourceRegistryFactory;
import org.jboss.rs.model.ResourceMethod;
import org.jboss.rs.model.ResourceModel;
-import org.jboss.rs.model.ResourceResolver;
+import org.jboss.rs.model.StatefulResourceResolver;
import org.jboss.rs.model.ResourceLocator;
import org.jboss.rs.runtime.*;
@@ -96,7 +96,7 @@
parseAcceptHeader(req, rt);
// locate the resource to be invoked
- ResourceResolver resolver = ResourceResolver.newInstance(rt);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(rt);
ResourceMethod resourceMethod = resolver.resolve();
// evaluate locator stack
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/media/ContentNegotiation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/ContentNegotiation.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/ContentNegotiation.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -30,7 +30,7 @@
/**
* Matches available resource methods against the runtime context.<br>
- * Since this is likely to change it can be plugged into the {@link org.jboss.rs.model.ResourceResolver}.
+ * Since this is likely to change it can be plugged into the {@link org.jboss.rs.model.StatefulResourceResolver}.
*
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -47,7 +47,7 @@
* <li>HTTP 406
* </ol>
*
- * @see org.jboss.rs.model.ResourceResolver
+ * @see org.jboss.rs.model.StatefulResourceResolver
*
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
Deleted: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -1,240 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.rs.model;
-
-import org.jboss.rs.media.ContentNegotiation;
-import org.jboss.rs.media.DefaultContentNegotiation;
-import org.jboss.rs.runtime.RuntimeContext;
-
-import java.util.*;
-
-/**
- * Resolves resource methods from {@link org.jboss.rs.runtime.RuntimeContext#getPath()}.<br>
- * Once a set a of resource methods is identified, the resolver
- * delegates to a {@link org.jboss.rs.media.ContentNegotiation} plugin
- * to do a more fine grained media type matching.
- *
- * @author Heiko.Braun(a)jboss.com
- * @version $Revision$
- */
-public class ResourceResolver
-{
- // the runtime context
- private RuntimeContext context;
-
- // pluggable content negotitation
- private ContentNegotiation connegPlugin;
-
- private Stack<ResourceLocator> visitedLocator = new Stack<ResourceLocator>();
-
- private Map<ResourceLocator, String> locatorWorkingPath = new HashMap<ResourceLocator, String>();
-
- private String methodWorkingPath;
-
- /**
- * Provides a resolver with the default content negotitation.
- *
- * @param context the runtime context
- * @return a configured resource resolver instance
- */
- public static ResourceResolver newInstance(RuntimeContext context)
- {
- assert context!=null;
- ResourceResolver resourceResolver = new ResourceResolver(context);
- resourceResolver.connegPlugin = new DefaultContentNegotiation();
- return resourceResolver;
- }
-
- private ResourceResolver(RuntimeContext context)
- {
- this.context = context;
- }
-
- public ResourceMethod resolve()
- throws NoResourceException, NoMethodException
- {
- ResourceMethod resourceMethod = null;
-
- // Filter the set of resource classes by rejecting those whose
- // regular expression does not match uri
- List<ResourceMatch> includedResources = new ArrayList<ResourceMatch>();
- Iterator<ResourceModel> it1 = context.getRootResources().iterator();
- while(it1.hasNext())
- {
- ResourceModel model = it1.next();
- RegexQualifier qualifier = model.resolve(context.getPath());
- if(qualifier!=null)
- includedResources.add( new ResourceMatch(model, qualifier) );
- }
-
- if(includedResources.isEmpty())
- throw new NoResourceException("No resource matches URI '"+context.getPath()+"'");
-
- Collections.sort(includedResources);
-
- // DFS by locator, should result in a resource match
- Iterator<ResourceMatch> it2 = includedResources.iterator();
- while(it2.hasNext() && null==resourceMethod)
- {
- ResourceMatch rootResource = it2.next();
- resourceMethod = dfsResourceMatch(rootResource);
- }
-
- if(null == resourceMethod)
- throw new NoMethodException("No method matches URI '"+context.getPath());
-
- // gotcha
- return resourceMethod;
- }
-
- /**
- * Recursive scan for resource methods.
- * Inspect a resource match for methods and if it fails try the locators.
- *
- * @param dfsEntry
- * @return
- */
- private ResourceMethod dfsResourceMatch(ResourceMatch dfsEntry)
- throws NoMethodException, NoResourceException
- {
- ResourceMethod resourceMethod = null;
- String nextUriToken = dfsEntry.qualifier.nextUriToken;
-
- // resource and subresource methods first
- resourceMethod = resolveResourceMethod(dfsEntry, nextUriToken);
-
- // root didn't match, so recurse locators to find a resource
- if(resourceMethod!=null)
- {
- methodWorkingPath = nextUriToken;
- }
- else
- {
- ResourceMatch<ResourceModel> subResource = resolveByLocator(dfsEntry);
- if(subResource!=null)
- resourceMethod = dfsResourceMatch(subResource);
- }
-
- return resourceMethod;
- }
-
- private ResourceMatch<ResourceModel> resolveByLocator(ResourceMatch<ResourceModel> resourceMatch)
- throws NoResourceException
- {
- ResourceMatch<ResourceModel> match = null;
-
- List<ResourceMatch<ResourceModel>> weightedResults = new ArrayList<ResourceMatch<ResourceModel>>();
- Iterator<ResourceLocator> locators = resourceMatch.model.getResourceLocator().iterator();
- while(locators.hasNext())
- {
- ResourceLocator bridge = locators.next();
- RegexQualifier qualifier = bridge.resolve(resourceMatch.qualifier.nextUriToken);
- if(qualifier!=null)
- weightedResults.add( new ResourceMatch<ResourceModel>( bridge.field(), qualifier) );
- }
-
- if(!weightedResults.isEmpty())
- {
- Collections.sort(weightedResults);
- match = weightedResults.get(0);
- }
-
- // TODO: cleanup locator matching after sort
- for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
- {
- if(match.model == loc.field())
- {
- visitedLocator.add(0, loc);
- locatorWorkingPath.put(loc, resourceMatch.qualifier.nextUriToken);
- }
- }
-
- return match;
- }
-
- private ResourceMethod resolveResourceMethod(ResourceMatch<ResourceModel> methodTarget, String uriToken)
- throws NoMethodException
- {
- ResourceMethod match = null;
- List<ResourceMatch<ResourceMethod>> matches = new ArrayList<ResourceMatch<ResourceMethod>>();
-
- if("".equals(uriToken) || "/".equals(uriToken)) // resources methods
- {
- // use any available resource method for further mathing by mimetype, etc
- for(ResourceMethod resourceMethod : methodTarget.model.getResourceMethods())
- {
- matches.add(
- new ResourceMatch<ResourceMethod>(resourceMethod, RegexQualifier.NONE)
- );
- }
- }
- else // subresource methods
- {
- List<ResourceMethod> methods = methodTarget.model.getSubResourceMethods();
- Iterator<ResourceMethod> it = methods.iterator();
- while(it.hasNext())
- {
- ResourceMethod method = it.next();
- RegexQualifier qualifier = method.resolve(uriToken);
- if(qualifier!=null && ("".equals(qualifier.nextUriToken) || "/".equals(qualifier.nextUriToken)))
- {
- matches.add(
- new ResourceMatch<ResourceMethod>(method, qualifier)
- );
- }
- }
- }
-
- if(!matches.isEmpty())
- {
- Collections.sort(matches);
- match = contentNegotiation(matches);
- }
-
- return match;
- }
-
- private ResourceMethod contentNegotiation(List<ResourceMatch<ResourceMethod>> matches)
- throws NoMethodException
- {
- assert connegPlugin !=null;
-
- // delegate to conneg plugin
- return connegPlugin.match(context, matches);
- }
-
- public Stack<ResourceLocator> getVisitedLocator() {
- return visitedLocator;
- }
-
- public String getLocatorWorkingPath(ResourceLocator loc)
- {
- assert locatorWorkingPath.containsKey(loc);
- return locatorWorkingPath.get(loc);
- }
-
- public String getMethodWorkingPath()
- {
- assert methodWorkingPath!=null;
- return methodWorkingPath;
- }
-}
Copied: stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java (from rev 5069, stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java)
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -0,0 +1,240 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.rs.model;
+
+import org.jboss.rs.media.ContentNegotiation;
+import org.jboss.rs.media.DefaultContentNegotiation;
+import org.jboss.rs.runtime.RuntimeContext;
+
+import java.util.*;
+
+/**
+ * Resolves resource methods from {@link org.jboss.rs.runtime.RuntimeContext#getPath()}.<br>
+ * Once a set a of resource methods is identified, the resolver
+ * delegates to a {@link org.jboss.rs.media.ContentNegotiation} plugin
+ * to do a more fine grained media type matching.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class StatefulResourceResolver
+{
+ // the runtime context
+ private RuntimeContext context;
+
+ // pluggable content negotitation
+ private ContentNegotiation connegPlugin;
+
+ private Stack<ResourceLocator> visitedLocator = new Stack<ResourceLocator>();
+
+ private Map<ResourceLocator, String> locatorWorkingPath = new HashMap<ResourceLocator, String>();
+
+ private String methodWorkingPath;
+
+ /**
+ * Provides a resolver with the default content negotitation.
+ *
+ * @param context the runtime context
+ * @return a configured resource resolver instance
+ */
+ public static StatefulResourceResolver newInstance(RuntimeContext context)
+ {
+ assert context!=null;
+ StatefulResourceResolver resourceResolver = new StatefulResourceResolver(context);
+ resourceResolver.connegPlugin = new DefaultContentNegotiation();
+ return resourceResolver;
+ }
+
+ private StatefulResourceResolver(RuntimeContext context)
+ {
+ this.context = context;
+ }
+
+ public ResourceMethod resolve()
+ throws NoResourceException, NoMethodException
+ {
+ ResourceMethod resourceMethod = null;
+
+ // Filter the set of resource classes by rejecting those whose
+ // regular expression does not match uri
+ List<ResourceMatch> includedResources = new ArrayList<ResourceMatch>();
+ Iterator<ResourceModel> it1 = context.getRootResources().iterator();
+ while(it1.hasNext())
+ {
+ ResourceModel model = it1.next();
+ RegexQualifier qualifier = model.resolve(context.getPath());
+ if(qualifier!=null)
+ includedResources.add( new ResourceMatch(model, qualifier) );
+ }
+
+ if(includedResources.isEmpty())
+ throw new NoResourceException("No resource matches URI '"+context.getPath()+"'");
+
+ Collections.sort(includedResources);
+
+ // DFS by locator, should result in a resource match
+ Iterator<ResourceMatch> it2 = includedResources.iterator();
+ while(it2.hasNext() && null==resourceMethod)
+ {
+ ResourceMatch rootResource = it2.next();
+ resourceMethod = dfsResourceMatch(rootResource);
+ }
+
+ if(null == resourceMethod)
+ throw new NoMethodException("No method matches URI '"+context.getPath());
+
+ // gotcha
+ return resourceMethod;
+ }
+
+ /**
+ * Recursive scan for resource methods.
+ * Inspect a resource match for methods and if it fails try the locators.
+ *
+ * @param dfsEntry
+ * @return
+ */
+ private ResourceMethod dfsResourceMatch(ResourceMatch dfsEntry)
+ throws NoMethodException, NoResourceException
+ {
+ ResourceMethod resourceMethod = null;
+ String nextUriToken = dfsEntry.qualifier.nextUriToken;
+
+ // resource and subresource methods first
+ resourceMethod = resolveResourceMethod(dfsEntry, nextUriToken);
+
+ // root didn't match, so recurse locators to find a resource
+ if(resourceMethod!=null)
+ {
+ methodWorkingPath = nextUriToken;
+ }
+ else
+ {
+ ResourceMatch<ResourceModel> subResource = resolveByLocator(dfsEntry);
+ if(subResource!=null)
+ resourceMethod = dfsResourceMatch(subResource);
+ }
+
+ return resourceMethod;
+ }
+
+ private ResourceMatch<ResourceModel> resolveByLocator(ResourceMatch<ResourceModel> resourceMatch)
+ throws NoResourceException
+ {
+ ResourceMatch<ResourceModel> match = null;
+
+ List<ResourceMatch<ResourceModel>> weightedResults = new ArrayList<ResourceMatch<ResourceModel>>();
+ Iterator<ResourceLocator> locators = resourceMatch.model.getResourceLocator().iterator();
+ while(locators.hasNext())
+ {
+ ResourceLocator bridge = locators.next();
+ RegexQualifier qualifier = bridge.resolve(resourceMatch.qualifier.nextUriToken);
+ if(qualifier!=null)
+ weightedResults.add( new ResourceMatch<ResourceModel>( bridge.field(), qualifier) );
+ }
+
+ if(!weightedResults.isEmpty())
+ {
+ Collections.sort(weightedResults);
+ match = weightedResults.get(0);
+ }
+
+ // TODO: cleanup locator matching after sort
+ for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
+ {
+ if(match.model == loc.field())
+ {
+ visitedLocator.add(0, loc);
+ locatorWorkingPath.put(loc, resourceMatch.qualifier.nextUriToken);
+ }
+ }
+
+ return match;
+ }
+
+ private ResourceMethod resolveResourceMethod(ResourceMatch<ResourceModel> methodTarget, String uriToken)
+ throws NoMethodException
+ {
+ ResourceMethod match = null;
+ List<ResourceMatch<ResourceMethod>> matches = new ArrayList<ResourceMatch<ResourceMethod>>();
+
+ if("".equals(uriToken) || "/".equals(uriToken)) // resources methods
+ {
+ // use any available resource method for further mathing by mimetype, etc
+ for(ResourceMethod resourceMethod : methodTarget.model.getResourceMethods())
+ {
+ matches.add(
+ new ResourceMatch<ResourceMethod>(resourceMethod, RegexQualifier.NONE)
+ );
+ }
+ }
+ else // subresource methods
+ {
+ List<ResourceMethod> methods = methodTarget.model.getSubResourceMethods();
+ Iterator<ResourceMethod> it = methods.iterator();
+ while(it.hasNext())
+ {
+ ResourceMethod method = it.next();
+ RegexQualifier qualifier = method.resolve(uriToken);
+ if(qualifier!=null && ("".equals(qualifier.nextUriToken) || "/".equals(qualifier.nextUriToken)))
+ {
+ matches.add(
+ new ResourceMatch<ResourceMethod>(method, qualifier)
+ );
+ }
+ }
+ }
+
+ if(!matches.isEmpty())
+ {
+ Collections.sort(matches);
+ match = contentNegotiation(matches);
+ }
+
+ return match;
+ }
+
+ private ResourceMethod contentNegotiation(List<ResourceMatch<ResourceMethod>> matches)
+ throws NoMethodException
+ {
+ assert connegPlugin !=null;
+
+ // delegate to conneg plugin
+ return connegPlugin.match(context, matches);
+ }
+
+ public Stack<ResourceLocator> getVisitedLocator() {
+ return visitedLocator;
+ }
+
+ public String getLocatorWorkingPath(ResourceLocator loc)
+ {
+ assert locatorWorkingPath.containsKey(loc);
+ return locatorWorkingPath.get(loc);
+ }
+
+ public String getMethodWorkingPath()
+ {
+ assert methodWorkingPath!=null;
+ return methodWorkingPath;
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -54,7 +54,7 @@
{
URI uri = new URI("/rest/widgets/Foo/spec/Bar");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
@@ -103,7 +103,7 @@
URI uri = new URI("/rest/widgets/special");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
context.parseContentTypeHeader("text/xml");
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
context.setWorkingPath(resolver.getMethodWorkingPath());
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-20 11:30:56 UTC (rev 5069)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-20 11:34:38 UTC (rev 5070)
@@ -27,7 +27,7 @@
import org.jboss.rs.runtime.RuntimeContext;
import org.jboss.rs.model.ResourceModel;
import org.jboss.rs.model.ResourceModelParser;
-import org.jboss.rs.model.ResourceResolver;
+import org.jboss.rs.model.StatefulResourceResolver;
import org.jboss.rs.model.ResourceMethod;
import org.jboss.test.rs.WidgetList;
@@ -57,7 +57,7 @@
{
URI uri = new URI("/rest/widgets/Id/spec");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
assertNotNull(method);
@@ -70,7 +70,7 @@
RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
context.parseContentTypeHeader("text/xml");
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
@@ -82,7 +82,7 @@
{
URI uri = new URI("/rest/widgets/offers");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
@@ -94,7 +94,7 @@
{
URI uri = new URI("/rest/widgets/Id/spec/SpecName");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
@@ -108,7 +108,7 @@
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
context.parseAcceptHeader("text/plain");
- ResourceResolver resolver = ResourceResolver.newInstance(context);
+ StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
assertNotNull(method);
16 years, 6 months
JBossWS SVN: r5069 - in stack/native/branches/rest/src: main/java/org/jboss/rs/model and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 06:30:56 -0500 (Tue, 20 Nov 2007)
New Revision: 5069
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractResourceOperation.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceMethod.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModel.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationBuilder.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
Log:
Fixed parameter binding
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -104,8 +104,9 @@
Stack<ResourceLocator> visitedLocators = resolver.getVisitedLocator();
while(!visitedLocators.isEmpty())
{
- ResourceLocator loc = visitedLocators.pop();
-
+ ResourceLocator loc = visitedLocators.pop();
+ rt.setWorkingPath(resolver.getLocatorWorkingPath(loc));
+
InvocationBuilder builder = new DefaultInvocationBuilder();
builder.addInvocationModel(loc.getParameterBinding());
builder.addInvocationModel(loc.getOperationBinding());
@@ -118,7 +119,8 @@
// create an Invocation instance
InvocationBuilder builder = new DefaultInvocationBuilder();
-
+ rt.setWorkingPath(resolver.getMethodWorkingPath());
+
if(subResourceInstance!=null)
builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -29,21 +29,23 @@
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
-abstract class AbstractRegexResolveable
+abstract class AbstractRegexResolveable<T>
{
public final String URI_PARAM_PATTERN = "(.*?)";
public final String CHILD_SUFFIX_PATTERN = "(/.*)?";
public final String CHILDLESS_SUFFIX_PATTERN = "(/)?";
protected Pattern regexPattern;
- private boolean isCompiled;
+ private boolean isCompiled;
+ protected T parent = null;
+
protected void initFromUriTemplate(String uriTemplate)
{
- initFromUriTemplate(uriTemplate, null);
+ setupRegexPatterns(uriTemplate, null);
}
- protected void initFromUriTemplate(String uriTemplate, UriParamHandler handler)
+ protected void setupRegexPatterns(String uriTemplate, UriParamHandler handler)
{
assert uriTemplate!=null;
assert !uriTemplate.startsWith("/");
@@ -156,6 +158,10 @@
return token.startsWith("{") && token.endsWith("}");
}
+ public T getParent() {
+ return parent;
+ }
+
abstract boolean hasChildren();
abstract void freeze();
@@ -164,5 +170,5 @@
{
void newUriParam(int regexGroup, String paramName);
}
-
+
}
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractResourceOperation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractResourceOperation.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractResourceOperation.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -0,0 +1,71 @@
+package org.jboss.rs.model;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.reflect.Method;
+
+/**
+ * Common base class for {@link org.jboss.rs.model.ResourceLocator}
+ * and {@link org.jboss.rs.model.ResourceMethod}
+ */
+abstract class AbstractResourceOperation extends AbstractRegexResolveable
+{
+ protected String uriTemplate;
+ protected Method invocationTarget;
+ protected ParameterBinding parameterBinding;
+ protected boolean frozen;
+
+ AbstractResourceOperation(String uriTemplate, Method invocationTarget)
+ {
+ this.uriTemplate = uriTemplate;
+ this.invocationTarget = invocationTarget;
+ }
+
+ void freeze()
+ {
+ // We need to know which param belongs to what regex group
+ final Map<String, Integer> regexInfo = new HashMap<String, Integer>();
+ UriParamHandler collectRegexInfo = new UriParamHandler()
+ {
+ public void newUriParam(int regexGroup, String paramName)
+ {
+ regexInfo.put(paramName, regexGroup);
+ }
+ };
+
+ setupRegexPatterns(this.uriTemplate, collectRegexInfo);
+
+ setupParameterBinding(regexInfo);
+
+ // Lock instance
+ this.frozen = true;
+ }
+
+ private void setupParameterBinding(Map<String, Integer> regexInfo)
+ {
+ // Create ParameterBindig
+ this.parameterBinding = new ParameterBinding(this.regexPattern);
+
+ // Annotations on method parameters
+ this.parameterBinding.registerParameterAnnotations(invocationTarget);
+
+ // Additional info abpout the regex binding
+ for(String paramName : regexInfo.keySet())
+ {
+ int group = regexInfo.get(paramName);
+ this.parameterBinding.registerRegexGroupForParam(group, paramName);
+ }
+ }
+
+ public ParameterBinding getParameterBinding()
+ {
+ assert frozen;
+ return parameterBinding;
+ }
+
+ public OperationBinding getOperationBinding()
+ {
+ assert frozen;
+ return new OperationBinding(this.invocationTarget);
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractResourceOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -38,14 +38,26 @@
import java.util.regex.Pattern;
/**
- * Carries mapping information about
+ * ParameterBinding maps {@link org.jboss.rs.runtime.RuntimeContext} parameter
+ * to {@link Invocation} instances. ParameterBinding works on the full request path
+ * ({@link org.jboss.rs.runtime.RuntimeContext#getPath()}).
+ *
+ * <p>
+ * It carries mapping information about
* <ul>
- * <li>MatrixParam
- * <li>QueryParam
- * <li>UriParam
- * <li>HttpContext
- * <li>HeaderParam
+ * <li>MatrixParam
+ * <li>QueryParam
+ * <li>UriParam
+ * <li>HttpContext
+ * <li>HeaderParam
* </ul>
+ *
+ * <p>
+ * UriParameter are extracted by using using regular expressions.
+ *
+ * @see org.jboss.rs.model.ResourceMethod
+ * @see org.jboss.rs.model.ResourceLocator
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
@@ -80,12 +92,21 @@
/* Parameter types except for entity body*/
Map<Integer, Class> parameterTypes = new HashMap<Integer, Class>();
+ ParameterBinding(Pattern rootPattern)
+ {
+ this.regex = rootPattern;
+ }
+
public void accept(Invocation invocation)
{
RuntimeContext ctx = invocation.getContext();
- String path = ctx.getPath();
+ String workingPath = ctx.getWorkingPath();
- Matcher matcher = regex.matcher(path);
+ assert ctx!=null;
+ assert workingPath !=null;
+
+ // local workingPath matching
+ Matcher matcher = regex.matcher(workingPath);
boolean matches = matcher.matches();
if(!matches)
@@ -95,7 +116,7 @@
for(String param : uriParam.keySet())
{
int paramIndex = uriParam.get(param);
- String paramValue = matcher.group(regexMapping.get(param) + 1);
+ String paramValue = matcher.group(regexMapping.get(param));
invocation.insertParameterInstance(paramIndex, paramValue);
}
@@ -123,12 +144,6 @@
}
}
- ParameterBinding(Pattern rootPattern)
- {
- // Extend pattern to strip root path, results in additional groups
- this.regex = Pattern.compile(PREFIX_PATTERN +rootPattern.toString());
- }
-
void registerRegexGroupForParam(int group, String paramName)
{
regexMapping.put(paramName, group);
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -22,25 +22,20 @@
package org.jboss.rs.model;
import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.HashMap;
/**
+ * Resource locator meta data.
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
-public class ResourceLocator extends AbstractRegexResolveable
-{
+public class ResourceLocator extends AbstractResourceOperation {
private ResourceModel link;
-
- private String uriTemplate;
- private Method invocationTarget;
- private ParameterBinding parameterBinding;
-
- ResourceLocator(Method invocationTarget, ResourceModel link)
+
+ ResourceLocator(ResourceModel parent, Method invocationTarget, ResourceModel link)
{
- this.invocationTarget = invocationTarget;
- this.uriTemplate = link.getUriTemplate();
+ super(link.getUriTemplate(), invocationTarget);
+ super.parent = parent;
this.link = link;
}
@@ -60,48 +55,6 @@
return true;
}
- void freeze()
- {
- // We need to know which param belongs to what regex group
- final Map<String, Integer> regexInfo = new HashMap<String, Integer>();
- UriParamHandler collectRegexInfo = new UriParamHandler()
- {
- public void newUriParam(int regexGroup, String paramName)
- {
- regexInfo.put(paramName, regexGroup);
- }
- };
-
- initFromUriTemplate(this.uriTemplate, collectRegexInfo);
-
- // Create ParameterBindig
- this.parameterBinding = new ParameterBinding(this.regexPattern);
-
- // Annotations on method parameters
- this.parameterBinding.registerParameterAnnotations(invocationTarget);
-
- // Additional info abpout the regex binding
- for(String paramName : regexInfo.keySet())
- {
- int group = regexInfo.get(paramName);
- this.parameterBinding.registerRegexGroupForParam(group, paramName);
- }
- }
-
- public ParameterBinding getParameterBinding() {
- return parameterBinding;
- }
-
- public Method getInvocationTarget() {
- return invocationTarget;
- }
-
- public OperationBinding getOperationBinding()
- {
- return new OperationBinding(this.invocationTarget);
- }
-
-
public String toString() {
return "ResourceLocator{uri="+uriTemplate+", regex="+regexPattern+"}";
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceMethod.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceMethod.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceMethod.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -24,38 +24,31 @@
import org.jboss.rs.MethodHTTP;
import org.jboss.rs.util.Convert;
+import javax.activation.MimeType;
import javax.ws.rs.ConsumeMime;
import javax.ws.rs.ProduceMime;
-import javax.activation.MimeType;
-import java.lang.reflect.Method;
import java.lang.annotation.Annotation;
-import java.util.List;
+import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
+import java.util.List;
/**
+ * Resource mthod meta data.
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
-public class ResourceMethod extends AbstractRegexResolveable
-{
- private MethodHTTP methodHTTP;
- private String uriTemplate;
- private Method invocationTarget;
+public class ResourceMethod extends AbstractResourceOperation {
+ private MethodHTTP methodHTTP;
private List<MimeType> consumeMimeTypes = new ArrayList<MimeType>();
private List<MimeType> produceMimeTypes = new ArrayList<MimeType>();
- private ParameterBinding parameterBinding;
-
- private boolean frozen;
-
- ResourceMethod(MethodHTTP method, String uriTemplate, Method invocationTarget)
+ ResourceMethod(ResourceModel parent, MethodHTTP method, String uriTemplate, Method invocationTarget)
{
- this.uriTemplate = uriTemplate;
+ super(uriTemplate, invocationTarget);
+ super.parent = parent;
this.methodHTTP = method;
- this.invocationTarget = invocationTarget;
}
public MethodHTTP getMethodHTTP()
@@ -90,50 +83,12 @@
return produceMimeTypes;
}
- public ParameterBinding getParameterBinding()
- {
- assert frozen;
- return parameterBinding;
- }
-
- public OperationBinding getOperationBinding()
- {
- return new OperationBinding(this.invocationTarget);
- }
-
void freeze()
{
- // We need to know which param belongs to what regex group
- final Map<String, Integer> regexInfo = new HashMap<String, Integer>();
- UriParamHandler collectRegexInfo = new UriParamHandler()
- {
- public void newUriParam(int regexGroup, String paramName)
- {
- regexInfo.put(paramName, regexGroup);
- }
- };
+ super.freeze();
- // setup the regex stuff and push uriParam info to ParameterBinding
- initFromUriTemplate(this.uriTemplate, collectRegexInfo);
-
// parse the mime annotations
initMimeTypes();
-
- // Create ParameterBindig
- this.parameterBinding = new ParameterBinding(this.regexPattern);
-
- // Annotations on method parameters
- this.parameterBinding.registerParameterAnnotations(invocationTarget);
-
- // Additional info abpout the regex binding
- for(String paramName : regexInfo.keySet())
- {
- int group = regexInfo.get(paramName);
- this.parameterBinding.registerRegexGroupForParam(group, paramName);
- }
-
- // Lock instance
- this.frozen = true;
}
private void initMimeTypes()
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModel.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModel.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModel.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -25,13 +25,13 @@
import java.util.List;
/**
+ * Resource meta data.
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
public class ResourceModel extends AbstractRegexResolveable
{
- private ResourceModel parent = null;
-
private String uriTemplate;
private Class invocationTarget;
@@ -46,7 +46,7 @@
public ResourceModel(ResourceModel parent, String uriTemplate, Class invocationTarget)
{
- this.parent = parent;
+ super.parent = parent;
this.uriTemplate = uriTemplate;
this.invocationTarget = invocationTarget;
}
@@ -78,12 +78,7 @@
{
return !subResourceMethods.isEmpty() || !resourceLocators.isEmpty();
}
-
- ResourceModel getParent()
- {
- return parent;
- }
-
+
public Class getInvocationTarget()
{
return invocationTarget;
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -64,43 +64,20 @@
{
for( Method m : resource.getInvocationTarget().getDeclaredMethods() )
- {
+ {
parseMethod(m, resource);
// todo: constructors
}
- // freeze resource
+ // freeze root resource
resource.freeze();
- log.debug("---");
- log.debug(resource);
-
- // freeze resource methods
- for(ResourceMethod rm : resource.getResourceMethods())
- {
- rm.freeze();
- log.debug(rm);
- }
-
- // log locators methods
- for(ResourceLocator loc : resource.getResourceLocator())
- {
- log.debug(loc);
- }
-
- // freeze sub resource methods
- for(ResourceMethod srm : resource.getSubResourceMethods())
- {
- srm.freeze();
- log.debug(srm);
- }
-
- log.debug("---");
+ logResourceTree(resource);
}
- private void parseMethod(Method method, ResourceModel resource)
- {
+ private void parseMethod(Method method, ResourceModel parentResource)
+ {
if(method.isAnnotationPresent(UriTemplate.class))
{
UriTemplate uri = method.getAnnotation(UriTemplate.class);
@@ -115,20 +92,24 @@
// sub resource method
Annotation a = method.getAnnotation(requestType);
resourceMethod = new ResourceMethod(
+ parentResource,
Convert.annotationToMethodHTTP(a), uri.value(), method
);
- resource.addSubResourceMethod(resourceMethod);
+
+ resourceMethod.freeze();
+ parentResource.addSubResourceMethod(resourceMethod);
}
}
// subresource locator
if(null == resourceMethod)
{
- ResourceModel subResource = new ResourceModel(resource, uri.value(), method.getReturnType());
- ResourceLocator locator = new ResourceLocator(method, subResource);
- locator.freeze();
- resource.addSubResourceLocator(locator);
+ ResourceModel subResource = new ResourceModel(parentResource, uri.value(), method.getReturnType());
+ ResourceLocator locator = new ResourceLocator(parentResource, method, subResource);
+ locator.freeze();
+ parentResource.addSubResourceLocator(locator);
+
// recursive
parseInternal(subResource);
}
@@ -142,12 +123,41 @@
// resource method
Annotation a = method.getAnnotation(requestType);
ResourceMethod resourceMethod = new ResourceMethod(
+ parentResource,
Convert.annotationToMethodHTTP(a), "", method
);
- resource.addResourceMethod(resourceMethod);
+
+ resourceMethod.freeze();
+ parentResource.addResourceMethod(resourceMethod);
}
}
}
}
+ private void logResourceTree(ResourceModel resource)
+ {
+ log.debug("---");
+ log.debug(resource);
+
+ // freeze resource methods
+ for(ResourceMethod rm : resource.getResourceMethods())
+ {
+ log.debug(rm);
+ }
+
+ // log locators methods
+ for(ResourceLocator loc : resource.getResourceLocator())
+ {
+ log.debug(loc);
+ }
+
+ // freeze sub resource methods
+ for(ResourceMethod srm : resource.getSubResourceMethods())
+ {
+ log.debug(srm);
+ }
+
+ log.debug("---");
+ }
+
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -31,7 +31,7 @@
* Resolves resource methods from {@link org.jboss.rs.runtime.RuntimeContext#getPath()}.<br>
* Once a set a of resource methods is identified, the resolver
* delegates to a {@link org.jboss.rs.media.ContentNegotiation} plugin
- * to do the fine grained media type matching.
+ * to do a more fine grained media type matching.
*
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
@@ -45,6 +45,10 @@
private ContentNegotiation connegPlugin;
private Stack<ResourceLocator> visitedLocator = new Stack<ResourceLocator>();
+
+ private Map<ResourceLocator, String> locatorWorkingPath = new HashMap<ResourceLocator, String>();
+
+ private String methodWorkingPath;
/**
* Provides a resolver with the default content negotitation.
@@ -96,7 +100,7 @@
}
if(null == resourceMethod)
- throw new NoMethodException("No method for URI '"+context.getPath());
+ throw new NoMethodException("No method matches URI '"+context.getPath());
// gotcha
return resourceMethod;
@@ -119,11 +123,15 @@
resourceMethod = resolveResourceMethod(dfsEntry, nextUriToken);
// root didn't match, so recurse locators to find a resource
- if(null == resourceMethod)
+ if(resourceMethod!=null)
{
+ methodWorkingPath = nextUriToken;
+ }
+ else
+ {
ResourceMatch<ResourceModel> subResource = resolveByLocator(dfsEntry);
if(subResource!=null)
- resourceMethod = dfsResourceMatch(subResource);
+ resourceMethod = dfsResourceMatch(subResource);
}
return resourceMethod;
@@ -154,8 +162,10 @@
for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
{
if(match.model == loc.field())
+ {
visitedLocator.add(0, loc);
-
+ locatorWorkingPath.put(loc, resourceMatch.qualifier.nextUriToken);
+ }
}
return match;
@@ -212,8 +222,19 @@
return connegPlugin.match(context, matches);
}
-
public Stack<ResourceLocator> getVisitedLocator() {
return visitedLocator;
}
+
+ public String getLocatorWorkingPath(ResourceLocator loc)
+ {
+ assert locatorWorkingPath.containsKey(loc);
+ return locatorWorkingPath.get(loc);
+ }
+
+ public String getMethodWorkingPath()
+ {
+ assert methodWorkingPath!=null;
+ return methodWorkingPath;
+ }
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -46,7 +46,7 @@
// invocation metadata about the bean
private Class targetBean;
- private Object targetInstance;
+ private Object targetInstance;
public Invocation(RuntimeContext context)
{
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationBuilder.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationBuilder.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationBuilder.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -37,7 +37,7 @@
private List<InvocationModel> invocationModels = new LinkedList<InvocationModel>();
/**
- * Add invocaiton model to an order list.
+ * Add invocaiton model to an ordered list.
*
* @param model
*/
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -34,6 +34,9 @@
import java.util.Stack;
/**
+ * Requesting a resource thorugh HTTP creates a runtime context<br>
+ * The context is associated with a set of {@link ResourceModel}
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
@@ -58,6 +61,8 @@
// The associated runtime model for a web context
private List<ResourceModel> rootResources;
+ private String workingPath;
+
public RuntimeContext(MethodHTTP requestMethod, URI uri, List<ResourceModel> rootResources)
{
this.requestMethod = requestMethod;
@@ -147,4 +152,14 @@
{
return path;
}
+
+ public String getWorkingPath()
+ {
+ return workingPath;
+ }
+
+ public void setWorkingPath(String workingPath)
+ {
+ this.workingPath = workingPath;
+ }
}
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 10:22:23 UTC (rev 5068)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 11:30:56 UTC (rev 5069)
@@ -24,19 +24,13 @@
import junit.framework.TestCase;
import org.jboss.rs.ResourceRegistry;
import org.jboss.rs.MethodHTTP;
-import org.jboss.rs.runtime.RuntimeContext;
-import org.jboss.rs.runtime.InvocationBuilder;
-import org.jboss.rs.runtime.DefaultInvocationBuilder;
-import org.jboss.rs.runtime.Invocation;
-import org.jboss.rs.runtime.InvocationHandler;
-import org.jboss.rs.model.ResourceModel;
-import org.jboss.rs.model.ResourceModelParser;
-import org.jboss.rs.model.ResourceResolver;
-import org.jboss.rs.model.ResourceMethod;
+import org.jboss.rs.runtime.*;
+import org.jboss.rs.model.*;
import org.jboss.test.rs.WidgetList;
import javax.ws.rs.core.HttpHeaders;
import java.util.List;
+import java.util.Stack;
import java.net.URI;
/**
@@ -67,12 +61,37 @@
assertNotNull(method);
assertEquals("spec/{name}", method.getUriTemplate());
+ // evaluate locator stack
+ Object subResourceInstance = null;
+ Stack<ResourceLocator> visitedLocators = resolver.getVisitedLocator();
+ while(!visitedLocators.isEmpty())
+ {
+ ResourceLocator loc = visitedLocators.pop();
+
+ // adopt working path
+ context.setWorkingPath(resolver.getLocatorWorkingPath(loc));
+
+ InvocationBuilder builder = new DefaultInvocationBuilder();
+ builder.addInvocationModel(loc.getParameterBinding());
+ builder.addInvocationModel(loc.getOperationBinding());
+ Invocation locatorInvocation = builder.build(context);
+
+ InvocationHandler bridgeInvoker = new DefaultInvocationHandler();
+ subResourceInstance = bridgeInvoker.invoke(locatorInvocation);
+
+ }
+
// setup a builder
InvocationBuilder builder = new DefaultInvocationBuilder();
+ context.setWorkingPath(resolver.getMethodWorkingPath());
+
+ if(subResourceInstance!=null)
+ builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
+
builder.addInvocationModel(method.getParameterBinding());
-
- // create an Invocation instance
+ builder.addInvocationModel(method.getOperationBinding());
Invocation invocation = builder.build(context);
+
Object parameterInstance = invocation.getParameterInstances().get(0);
assertTrue(parameterInstance!=null);
assertTrue("Wildcard parameter {name} not bound", parameterInstance.equals("Bar"));
@@ -87,6 +106,7 @@
ResourceResolver resolver = ResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
+ context.setWorkingPath(resolver.getMethodWorkingPath());
assertNotNull(method);
assertEquals("special", method.getUriTemplate());
16 years, 6 months
JBossWS SVN: r5068 - stack/native/branches/jbossws-native-2.0.2/src/main/java/org/jboss/ws/core/jaxrpc/client.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-20 05:22:23 -0500 (Tue, 20 Nov 2007)
New Revision: 5068
Modified:
stack/native/branches/jbossws-native-2.0.2/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
Log:
Prevent NPE whith null SEI in <port-component-ref>
Modified: stack/native/branches/jbossws-native-2.0.2/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.2/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2007-11-19 15:51:23 UTC (rev 5067)
+++ stack/native/branches/jbossws-native-2.0.2/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2007-11-20 10:22:23 UTC (rev 5068)
@@ -238,9 +238,13 @@
// load all service endpoint interface classes
for (UnifiedPortComponentRefMetaData pcr : serviceRef.getPortComponentRefs())
{
- Class seiClass = contextCL.loadClass(pcr.getServiceEndpointInterface());
- if (Remote.class.isAssignableFrom(seiClass) == false)
- throw new IllegalArgumentException("The SEI does not implement java.rmi.Remote: " + seiClass.getName());
+ String seiName = pcr.getServiceEndpointInterface();
+ if (seiName != null)
+ {
+ Class seiClass = contextCL.loadClass(seiName);
+ if (Remote.class.isAssignableFrom(seiClass) == false)
+ throw new IllegalArgumentException("The SEI does not implement java.rmi.Remote: " + seiClass.getName());
+ }
}
// Setup the handler chain
16 years, 6 months
JBossWS SVN: r5067 - stack/native/branches/rest/src/main/java/org/jboss/rs/model.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-19 10:51:23 -0500 (Mon, 19 Nov 2007)
New Revision: 5067
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
Log:
Fix subresources patterns
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java 2007-11-19 15:23:28 UTC (rev 5066)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/AbstractRegexResolveable.java 2007-11-19 15:51:23 UTC (rev 5067)
@@ -56,6 +56,14 @@
String tok = tokenizer.nextToken();
if(isUriParam(tok))
{
+
+ if(groupIndex>1)
+ {
+ // i.e. 'spec/{name}'
+ patternBuffer.append("(/)");
+ groupIndex++;
+ }
+
if(handler != null)
{
// register uri param callback
@@ -63,6 +71,7 @@
handler.newUriParam(groupIndex, paramName);
}
+
patternBuffer.append( regexFromUriParam(tok) );
}
else
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-19 15:23:28 UTC (rev 5066)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-19 15:51:23 UTC (rev 5067)
@@ -100,4 +100,9 @@
{
return new OperationBinding(this.invocationTarget);
}
+
+
+ public String toString() {
+ return "ResourceLocator{uri="+uriTemplate+", regex="+regexPattern+"}";
+ }
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-19 15:23:28 UTC (rev 5066)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-19 15:51:23 UTC (rev 5067)
@@ -83,6 +83,12 @@
log.debug(rm);
}
+ // log locators methods
+ for(ResourceLocator loc : resource.getResourceLocator())
+ {
+ log.debug(loc);
+ }
+
// freeze sub resource methods
for(ResourceMethod srm : resource.getSubResourceMethods())
{
@@ -120,7 +126,7 @@
{
ResourceModel subResource = new ResourceModel(resource, uri.value(), method.getReturnType());
ResourceLocator locator = new ResourceLocator(method, subResource);
- locator.freeze();
+ locator.freeze();
resource.addSubResourceLocator(locator);
// recursive
16 years, 6 months
JBossWS SVN: r5066 - in stack/native/branches/rest/src: main/java/org/jboss/rs/media and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-19 10:23:28 -0500 (Mon, 19 Nov 2007)
New Revision: 5066
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/PresetInvocationTarget.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/DefaultInvocationHandler.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DeploymentTestCase.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
Log:
Cleanup test cases
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -28,12 +28,8 @@
import org.jboss.rs.model.ResourceMethod;
import org.jboss.rs.model.ResourceModel;
import org.jboss.rs.model.ResourceResolver;
-import org.jboss.rs.runtime.DefaultInvocationBuilder;
-import org.jboss.rs.runtime.DefaultInvocationHandler;
-import org.jboss.rs.runtime.Invocation;
-import org.jboss.rs.runtime.InvocationBuilder;
-import org.jboss.rs.runtime.RuntimeContext;
-import org.jboss.rs.runtime.InvocationHandler;
+import org.jboss.rs.model.ResourceLocator;
+import org.jboss.rs.runtime.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -45,6 +41,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import java.util.Stack;
/**
* @author Heiko.Braun(a)jboss.com
@@ -102,8 +99,29 @@
ResourceResolver resolver = ResourceResolver.newInstance(rt);
ResourceMethod resourceMethod = resolver.resolve();
+ // evaluate locator stack
+ Object subResourceInstance = null;
+ Stack<ResourceLocator> visitedLocators = resolver.getVisitedLocator();
+ while(!visitedLocators.isEmpty())
+ {
+ ResourceLocator loc = visitedLocators.pop();
+
+ InvocationBuilder builder = new DefaultInvocationBuilder();
+ builder.addInvocationModel(loc.getParameterBinding());
+ builder.addInvocationModel(loc.getOperationBinding());
+ Invocation locatorInvocation = builder.build(rt);
+
+ InvocationHandler bridgeInvoker = new DefaultInvocationHandler();
+ subResourceInstance = bridgeInvoker.invoke(locatorInvocation);
+
+ }
+
// create an Invocation instance
InvocationBuilder builder = new DefaultInvocationBuilder();
+
+ if(subResourceInstance!=null)
+ builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
+
builder.addInvocationModel( resourceMethod.getParameterBinding() );
builder.addInvocationModel( resourceMethod.getOperationBinding() );
Invocation invocation = builder.build(rt);
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/DefaultContentNegotiation.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -26,6 +26,7 @@
import org.jboss.rs.model.NoMethodException;
import org.jboss.rs.runtime.RuntimeContext;
import org.jboss.rs.MethodHTTP;
+import org.jboss.logging.Logger;
import javax.activation.MimeType;
import java.util.List;
@@ -54,6 +55,8 @@
public class DefaultContentNegotiation implements ContentNegotiation
{
+ private static Logger log = Logger.getLogger(DefaultContentNegotiation.class);
+
public ResourceMethod match(RuntimeContext context, List<ResourceMatch<ResourceMethod>> candidates)
throws NoMethodException
{
@@ -67,6 +70,7 @@
matches = matchByOutputMime(context, matches);
// TODO: sort results, requires abstracting of RegexQualifier to a more general Qualifier
+ log.warn("Conneg sort algo is missing");
match = matches.get(0);
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -51,7 +51,7 @@
*/
public class ParameterBinding implements InvocationModel
{
- /* Pattenern of the owning ResourceMethod */
+ /* Pattern of the owning ResourceMethod */
private final Pattern regex;
/* Pattern to strip prefix from runtime path */
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceLocator.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -21,20 +21,27 @@
*/
package org.jboss.rs.model;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
public class ResourceLocator extends AbstractRegexResolveable
{
- ResourceModel target;
+ private ResourceModel link;
private String uriTemplate;
+ private Method invocationTarget;
+ private ParameterBinding parameterBinding;
- ResourceLocator(ResourceModel target)
+ ResourceLocator(Method invocationTarget, ResourceModel link)
{
- this.uriTemplate = target.getUriTemplate();
- this.target = target;
+ this.invocationTarget = invocationTarget;
+ this.uriTemplate = link.getUriTemplate();
+ this.link = link;
}
public String getUriTemplate()
@@ -44,7 +51,7 @@
public ResourceModel field()
{
- return target;
+ return link;
}
boolean hasChildren()
@@ -55,6 +62,42 @@
void freeze()
{
- initFromUriTemplate(this.uriTemplate, null);
+ // We need to know which param belongs to what regex group
+ final Map<String, Integer> regexInfo = new HashMap<String, Integer>();
+ UriParamHandler collectRegexInfo = new UriParamHandler()
+ {
+ public void newUriParam(int regexGroup, String paramName)
+ {
+ regexInfo.put(paramName, regexGroup);
+ }
+ };
+
+ initFromUriTemplate(this.uriTemplate, collectRegexInfo);
+
+ // Create ParameterBindig
+ this.parameterBinding = new ParameterBinding(this.regexPattern);
+
+ // Annotations on method parameters
+ this.parameterBinding.registerParameterAnnotations(invocationTarget);
+
+ // Additional info abpout the regex binding
+ for(String paramName : regexInfo.keySet())
+ {
+ int group = regexInfo.get(paramName);
+ this.parameterBinding.registerRegexGroupForParam(group, paramName);
+ }
}
+
+ public ParameterBinding getParameterBinding() {
+ return parameterBinding;
+ }
+
+ public Method getInvocationTarget() {
+ return invocationTarget;
+ }
+
+ public OperationBinding getOperationBinding()
+ {
+ return new OperationBinding(this.invocationTarget);
+ }
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -118,9 +118,8 @@
// subresource locator
if(null == resourceMethod)
{
- // locator
ResourceModel subResource = new ResourceModel(resource, uri.value(), method.getReturnType());
- ResourceLocator locator = new ResourceLocator(subResource);
+ ResourceLocator locator = new ResourceLocator(method, subResource);
locator.freeze();
resource.addSubResourceLocator(locator);
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceResolver.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -25,10 +25,7 @@
import org.jboss.rs.media.DefaultContentNegotiation;
import org.jboss.rs.runtime.RuntimeContext;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
/**
* Resolves resource methods from {@link org.jboss.rs.runtime.RuntimeContext#getPath()}.<br>
@@ -47,6 +44,8 @@
// pluggable content negotitation
private ContentNegotiation connegPlugin;
+ private Stack<ResourceLocator> visitedLocator = new Stack<ResourceLocator>();
+
/**
* Provides a resolver with the default content negotitation.
*
@@ -105,7 +104,7 @@
/**
* Recursive scan for resource methods.
- * Inspect a resource match for methods and it fails try the locators.
+ * Inspect a resource match for methods and if it fails try the locators.
*
* @param dfsEntry
* @return
@@ -122,27 +121,27 @@
// root didn't match, so recurse locators to find a resource
if(null == resourceMethod)
{
- ResourceMatch subResource = resolveByLocator(dfsEntry);
+ ResourceMatch<ResourceModel> subResource = resolveByLocator(dfsEntry);
if(subResource!=null)
- resourceMethod = dfsResourceMatch(subResource);
+ resourceMethod = dfsResourceMatch(subResource);
}
return resourceMethod;
}
- private ResourceMatch resolveByLocator(ResourceMatch<ResourceModel> resourceMatch)
+ private ResourceMatch<ResourceModel> resolveByLocator(ResourceMatch<ResourceModel> resourceMatch)
throws NoResourceException
{
- ResourceMatch match = null;
+ ResourceMatch<ResourceModel> match = null;
- List<ResourceMatch> weightedResults = new ArrayList<ResourceMatch>();
+ List<ResourceMatch<ResourceModel>> weightedResults = new ArrayList<ResourceMatch<ResourceModel>>();
Iterator<ResourceLocator> locators = resourceMatch.model.getResourceLocator().iterator();
while(locators.hasNext())
{
ResourceLocator bridge = locators.next();
RegexQualifier qualifier = bridge.resolve(resourceMatch.qualifier.nextUriToken);
if(qualifier!=null)
- weightedResults.add( new ResourceMatch( bridge.field(), qualifier) );
+ weightedResults.add( new ResourceMatch<ResourceModel>( bridge.field(), qualifier) );
}
if(!weightedResults.isEmpty())
@@ -151,6 +150,14 @@
match = weightedResults.get(0);
}
+ // TODO: cleanup locator matching after sort
+ for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
+ {
+ if(match.model == loc.field())
+ visitedLocator.add(0, loc);
+
+ }
+
return match;
}
@@ -205,4 +212,8 @@
return connegPlugin.match(context, matches);
}
+
+ public Stack<ResourceLocator> getVisitedLocator() {
+ return visitedLocator;
+ }
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/DefaultInvocationHandler.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/DefaultInvocationHandler.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/DefaultInvocationHandler.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -32,7 +32,9 @@
{
try
{
- Object targetInstance = invocation.getTargetBean().newInstance();
+ Object targetInstance = invocation.getTargetInstance() == null ?
+ invocation.getTargetBean().newInstance() :
+ invocation.getTargetInstance();
Object result;
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/Invocation.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -45,7 +45,9 @@
// invocation metadata about the bean
private Class targetBean;
-
+
+ private Object targetInstance;
+
public Invocation(RuntimeContext context)
{
this.context = context;
@@ -97,4 +99,12 @@
{
return targetBean;
}
+
+ public Object getTargetInstance() {
+ return targetInstance;
+ }
+
+ public void setTargetInstance(Object targetInstance) {
+ this.targetInstance = targetInstance;
+ }
}
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/PresetInvocationTarget.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/PresetInvocationTarget.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/PresetInvocationTarget.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -0,0 +1,17 @@
+package org.jboss.rs.runtime;
+
+public class PresetInvocationTarget implements InvocationModel
+{
+ private Object invocationInstance;
+
+
+ public PresetInvocationTarget(Object invocationInstance) {
+ assert invocationInstance!=null;
+ this.invocationInstance = invocationInstance;
+ }
+
+ public void accept(Invocation invocation) {
+
+ invocation.setTargetInstance(invocationInstance);
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/PresetInvocationTarget.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -31,6 +31,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import java.util.Stack;
/**
* @author Heiko.Braun(a)jboss.com
@@ -102,6 +103,7 @@
public void parseAcceptHeader(String headerValue)
{
+ assert headerValue!=null;
consumeMimeTypes.addAll( Convert.mimeStringToMimeTypes(headerValue) );
}
@@ -145,6 +147,4 @@
{
return path;
}
-
-
}
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -24,6 +24,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.UriParam;
import javax.ws.rs.UriTemplate;
+import javax.ws.rs.ProduceMime;
/**
* @author Heiko.Braun(a)jboss.com
@@ -31,9 +32,8 @@
*/
public class Widget
{
- String id;
+ String id = "";
-
public Widget() {
}
@@ -43,13 +43,20 @@
}
@GET
+ @UriTemplate("id")
+ @ProduceMime("text/plain")
+ public String getId() {
+ return this.id;
+ }
+
+ @GET
@UriTemplate("spec")
public Specification[] getSpecification() {
return new Specification[]{ new Specification() };
}
@GET
- @UriTemplate("spec/{name}")
+ @UriTemplate("spec/{name}")
public Specification getSpecByName(@UriParam("name")String name)
{
return new Specification(name);
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DeploymentTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DeploymentTestCase.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DeploymentTestCase.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -27,6 +27,7 @@
import java.net.URL;
import java.net.URLConnection;
+import java.net.HttpURLConnection;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -42,7 +43,10 @@
return new JBossWSTestSetup(DeploymentTestCase.class, "jbossrs-deployment.war");
}
-
+ /**
+ * Invoke a root resource
+ * @throws Exception
+ */
public void testRequest1() throws Exception
{
URL url = new URL("http://localhost:8080/jbossrs-deployment/widgets");
@@ -51,10 +55,24 @@
assertEquals("A widgetlist", response);
}
+ /**
+ * Invoke a subresource
+ *
+ * @throws Exception
+ */
+ public void testRequest2() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/jbossrs-deployment/widgets/123/id");
+ String response = doTextPlainRequest(url, null);
+ assertNotNull(response);
+ assertEquals("123", response);
+ }
+
private String doTextPlainRequest(URL url, String data) throws Exception
{
- URLConnection conn = url.openConnection();
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput( data!=null );
+ conn.setRequestProperty("accept", "text/*");
if(data !=null)
{
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -58,7 +58,7 @@
public void testUriParamBinding() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/Foo/spec/Bar");
+ URI uri = new URI("/rest/widgets/Foo/spec/Bar");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
ResourceResolver resolver = ResourceResolver.newInstance(context);
@@ -81,7 +81,7 @@
public void testHttpContextParamBinding() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/special");
+ URI uri = new URI("/rest/widgets/special");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
context.parseContentTypeHeader("text/xml");
ResourceResolver resolver = ResourceResolver.newInstance(context);
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-19 12:52:37 UTC (rev 5065)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-19 15:23:28 UTC (rev 5066)
@@ -55,7 +55,7 @@
public void testRegexResolver1() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/Id/spec");
+ URI uri = new URI("/rest/widgets/Id/spec");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
ResourceResolver resolver = ResourceResolver.newInstance(context);
ResourceMethod method = resolver.resolve();
@@ -66,7 +66,7 @@
public void testRegexResolver2() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/special");
+ URI uri = new URI("/rest/widgets/special");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
context.parseContentTypeHeader("text/xml");
@@ -80,7 +80,7 @@
public void testRegexResolver3() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/offers");
+ URI uri = new URI("/rest/widgets/offers");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
ResourceResolver resolver = ResourceResolver.newInstance(context);
@@ -92,7 +92,7 @@
public void testRegexResolver4() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets/Id/spec/SpecName");
+ URI uri = new URI("/rest/widgets/Id/spec/SpecName");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
ResourceResolver resolver = ResourceResolver.newInstance(context);
@@ -104,7 +104,7 @@
public void testRegexResolver5() throws Exception
{
- URI uri = new URI("http://jboss.com/widgets");
+ URI uri = new URI("/rest/widgets");
RuntimeContext context = defaultRuntimeContext(MethodHTTP.GET, uri);
context.parseAcceptHeader("text/plain");
@@ -120,7 +120,7 @@
private RuntimeContext defaultRuntimeContext(MethodHTTP method, URI uri)
{
RuntimeContext context = new RuntimeContext(method, uri, rootModels );
- context.parseAcceptHeader("*/*");
+ context.parseAcceptHeader("text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
return context;
}
16 years, 6 months
JBossWS SVN: r5065 - in stack/native/trunk: src/test/resources/benchmark/jaxws and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-19 07:52:37 -0500 (Mon, 19 Nov 2007)
New Revision: 5065
Added:
stack/native/trunk/src/test/resources/benchmark/jaxws/esb/
stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/
stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/deployment.xml
stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/jboss-esb.xml
stack/native/trunk/src/test/resources/benchmark/jaxws/esb/jbm-queue-service.xml
stack/native/trunk/src/test/resources/benchmark/jmeter/JBossWS_ESB_Benchmark.jmx
Modified:
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
Log:
Added ESB benchmark deployment artifacts
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-11-19 10:39:55 UTC (rev 5064)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-11-19 12:52:37 UTC (rev 5065)
@@ -55,7 +55,21 @@
<include name="sun-jaxws.xml"/>
</webinf>
</war>
+
+ <!-- esb adoption -->
+ <jar jarfile="${tests.output.dir}/libs/jaxws-benchmark-doclit.esb">
+ <metainf dir="${tests.output.dir}/resources/benchmark/jaxws/esb/META-INF">
+ <include name="*.xml"/>
+ </metainf>
+ <fileset dir="${tests.output.dir}/libs">
+ <include name="jaxws-benchmark-doclit.war"/>
+ </fileset>
+ <fileset dir="${tests.output.dir}/resources/benchmark/jaxws/esb">
+ <include name="*.xml"/>
+ </fileset>
+ </jar>
+
<!-- jaxws-binding -->
<war warfile="${tests.output.dir}/libs/jaxws-binding.war" webxml="${tests.output.dir}/resources/jaxws/binding/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
Added: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/deployment.xml
===================================================================
--- stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/deployment.xml (rev 0)
+++ stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/deployment.xml 2007-11-19 12:52:37 UTC (rev 5065)
@@ -0,0 +1,7 @@
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=soap.esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_gw</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_esb_reply
+ </depends>
+</jbossesb-deployment>
Property changes on: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/deployment.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/jboss-esb.xml
===================================================================
--- stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/jboss-esb.xml (rev 0)
+++ stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/jboss-esb.xml 2007-11-19 12:52:37 UTC (rev 5065)
@@ -0,0 +1,60 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..."
+ parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost">
+
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/ws_benchmark_gw"/>
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/ws_benchmark_esb"/>
+ </jms-bus>
+ </jms-provider>
+
+ <jbr-provider name="JBR-Http" protocol="http" host="localhost">
+ <jbr-bus busid="Http-1" port="9090" />
+ </jbr-provider>
+
+ <jbr-provider name="JBR-Socket" protocol="socket" host="localhost">
+ <jbr-bus busid="Socket-1" port="9091" />
+ </jbr-provider>
+
+ </providers>
+
+ <services>
+
+ <service category="WSBenchmarkCategory" name="WSBenchmarkDoclitService" description="WS Frontend speaks natively to the ESB">
+
+ <listeners>
+ <jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" is-gateway="true" maxThreads="50"/>
+ <jbr-listener name="Http-Gateway" busidref="Http-1" is-gateway="true" maxThreads="1">
+ <property name="jbr-maxPoolSize" value="1"/>
+ </jbr-listener>
+
+ <jbr-listener name="Socket-Gateway" busidref="Socket-1" is-gateway="true" maxThreads="1"/>
+
+ <jms-listener name="JMS-ESBListener" busidref="quickstartEsbChannel" maxThreads="1"/>
+ </listeners>
+ <actions>
+ <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message"
+ value="[JBossWS-Benchmark] BEFORE invoking jbossws endpoint"/>
+ </action>
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
+ <property name="jbossws-endpoint" value="Endpoint"/>
+ </action>
+ <action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message"
+ value="[JBossWS-Benchmark] AFTER invoking jbossws endpoint"/>
+ </action>
+ </actions>
+ </service>
+
+ </services>
+
+</jbossesb>
Property changes on: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/META-INF/jboss-esb.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/jbm-queue-service.xml
===================================================================
--- stack/native/trunk/src/test/resources/benchmark/jaxws/esb/jbm-queue-service.xml (rev 0)
+++ stack/native/trunk/src/test/resources/benchmark/jaxws/esb/jbm-queue-service.xml 2007-11-19 12:52:37 UTC (rev 5065)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=ws_benchmark_esb_reply"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Property changes on: stack/native/trunk/src/test/resources/benchmark/jaxws/esb/jbm-queue-service.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/benchmark/jmeter/JBossWS_ESB_Benchmark.jmx
===================================================================
--- stack/native/trunk/src/test/resources/benchmark/jmeter/JBossWS_ESB_Benchmark.jmx (rev 0)
+++ stack/native/trunk/src/test/resources/benchmark/jmeter/JBossWS_ESB_Benchmark.jmx 2007-11-19 12:52:37 UTC (rev 5065)
@@ -0,0 +1,610 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="1.8">
+ <hashTree>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="JBossWS_ESB_Benchmark" enabled="true">
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="host" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">localhost</stringProp>
+ <stringProp name="Argument.name">host</stringProp>
+ </elementProp>
+ <elementProp name="port" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">9090</stringProp>
+ <stringProp name="Argument.name">port</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
+ <stringProp name="TestPlan.comments"></stringProp>
+ </TestPlan>
+ <hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Model1_JAXWS" enabled="true">
+ <longProp name="ThreadGroup.start_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">10</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2000</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="false">
+ <stringProp name="delimiter">,</stringProp>
+ <stringProp name="variableNames">NumItems,OrderId</stringProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="filename">csvdata.txt</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ </CSVDataSet>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="Model1_JAXWS" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:getOrder xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <int_1>1</int_1>
+ <int_2>1</int_2>
+ </ns1:getOrder>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://${host}:${port}</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="DOC1.2" enabled="false">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:getOrder xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <int_1>1</int_1>
+ <int_2>1</int_2>
+ </ns1:getOrder>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/benchmark-doc-ejb</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="49586">200</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Envelope Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="-1984138256">Envelope</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Model2_JAXWS" enabled="false">
+ <longProp name="ThreadGroup.start_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">10</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2000</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="false">
+ <stringProp name="delimiter">,</stringProp>
+ <stringProp name="variableNames">NumItems,OrderId</stringProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="filename">csvdata.txt</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ </CSVDataSet>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="Model2_JAXWS" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:getOrder xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <int_1>25</int_1>
+ <int_2>1</int_2>
+ </ns1:getOrder>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://${host}:${port}/jaxws-benchmark-doclit/jse</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="DOC1.2" enabled="false">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:getOrder xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <int_1>1</int_1>
+ <int_2>1</int_2>
+ </ns1:getOrder>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/benchmark-doc-ejb</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="49586">200</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Envelope Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="-1984138256">Envelope</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Model3-JAXWS" enabled="false">
+ <longProp name="ThreadGroup.start_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">10</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2000</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="Model3-JAXWS" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoSimpleType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <SimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </SimpleUserType_1>
+ </ns1:echoSimpleType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://${host}:${port}/jaxws-benchmark-doclit/jse</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="DOC3.2" enabled="false">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoSimpleType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <SimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </SimpleUserType_1>
+ </ns1:echoSimpleType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/benchmark-doc-ejb</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="49586">200</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Envelope Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="-1984138256">Envelope</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Model4-JAXWS" enabled="false">
+ <longProp name="ThreadGroup.start_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">10</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2000</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="Model4-JAXWS" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoSimpleType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <SimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </SimpleUserType_1>
+ </ns1:echoSimpleType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://${host}:${port}/jaxws-benchmark-doclit/jseHandler</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="DOC3.2" enabled="false">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoSimpleType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <SimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </SimpleUserType_1>
+ </ns1:echoSimpleType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/benchmark-doc-ejb</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="49586">200</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Envelope Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="-1984138256">Envelope</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Model5-JAXWS" enabled="false">
+ <longProp name="ThreadGroup.start_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">10</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2000</stringProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1144146988000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="Model5-JAXWS" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoArrayOfSimpleUserType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <arrayOfSimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </arrayOfSimpleUserType_1>
+ </ns1:echoArrayOfSimpleUserType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/jaxws-benchmark-doclit/jse</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="DOC2.2" enabled="false">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
+ <stringProp name="SoapSampler.xml_data_file"></stringProp>
+ <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
+ <stringProp name="HTTPSamper.xml_data"><env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
+ <env:Header/>
+ <env:Body>
+ <ns1:echoArrayOfSimpleUserType xmlns:ns1='http://org.jboss.ws/benchmark/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <arrayOfSimpleUserType_1>
+ <f>1.0</f>
+ <i>1</i>
+ <s>test</s>
+ </arrayOfSimpleUserType_1>
+ </ns1:echoArrayOfSimpleUserType>
+ </env:Body>
+</env:Envelope></stringProp>
+ <stringProp name="SoapSampler.URL_DATA">http://localhost:8080/benchmark-doc-ejb</stringProp>
+ </SoapSampler>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="49586">200</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Envelope Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="-1984138256">Envelope</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <stringProp name="Assertion.assume_success">false</stringProp>
+ <intProp name="Assertion.test_type">2</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>false</success>
+ <label>true</label>
+ <code>false</code>
+ <message>true</message>
+ <threadName>false</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>true</samplerData>
+ <xml>false</xml>
+ <fieldNames>true</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ <threadCounts>true</threadCounts>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ </hashTree>
+</jmeterTestPlan>
16 years, 6 months
JBossWS SVN: r5064 - in stack/native/trunk/src/test/resources/jaxws/jbws1762: META-INF/exploded and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-19 05:39:55 -0500 (Mon, 19 Nov 2007)
New Revision: 5064
Modified:
stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/exploded/application.xml
stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/jboss-service.xml
stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/packaged/application.xml
stack/native/trunk/src/test/resources/jaxws/jbws1762/WEB-INF/web.xml
Log:
Sync jbws-1762 resources with branch 2.0.2
Modified: stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/exploded/application.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/exploded/application.xml 2007-11-19 09:02:45 UTC (rev 5063)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/exploded/application.xml 2007-11-19 10:39:55 UTC (rev 5064)
@@ -1,15 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
+
<module>
<ejb>jaxws-jbws1762-exploded.jar</ejb>
</module>
+
<module>
<web>
<web-uri>jaxws-jbws1762-exploded.war</web-uri>
<context-root>jaxws-jbws1762</context-root>
</web>
</module>
+
</application>
Modified: stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/jboss-service.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/jboss-service.xml 2007-11-19 09:02:45 UTC (rev 5063)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/jboss-service.xml 2007-11-19 10:39:55 UTC (rev 5064)
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<server>
</server>
\ No newline at end of file
Modified: stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/packaged/application.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/packaged/application.xml 2007-11-19 09:02:45 UTC (rev 5063)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1762/META-INF/packaged/application.xml 2007-11-19 10:39:55 UTC (rev 5064)
@@ -1,15 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
+
<module>
<ejb>jaxws-jbws1762-packaged.jar</ejb>
</module>
+
<module>
<web>
<web-uri>jaxws-jbws1762-packaged.war</web-uri>
<context-root>jaxws-jbws1762</context-root>
</web>
</module>
+
</application>
Modified: stack/native/trunk/src/test/resources/jaxws/jbws1762/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1762/WEB-INF/web.xml 2007-11-19 09:02:45 UTC (rev 5063)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1762/WEB-INF/web.xml 2007-11-19 10:39:55 UTC (rev 5064)
@@ -1,39 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-
- <!--
- Rewriting the web.xml produces the following web.xml from the one listed below.
- The *JSEDeployerHook's cannot identify those and thus reject the deployment.
- -->
-
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
<servlet>
<servlet-name>POJOBean</servlet-name>
- <servlet-class>org.jboss.wsf.stack.jbws.EndpointServlet</servlet-class>
- <init-param>
- <param-name>jboss.ws.endpoint</param-name>
- <param-value>org.jboss.test.ws.jaxws.jbws1762.services.POJOBean</param-value>
- </init-param>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws1762.services.POJOBean</servlet-class>
</servlet>
+
<servlet-mapping>
<servlet-name>POJOBean</servlet-name>
<url-pattern>/POJOBean</url-pattern>
</servlet-mapping>
-</web-app>
-<!--web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
- <servlet>
- <servlet-name>POJOBean</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.jbws1762.services.POJOBean</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>POJOBean</servlet-name>
- <url-pattern>/POJOBean</url-pattern>
- </servlet-mapping>
-</web-app-->
+</web-app>
16 years, 6 months
JBossWS SVN: r5063 - framework/trunk/src/test/ant-import.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-19 04:02:45 -0500 (Mon, 19 Nov 2007)
New Revision: 5063
Modified:
framework/trunk/src/test/ant-import/build-testsuite.xml
Log:
Fix ejb3 client launcher classpath
Modified: framework/trunk/src/test/ant-import/build-testsuite.xml
===================================================================
--- framework/trunk/src/test/ant-import/build-testsuite.xml 2007-11-19 09:02:01 UTC (rev 5062)
+++ framework/trunk/src/test/ant-import/build-testsuite.xml 2007-11-19 09:02:45 UTC (rev 5063)
@@ -84,21 +84,21 @@
<!-- ================================================================== -->
<target name="tests-prepare">
-
+
<mkdir dir="${tests.output.dir}/log"/>
<delete file="${tests.output.dir}/log/test.log"/>
-
+
<property name="jboss.client" value="${jboss.home}/client"/>
<property name="jboss.lib" value="${jboss.home}/lib"/>
<property name="jboss.server" value="${jboss.home}/server/${jboss.server.instance}"/>
<property name="jboss.server.lib" value="${jboss.server}/lib"/>
<property name="jboss.server.deploy" value="${jboss.server}/deploy"/>
-
+
<!-- Java Endorsed -->
<condition property="endorsed.dirs" value="${jboss.home}/lib/endorsed">
<isset property="jboss.home"/>
</condition>
-
+
<echo/>
<echo message="-----------------------------------------------"/>
<echo message="jboss.home = ${jboss.home}"/>
@@ -124,12 +124,13 @@
<pathelement location="${jboss.client}/jboss-annotations-ejb3.jar"/>
<pathelement location="${jboss.client}/jboss-common-core.jar"/>
<pathelement location="${jboss.client}/jboss-ejb3-client.jar"/>
+ <pathelement location="${jboss.client}/jboss-ejb3-ext-api.jar"/>
<pathelement location="${jboss.client}/jboss-logging-spi.jar"/>
<pathelement location="${jboss.client}/jboss-metadata.jar"/>
<pathelement location="${jboss.client}/jboss-remoting.jar"/>
<pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
<pathelement location="${jboss.client}/mail.jar"/>
- <pathelement location="${jboss.client}/wsdl4j.jar"/>
+ <pathelement location="${jboss.client}/wsdl4j.jar"/>
<pathelement location="${jboss.server.lib}/jboss-javaee.jar"/>
<pathelement location="${jboss.server.lib}/jbosssx.jar"/>
<pathelement location="${jboss.server.lib}/servlet-api.jar"/>
@@ -150,6 +151,8 @@
<pathelement location="${jboss.client}/jaxb-api.jar"/>
<pathelement location="${jboss.client}/jaxb-impl.jar"/>
<pathelement location="${jboss.client}/jaxb-xjc.jar"/>
+ <pathelement location="${jboss.client}/jboss-container-metadata.jar"/>
+ <pathelement location="${jboss.client}/jboss-ejb3-ext-api.jar"/>
<pathelement location="${jboss.client}/jboss-metadata.jar"/>
<pathelement location="${jboss.client}/jboss-remoting.jar"/>
<pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
16 years, 6 months