Author: andygumbrecht
Date: Mon Dec 17 16:21:41 2012
New Revision: 1423006
URL: http://svn.apache.org/viewvc?rev=1423006&view=rev
Log:
Fix
Modified:
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/requestdispose/ServletDisposeRequestScopeTest.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
openejb/trunk/openejb/examples/groovy-spock/pom.xml
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/GlobalListenerSupport.java
Modified:
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
(original)
+++
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
Mon Dec 17 16:21:41 2012
@@ -73,9 +73,16 @@ public class EarTest {
@Test
public void test() throws Exception {
- System.out.println(url);
final URL servlet = new URL(url, "/red/green/blue");
+
+// boolean bob = true;
+//
+// while(bob){
+// Thread.sleep(1000);
+// }
+
+ System.out.println(servlet.toExternalForm());
final String slurp = IO.slurp(servlet);
Assert.assertEquals(Test.class.getName(), slurp);
System.out.println(slurp);
Modified:
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/requestdispose/ServletDisposeRequestScopeTest.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/requestdispose/ServletDisposeRequestScopeTest.java?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/requestdispose/ServletDisposeRequestScopeTest.java
(original)
+++
openejb/trunk/openejb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/requestdispose/ServletDisposeRequestScopeTest.java
Mon Dec 17 16:21:41 2012
@@ -65,7 +65,7 @@ public class ServletDisposeRequestScopeT
final ByteArrayOutputStream os = new ByteArrayOutputStream();
int bytesRead;
- byte[] buffer = new byte[512];
+ final byte[] buffer = new byte[512];
while ((bytesRead = is.read(buffer)) > -1) {
os.write(buffer, 0, bytesRead);
}
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
Mon Dec 17 16:21:41 2012
@@ -66,7 +66,7 @@ public interface DeploymentModule {
*/
private final Set<String> locations = new LinkedHashSet<String>();
- public ID(NamedModule vendorDd, NamedModule specDd, String name, File
location, URI uri, DeploymentModule module) {
+ public ID(final NamedModule vendorDd, final NamedModule specDd, final
String name, final File location, final URI uri, final DeploymentModule module)
{
this.name = name(vendorDd, specDd, uri, location, name, module);
this.location = location(location, uri);
this.uri = uri(uri, location, this.name);
@@ -79,19 +79,19 @@ public interface DeploymentModule {
return locations;
}
- private URI uri(URI uri, File location, String name) {
+ private URI uri(final URI uri, final File location, final String name)
{
if (uri != null) return uri;
if (location != null) return location.toURI();
return URI.create(name);
}
- private File location(File location, URI uri) {
+ private File location(final File location, final URI uri) {
if (location != null) return location;
if (uri != null && uri.isAbsolute()) return new File(uri);
return null;
}
- private String name(NamedModule vendor, NamedModule spec, URI uri,
File location, String name, DeploymentModule module) {
+ private String name(final NamedModule vendor, final NamedModule spec,
final URI uri, final File location, final String name, final DeploymentModule
module) {
if (location != null) {
final String systPropName =
SystemInstance.get().getOptions().get(location.getName() + ".moduleId",
(String) null);
if (systPropName != null) {
@@ -117,7 +117,7 @@ public interface DeploymentModule {
}
private String moduleName(File location) {
- List<String> invalid = new ArrayList<String>();
+ final List<String> invalid = new ArrayList<String>();
invalid.add("classes");
invalid.add("test-classes");
invalid.add("target");
@@ -131,9 +131,9 @@ public interface DeploymentModule {
return stripExtension(location.getName());
}
- private String stripExtension(String name) {
- String[] exts = {".jar", ".zip", ".ear", ".war", ".rar",
".unpacked"};
- for (String ext : exts) {
+ private String stripExtension(final String name) {
+ final String[] exts = {".jar", ".zip", ".ear", ".war", ".rar",
".unpacked"};
+ for (final String ext : exts) {
if (name.endsWith(ext)) {
return name.substring(0, name.length() - ext.length());
}
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
Mon Dec 17 16:21:41 2012
@@ -38,6 +38,7 @@ import java.util.TreeSet;
* @version $Rev$ $Date$
*/
public class WebModule extends Module implements WsModule, RESTModule {
+
private final ValidationContext validation;
private WebApp webApp;
@@ -57,21 +58,23 @@ public class WebModule extends Module im
private final Map<String, Set<String>> jsfAnnotatedClasses = new
HashMap<String, Set<String>>();
private final Map<String, Set<String>> webAnnotatedClasses = new
HashMap<String, Set<String>>();
- private ID id;
+ private final ID id;
// keep the list of filtered URL we got after applying include/exclude
pattern (@See DeploymentsResolver.loadFromClasspath)
private List<URL> urls;
private List<URL> scannableUrls;
- public WebModule(WebApp webApp, String contextRoot, ClassLoader
classLoader, String jarLocation, String moduleId) {
+ public WebModule(final WebApp webApp, String contextRoot, final
ClassLoader classLoader, final String jarLocation, final String moduleId) {
this.webApp = webApp;
- File file = (jarLocation == null) ? null : new File(jarLocation);
+ final File file = (jarLocation == null) ? null : new File(jarLocation);
this.id = new ID(null, webApp, moduleId, file, null, this);
this.validation = new ValidationContext(this);
if (contextRoot == null) {
- contextRoot =
jarLocation.substring(jarLocation.lastIndexOf(System.getProperty("file.separator")));
+
+ contextRoot = null != jarLocation ?
jarLocation.substring(jarLocation.lastIndexOf(File.separator)) : ".";
+
if (contextRoot.endsWith(".unpacked")) {
contextRoot = contextRoot.substring(0, contextRoot.length() -
".unpacked".length());
}
@@ -79,27 +82,41 @@ public class WebModule extends Module im
contextRoot = contextRoot.substring(0, contextRoot.length() -
".war".length());
}
}
- if (contextRoot.startsWith("/")) contextRoot =
contextRoot.substring(1);
+
+ while (contextRoot.startsWith("/")) {
+ contextRoot = contextRoot.substring(1);
+ }
+
+ while (contextRoot.startsWith("\\")) {
+ contextRoot = contextRoot.substring(1);
+ }
+
this.contextRoot = contextRoot;
setClassLoader(classLoader);
- if (webApp != null) webApp.setContextRoot(contextRoot);
+ if (webApp != null) {
+ webApp.setContextRoot(contextRoot);
+ }
host = SystemInstance.get().getProperty(id.getName() + ".host",
(String) null);
}
+ @Override
public String getJarLocation() {
return (id.getLocation() != null) ? id.getLocation().getAbsolutePath()
: null;
}
+ @Override
public String getModuleId() {
return id.getName();
}
+ @Override
public File getFile() {
return id.getLocation();
}
+ @Override
public URI getModuleUri() {
return id.getUri();
}
@@ -108,7 +125,7 @@ public class WebModule extends Module im
return urls;
}
- public void setUrls(List<URL> urls) {
+ public void setUrls(final List<URL> urls) {
this.urls = urls;
}
@@ -116,10 +133,11 @@ public class WebModule extends Module im
return finder;
}
- public void setFinder(IAnnotationFinder finder) {
+ public void setFinder(final IAnnotationFinder finder) {
this.finder = finder;
}
+ @Override
public ValidationContext getValidation() {
return validation;
}
@@ -128,16 +146,19 @@ public class WebModule extends Module im
return webApp;
}
- public void setWebApp(WebApp webApp) {
+ public void setWebApp(final WebApp webApp) {
this.webApp = webApp;
- if (webApp != null) webApp.setContextRoot(contextRoot);
+ if (webApp != null)
+ webApp.setContextRoot(contextRoot);
}
+ @Override
public Webservices getWebservices() {
return webservices;
}
- public void setWebservices(Webservices webservices) {
+ @Override
+ public void setWebservices(final Webservices webservices) {
this.webservices = webservices;
}
@@ -145,25 +166,25 @@ public class WebModule extends Module im
return contextRoot;
}
- public void setContextRoot(String contextRoot) {
- if (webApp != null) webApp.setContextRoot(contextRoot);
+ public void setContextRoot(final String contextRoot) {
+ if (webApp != null) {
+ webApp.setContextRoot(contextRoot); }
this.contextRoot = contextRoot;
}
-
public String getHost() {
return host;
}
- public void setHost(String host) {
+ public void setHost(final String host) {
this.host = host;
}
-
public List<TldTaglib> getTaglibs() {
return taglibs;
}
+ @Override
public Set<String> getWatchedResources() {
return watchedResources;
}
@@ -175,9 +196,9 @@ public class WebModule extends Module im
@Override
public String toString() {
return "WebModule{" +
- "moduleId='" + id.getName() + '\'' +
- ", contextRoot='" + contextRoot + '\'' +
- '}';
+ "moduleId='" + id.getName() + '\'' +
+ ", contextRoot='" + contextRoot + '\'' +
+ '}';
}
@Override
@@ -204,7 +225,7 @@ public class WebModule extends Module im
return scannableUrls;
}
- public void setScannableUrls(List<URL> scannableUrls) {
+ public void setScannableUrls(final List<URL> scannableUrls) {
this.scannableUrls = scannableUrls;
}
Modified: openejb/trunk/openejb/examples/groovy-spock/pom.xml
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/pom.xml?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/groovy-spock/pom.xml (original)
+++ openejb/trunk/openejb/examples/groovy-spock/pom.xml Mon Dec 17 16:21:41 2012
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
- <version>2.6.0-01</version>
+ <version>2.7.1-01-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
@@ -82,7 +82,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.8.0</version> <!-- spock doesn't work with 2.0.0-rc-4 -->
+ <version>2.0.5</version> <!-- spock doesn't work with 2.0.0-rc-4 -->
</dependency>
<dependency>
@@ -112,7 +112,7 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
- <version>0.6-groovy-1.8</version>
+ <version>0.7-groovy-2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified:
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
(original)
+++
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
Mon Dec 17 16:21:41 2012
@@ -46,6 +46,7 @@ class HelloSpecification extends Specifi
assertNotNull hello
then:
+ println("Compare 'hi' to '" + hello.hi() + "'")
assertEquals "hi", hello.hi()
}
}
Modified:
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/GlobalListenerSupport.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/GlobalListenerSupport.java?rev=1423006&r1=1423005&r2=1423006&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/GlobalListenerSupport.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/GlobalListenerSupport.java
Mon Dec 17 16:21:41 2012
@@ -75,8 +75,10 @@ public class GlobalListenerSupport imple
* @param contextListener context listener instance
*/
public GlobalListenerSupport(StandardServer standardServer,
ContextListener contextListener) {
- if (standardServer == null) throw new
NullPointerException("standardServer is null");
- if (contextListener == null) throw new
NullPointerException("contextListener is null");
+ if (standardServer == null)
+ throw new NullPointerException("standardServer is null");
+ if (contextListener == null)
+ throw new NullPointerException("contextListener is null");
this.standardServer = standardServer;
this.contextListener = contextListener; // this.contextListener is now
an instance of TomcatWebAppBuilder
}
@@ -89,23 +91,23 @@ public class GlobalListenerSupport imple
if (source instanceof StandardContext) {
StandardContext standardContext = (StandardContext) source;
String type = event.getType();
-
+
if (INIT_EVENT.equals(type) ||
Lifecycle.BEFORE_INIT_EVENT.equals(type)) {
- contextListener.init(standardContext);
+ contextListener.init(standardContext);
} else if (Lifecycle.BEFORE_START_EVENT.equals(type)) {
contextListener.beforeStart(standardContext);
} else if (Lifecycle.START_EVENT.equals(type)) {
- if (TomcatHelper.isTomcat7()) {
- standardContext.addParameter("openejb.start.late",
"true");
- }
-
+ if (TomcatHelper.isTomcat7()) {
+ standardContext.addParameter("openejb.start.late", "true");
+ }
+
contextListener.start(standardContext);
} else if (Lifecycle.AFTER_START_EVENT.equals(type)) {
contextListener.afterStart(standardContext);
-
+
if (TomcatHelper.isTomcat7()) {
- standardContext.removeParameter("openejb.start.late");
- }
+ standardContext.removeParameter("openejb.start.late");
+ }
} else if (Lifecycle.BEFORE_STOP_EVENT.equals(type)) {
contextListener.beforeStop(standardContext);
} else if (Lifecycle.STOP_EVENT.equals(type)) {
@@ -117,13 +119,13 @@ public class GlobalListenerSupport imple
} else if (Lifecycle.CONFIGURE_START_EVENT.equals(type)) {
contextListener.configureStart(standardContext);
}
- } else if (source instanceof StandardHost) {
+ } else if (StandardHost.class.isInstance(source)) {
StandardHost standardHost = (StandardHost) source;
String type = event.getType();
if (Lifecycle.PERIODIC_EVENT.equals(type)) {
contextListener.checkHost(standardHost);
}
- } else if (source instanceof StandardServer) {
+ } else if (StandardServer.class.isInstance(source)) {
StandardServer standardServer = (StandardServer) source;
String type = event.getType();
@@ -132,10 +134,10 @@ public class GlobalListenerSupport imple
}
if (Lifecycle.BEFORE_STOP_EVENT.equals(type)) {
- TomcatHelper.setStopping(true);
+ TomcatHelper.setStopping(true);
TomEEClusterListener.stop();
}
-
+
if (Lifecycle.AFTER_STOP_EVENT.equals(type)) {
contextListener.afterStop(standardServer);
}
@@ -161,7 +163,6 @@ public class GlobalListenerSupport imple
standardServer.removePropertyChangeListener(this);
}
-
/**
* Service is added.
*
@@ -233,7 +234,6 @@ public class GlobalListenerSupport imple
}
}
-
/**
* Host is removed.
*
@@ -366,6 +366,7 @@ public class GlobalListenerSupport imple
//Hashmap for monitoring children of engine and host
public static class MoniterableHashMap extends HashMap<Object, Object> {
+
private final Object source;
private final String propertyName;
private final PropertyChangeListener listener;