Author: jharting
Date: 2010-02-11 08:28:14 -0500 (Thu, 11 Feb 2010)
New Revision: 12038
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/resources/WEB-INF/components.xml
branches/enterprise/JBPAPP_5_0/examples/restbay/resources/log4j.xml
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/SecuredResource.java
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/eventcomponent/EventComponentTestResource.java
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/BasicServiceTest.java
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/SecurityTest.java
Log:
JBPAPP-3713 tests
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/resources/WEB-INF/components.xml
===================================================================
---
branches/enterprise/JBPAPP_5_0/examples/restbay/resources/WEB-INF/components.xml 2010-02-11
12:58:29 UTC (rev 12037)
+++
branches/enterprise/JBPAPP_5_0/examples/restbay/resources/WEB-INF/components.xml 2010-02-11
13:28:14 UTC (rev 12038)
@@ -8,6 +8,7 @@
xmlns:web="http://jboss.com/products/seam/web"
xmlns:resteasy="http://jboss.com/products/seam/resteasy"
xmlns:framework="http://jboss.com/products/seam/framework"
+
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-2.2.xsd
@@ -18,6 +19,7 @@
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.2.xsd
http://jboss.com/products/seam/resteasy
http://jboss.com/products/seam/resteasy-2.2.xsd
http://jboss.com/products/seam/framework
http://jboss.com/products/seam/framework-2.2.xsd
+
http://jboss.com/products/seam/transaction
http://jboss.com/products/seam/transaction-2.2.xsd
http://jboss.com/products/seam/drools
http://jboss.com/products/seam/drools-2.2.xsd">
<core:init jndi-pattern="@jndiPattern@" debug="true"/>
@@ -25,6 +27,8 @@
<core:manager conversation-timeout="120000"
concurrent-request-timeout="500"
conversation-id-parameter="cid"/>
+
+ <transaction:ejb-transaction />
<persistence:managed-persistence-context name="entityManager"
auto-create="true"
persistence-unit-jndi-name="java:/restbayEntityManagerFactory"/>
Modified: branches/enterprise/JBPAPP_5_0/examples/restbay/resources/log4j.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/restbay/resources/log4j.xml 2010-02-11
12:58:29 UTC (rev 12037)
+++ branches/enterprise/JBPAPP_5_0/examples/restbay/resources/log4j.xml 2010-02-11
13:28:14 UTC (rev 12038)
@@ -54,7 +54,7 @@
<!-- ############### Seam logging ################### -->
<category name="org.jboss.seam">
- <priority value="ERROR"/>
+ <priority value="WARN"/>
</category>
<category name="org.jboss.seam.resteasy">
@@ -63,7 +63,7 @@
<!-- Seam logs exceptions as WARN and re-throws them, switch to ERROR level
-->
<category name="org.jboss.seam.web.ExceptionFilter">
- <priority value="ERROR"/>
+ <priority value="INFO"/>
</category>
<!-- These things are too noisy
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/SecuredResource.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/SecuredResource.java 2010-02-11
12:58:29 UTC (rev 12037)
+++
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/SecuredResource.java 2010-02-11
13:28:14 UTC (rev 12038)
@@ -4,10 +4,13 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.security.Identity;
+import org.jboss.seam.transaction.Synchronizations;
/**
*
@@ -43,4 +46,20 @@
return identity.hasRole("admin");
}
+ @GET
+ @Path("/synchronizationsLookup")
+ public boolean synchronizationsLookup()
+ {
+ Synchronizations ejb = (Synchronizations)
Component.getInstance("org.jboss.seam.transaction.synchronizations",
ScopeType.EVENT);
+ return ejb.isAwareOfContainerTransactions();
+ }
+
+ @GET
+ @Path("/ejbLookup")
+ public boolean ejbLookup()
+ {
+ TestEjbLocal ejb = (TestEjbLocal) Component.getInstance("securedEjb",
ScopeType.EVENT);
+ return ejb.foo();
+ }
+
}
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/eventcomponent/EventComponentTestResource.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/eventcomponent/EventComponentTestResource.java 2010-02-11
12:58:29 UTC (rev 12037)
+++
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/eventcomponent/EventComponentTestResource.java 2010-02-11
13:28:14 UTC (rev 12038)
@@ -1,12 +1,15 @@
package org.jboss.seam.example.restbay.resteasy.eventcomponent;
import org.jboss.resteasy.annotations.Form;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.In;
import org.jboss.seam.example.restbay.resteasy.TestResource;
import org.jboss.seam.example.restbay.resteasy.TestComponent;
import org.jboss.seam.example.restbay.resteasy.TestForm;
import org.jboss.seam.example.restbay.resteasy.SubResource;
+import org.jboss.seam.transaction.Synchronizations;
import javax.ws.rs.Consumes;
import javax.ws.rs.CookieParam;
@@ -156,4 +159,12 @@
{
return super.getCommaSeparatedIntegers();
}
+
+ @GET
+ @Path("/synchronizationsLookup")
+ public boolean synchronizationsLookup()
+ {
+ Synchronizations ejb = (Synchronizations)
Component.getInstance("org.jboss.seam.transaction.synchronizations",
ScopeType.EVENT);
+ return ejb.isAwareOfContainerTransactions();
+ }
}
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/BasicServiceTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/BasicServiceTest.java 2010-02-11
12:58:29 UTC (rev 12037)
+++
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/BasicServiceTest.java 2010-02-11
13:28:14 UTC (rev 12038)
@@ -404,4 +404,26 @@
// TODO: Retracted support for Seam component providers, injection shouldn't
happen, see
https://jira.jboss.org/jira/browse/JBSEAM-4247
}
+
+ @Test
+ // JBPAPP-3713
+ public void synchronizationsLookup() throws Exception
+ {
+ new ResourceRequest(requestEnv, Method.GET,
"/restv1/eventComponentTest/synchronizationsLookup")
+ {
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 200, "Unexpected response
code.");
+ assert response.getContentAsString().equals("true");
+ }
+
+ }.run();
+ }
}
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/SecurityTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/SecurityTest.java 2010-02-11
12:58:29 UTC (rev 12037)
+++
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/test/SecurityTest.java 2010-02-11
13:28:14 UTC (rev 12038)
@@ -159,5 +159,52 @@
}.run();
}
-
+
+ @Test
+ // JBPAPP-3713
+ public void ejbLookup() throws Exception
+ {
+ new ResourceRequest(requestEnv, Method.GET, "/restv1/secured/ejbLookup")
+ {
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "text/plain");
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v");
// demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 200, "Unexpected response
code.");
+ assert response.getContentAsString().equals("true");
+ }
+
+ }.run();
+ }
+
+ @Test
+ // JBPAPP-3713
+ public void synchronizationsLookup() throws Exception
+ {
+ new ResourceRequest(requestEnv, Method.GET,
"/restv1/secured/synchronizationsLookup")
+ {
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "text/plain");
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v");
// demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 200, "Unexpected response
code.");
+ assert response.getContentAsString().equals("true");
+ }
+
+ }.run();
+ }
}