You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/05/24 03:49:46 UTC
svn commit: r1597233 [2/4] - in /tomee/tomee/trunk: ./
arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/
arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/deployment/
arquillian/arquillian-co...
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java Sat May 24 01:49:45 2014
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.common;
@@ -63,7 +63,7 @@ public class Setup {
System.setProperty("tomee.home", tomeeHome.getAbsolutePath());
}
- public static void updateServerXml(File tomeeHome, TomEEConfiguration configuration) throws IOException {
+ public static void updateServerXml(final File tomeeHome, final TomEEConfiguration configuration) throws IOException {
final File serverXml = Files.path(new File(tomeeHome.getAbsolutePath()), "conf", "server.xml");
if (!serverXml.exists()) {
return;
@@ -116,7 +116,9 @@ public class Setup {
if (null != files) {
for (final File file : files) {
- if (".".equals(file.getName()) || "..".equals(file.getName())) continue;
+ if (".".equals(file.getName()) || "..".equals(file.getName())) {
+ continue;
+ }
final File found = findHome(file);
@@ -146,7 +148,9 @@ public class Setup {
try {
final File artifact = MavenCache.getArtifact(artifactName, altUrl);
- if (artifact == null) throw new NullPointerException(String.format("No such artifact: %s", artifactName));
+ if (artifact == null) {
+ throw new NullPointerException(String.format("No such artifact: %s", artifactName));
+ }
return artifact.getAbsoluteFile();
} finally {
if (cache == null) {
@@ -161,13 +165,13 @@ public class Setup {
socket = new Socket(host, port);
socket.getOutputStream().close();
return true;
- } catch (Exception e) {
+ } catch (final Exception e) {
return false;
} finally {
if (socket != null) {
try {
socket.close();
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
}
@@ -251,7 +255,7 @@ public class Setup {
try {
final Method ajbPort = config.getClass().getMethod("getAjpPort");
return (Integer) ajbPort.invoke(config);
- } catch (Exception e) {
+ } catch (final Exception e) {
return Integer.parseInt(QuickServerXmlParser.DEFAULT_AJP_PORT);
}
}
@@ -265,7 +269,7 @@ public class Setup {
if (file.exists()) {
try {
IO.readProperties(file, properties);
- } catch (IOException e) {
+ } catch (final IOException e) {
LOGGER.log(Level.SEVERE, "Can't read " + file.getAbsolutePath(), e);
}
}
@@ -274,7 +278,7 @@ public class Setup {
try {
final InputStream bytes = IO.read(configuration.getProperties().getBytes());
IO.readProperties(bytes, properties);
- } catch (IOException e) {
+ } catch (final IOException e) {
LOGGER.log(Level.SEVERE, "Can't parse <property name=\"properties\"> value '" + configuration.getProperties() + "'", e);
}
}
@@ -285,7 +289,7 @@ public class Setup {
try {
IO.writeProperties(file, properties);
- } catch (IOException e) {
+ } catch (final IOException e) {
LOGGER.log(Level.SEVERE, "Can't save system properties " + file.getAbsolutePath(), e);
}
}
@@ -298,10 +302,10 @@ public class Setup {
final File conf = new File(tomeeHome, dir);
final Collection<File> files = org.apache.openejb.loader.Files.collect(confSrc, new DirectFileOnlyFilter(confSrc));
files.remove(confSrc);
- for (File f : files) {
+ for (final File f : files) {
try {
org.apache.openejb.loader.IO.copy(f, new File(conf, relativize(f, confSrc)));
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.log(Level.WARNING, "Ignoring copy of " + f.getAbsolutePath(), e);
}
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TestClassDiscoverer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TestClassDiscoverer.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TestClassDiscoverer.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TestClassDiscoverer.java Sat May 24 01:49:45 2014
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.openejb.arquillian.common;
import org.apache.openejb.config.AdditionalBeanDiscoverer;
@@ -61,9 +62,9 @@ public class TestClassDiscoverer impleme
current.getCanonicalName();
current = current.getSuperclass();
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
return module;
- } catch (NoClassDefFoundError ncdfe) {
+ } catch (final NoClassDefFoundError ncdfe) {
return module;
}
@@ -96,7 +97,7 @@ public class TestClassDiscoverer impleme
if (info.exists()) {
try {
is = new FileInputStream(info);
- } catch (FileNotFoundException e) {
+ } catch (final FileNotFoundException e) {
e.printStackTrace();
}
}
@@ -109,7 +110,7 @@ public class TestClassDiscoverer impleme
if (is != null) {
try {
return org.apache.openejb.loader.IO.slurp(is);
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
} finally {
org.apache.openejb.loader.IO.close(is);
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Threads.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Threads.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Threads.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Threads.java Sat May 24 01:49:45 2014
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.common;
@@ -23,14 +23,14 @@ import java.util.concurrent.TimeUnit;
*/
public class Threads {
- public static void sleep(long duration, TimeUnit unit) {
+ public static void sleep(final long duration, final TimeUnit unit) {
sleep(unit.toMillis(duration));
}
- public static void sleep(long milliseconds) {
+ public static void sleep(final long milliseconds) {
try {
Thread.sleep(milliseconds);
- } catch (InterruptedException e1) {
+ } catch (final InterruptedException e1) {
Thread.interrupted();
}
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todo.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todo.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todo.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todo.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -16,19 +16,20 @@
*/
package org.apache.openejb.arquillian.common;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
@Todo("Move this to a util package")
-@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE})
+@Target({
+ ElementType.TYPE,
+ ElementType.FIELD,
+ ElementType.METHOD,
+ ElementType.PARAMETER,
+ ElementType.CONSTRUCTOR,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.ANNOTATION_TYPE,
+ ElementType.PACKAGE
+})
public @interface Todo {
String value();
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todos.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todos.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todos.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Todos.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -16,18 +16,19 @@
*/
package org.apache.openejb.arquillian.common;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE})
+@Target({
+ ElementType.TYPE,
+ ElementType.FIELD,
+ ElementType.METHOD,
+ ElementType.PARAMETER,
+ ElementType.CONSTRUCTOR,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.ANNOTATION_TYPE,
+ ElementType.PACKAGE
+})
public @interface Todos {
Todo[] value();
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -48,7 +48,7 @@ public class TomEEConfiguration implemen
return unpackWars;
}
- public void setUnpackWars(boolean unpackWars) {
+ public void setUnpackWars(final boolean unpackWars) {
this.unpackWars = unpackWars;
}
@@ -56,7 +56,7 @@ public class TomEEConfiguration implemen
return httpPort;
}
- public void setHttpPort(int httpPort) {
+ public void setHttpPort(final int httpPort) {
this.httpPort = httpPort;
}
@@ -64,7 +64,7 @@ public class TomEEConfiguration implemen
return stopPort;
}
- public void setStopPort(int stopPort) {
+ public void setStopPort(final int stopPort) {
this.stopPort = stopPort;
}
@@ -72,7 +72,7 @@ public class TomEEConfiguration implemen
return dir;
}
- public void setDir(String dir) {
+ public void setDir(final String dir) {
this.dir = dir;
}
@@ -80,7 +80,7 @@ public class TomEEConfiguration implemen
return appWorkingDir;
}
- public void setAppWorkingDir(String appWorkingDir) {
+ public void setAppWorkingDir(final String appWorkingDir) {
this.appWorkingDir = appWorkingDir;
}
@@ -91,7 +91,7 @@ public class TomEEConfiguration implemen
return exportConfAsSystemProperty;
}
- public void setExportConfAsSystemProperty(boolean exportConfAsSystemProperty) {
+ public void setExportConfAsSystemProperty(final boolean exportConfAsSystemProperty) {
this.exportConfAsSystemProperty = exportConfAsSystemProperty;
}
@@ -99,7 +99,7 @@ public class TomEEConfiguration implemen
return host;
}
- public void setHost(String host) {
+ public void setHost(final String host) {
this.host = host;
}
@@ -107,7 +107,7 @@ public class TomEEConfiguration implemen
return serverXml;
}
- public void setServerXml(String serverXml) {
+ public void setServerXml(final String serverXml) {
this.serverXml = serverXml;
}
@@ -116,7 +116,7 @@ public class TomEEConfiguration implemen
}
@Multiline
- public void setProperties(String properties) {
+ public void setProperties(final String properties) {
this.properties = properties;
}
@@ -128,7 +128,7 @@ public class TomEEConfiguration implemen
return portRange;
}
- public void setPortRange(String portRange) {
+ public void setPortRange(final String portRange) {
this.portRange = portRange;
}
@@ -136,7 +136,7 @@ public class TomEEConfiguration implemen
return quickSession;
}
- public void setQuickSession(boolean quickSession) {
+ public void setQuickSession(final boolean quickSession) {
this.quickSession = quickSession;
}
@@ -151,8 +151,8 @@ public class TomEEConfiguration implemen
return toInts(value);
}
- protected int[] toInts(List<Integer> values) {
- int[] array = new int[values.size()];
+ protected int[] toInts(final List<Integer> values) {
+ final int[] array = new int[values.size()];
for (int i = 0; i < array.length; i++) {
array[i] = values.get(i);
}
@@ -163,7 +163,7 @@ public class TomEEConfiguration implemen
return stopHost;
}
- public void setStopHost(String stopHost) {
+ public void setStopHost(final String stopHost) {
this.stopHost = stopHost;
}
@@ -171,7 +171,7 @@ public class TomEEConfiguration implemen
return stopCommand + Character.toString((char) 0); // last char to avoid warning/error log message
}
- public void setStopCommand(String stopCommand) {
+ public void setStopCommand(final String stopCommand) {
this.stopCommand = stopCommand;
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -83,12 +83,14 @@ public abstract class TomEEContainer<Con
}
@Override
- public void setup(Configuration configuration) {
+ public void setup(final Configuration configuration) {
this.configuration = configuration;
final Prefixes prefixes = configuration.getClass().getAnnotation(Prefixes.class);
- if (prefixes == null) return;
+ if (prefixes == null) {
+ return;
+ }
final Properties systemProperties = System.getProperties();
ConfigurationOverrides.apply(configuration, systemProperties, prefixes.value());
@@ -101,8 +103,8 @@ public abstract class TomEEContainer<Con
//
// Export the config back out to properties
//
- for (Map.Entry<String, Object> entry : map.entrySet()) {
- for (String prefix : prefixes.value()) {
+ for (final Map.Entry<String, Object> entry : map.entrySet()) {
+ for (final String prefix : prefixes.value()) {
try {
final String property = prefix + "." + entry.getKey();
final String value = entry.getValue().toString();
@@ -110,7 +112,7 @@ public abstract class TomEEContainer<Con
LOGGER.log(Level.FINER, String.format("Exporting '%s=%s'", property, value));
System.setProperty(property, value);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
// value cannot be converted to a string
}
}
@@ -125,16 +127,18 @@ public abstract class TomEEContainer<Con
// Set ports if they are unspecified
//
final Collection<Integer> randomPorts = new ArrayList<Integer>();
- for (int i : configuration.portsAlreadySet()) { // ensure we don't use already initialized port (fixed ones)
+ for (final int i : configuration.portsAlreadySet()) { // ensure we don't use already initialized port (fixed ones)
randomPorts.add(i);
}
final ObjectMap map = new ObjectMap(configuration);
for (final Map.Entry<String, Object> entry : map.entrySet()) {
- if (!entry.getKey().toLowerCase().endsWith("port")) continue;
+ if (!entry.getKey().toLowerCase().endsWith("port")) {
+ continue;
+ }
try {
- Object value = entry.getValue();
- int port = new Integer(value + "");
+ final Object value = entry.getValue();
+ int port = new Integer(String.valueOf(value));
if (port <= 0) {
int retry = 0;
do { // nextPort can in some case returns twice the same port since it doesn't hold the port
@@ -149,7 +153,7 @@ public abstract class TomEEContainer<Con
entry.setValue(port);
randomPorts.add(port);
}
- } catch (NumberFormatException mustNotBeAPortConfig) {
+ } catch (final NumberFormatException mustNotBeAPortConfig) {
// no-op
}
}
@@ -160,7 +164,7 @@ public abstract class TomEEContainer<Con
if (portRange == null || portRange.isEmpty()) {
int retry = 10;
while (retry > 0) {
- int port = NetworkUtil.getNextAvailablePort();
+ final int port = NetworkUtil.getNextAvailablePort();
if (!excluded.contains(port)) {
return port;
}
@@ -170,13 +174,13 @@ public abstract class TomEEContainer<Con
}
if (!portRange.contains("-")) {
- int port = Integer.parseInt(portRange.trim());
+ final int port = Integer.parseInt(portRange.trim());
return NetworkUtil.getNextAvailablePort(new int[]{port});
}
final String[] minMax = portRange.trim().split("-");
- int min = Integer.parseInt(minMax[0]);
- int max = Integer.parseInt(minMax[1]);
+ final int min = Integer.parseInt(minMax[0]);
+ final int max = Integer.parseInt(minMax[1]);
return NetworkUtil.getNextAvailablePort(min, max, excluded);
}
@@ -185,21 +189,21 @@ public abstract class TomEEContainer<Con
@Override
public void stop() throws LifecycleException {
try {
- Socket socket = new Socket(configuration.getStopHost(), configuration.getStopPort());
- OutputStream out = socket.getOutputStream();
+ final Socket socket = new Socket(configuration.getStopHost(), configuration.getStopPort());
+ final OutputStream out = socket.getOutputStream();
out.write((configuration.getStopCommand() + Character.toString((char) 0)).getBytes());
waitForShutdown(socket, 10);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new LifecycleException("Unable to stop TomEE", e);
}
}
- protected void waitForShutdown(Socket socket, int tries) {
+ protected void waitForShutdown(final Socket socket, int tries) {
try {
- OutputStream out = socket.getOutputStream();
+ final OutputStream out = socket.getOutputStream();
out.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
if (tries > 2) {
Threads.sleep(2000);
@@ -209,7 +213,7 @@ public abstract class TomEEContainer<Con
if (socket != null && !socket.isClosed()) {
try {
socket.close();
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
}
@@ -222,8 +226,8 @@ public abstract class TomEEContainer<Con
}
public void addServlets(final HTTPContext httpContext, final AppInfo appInfo) {
- for (WebAppInfo webApps : appInfo.webApps) {
- for (ServletInfo servlet : webApps.servlets) {
+ for (final WebAppInfo webApps : appInfo.webApps) {
+ for (final ServletInfo servlet : webApps.servlets) {
// weird but arquillian url doesn't match the servlet url but its context
String clazz = servlet.servletClass;
if (clazz == null) {
@@ -245,13 +249,13 @@ public abstract class TomEEContainer<Con
}
@Override
- public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
+ public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException {
try {
final File file = dumpFile(archive);
final String fileName = file.getName();
if (fileName.endsWith(".war")) { // ??
- File extracted = new File(file.getParentFile(), fileName.substring(0, fileName.length() - 4));
+ final File extracted = new File(file.getParentFile(), fileName.substring(0, fileName.length() - 4));
if (extracted.exists()) {
extracted.deleteOnExit();
}
@@ -283,7 +287,7 @@ public abstract class TomEEContainer<Con
LOGGER.severe("appInfo was not found for " + file.getPath() + ", available are: " + apps());
throw new OpenEJBException("can't get appInfo");
}
- } catch (OpenEJBException re) { // clean up in undeploy needs it
+ } catch (final OpenEJBException re) { // clean up in undeploy needs it
moduleIds.put(archiveName, new DeployedApp(file.getPath(), file.getParentFile()));
throw re;
}
@@ -292,9 +296,8 @@ public abstract class TomEEContainer<Con
Info.marshal(appInfo);
}
- HTTPContext httpContext = new HTTPContext(configuration.getHost(), configuration.getHttpPort());
+ final HTTPContext httpContext = new HTTPContext(configuration.getHost(), configuration.getHttpPort());
- String arquillianServlet;
// Avoids "inconvertible types" error in windows build
if (archiveName.endsWith(".war")) {
httpContext.add(new Servlet("ArquillianServletRunner", "/" + getArchiveNameWithoutExtension(archive)));
@@ -313,7 +316,7 @@ public abstract class TomEEContainer<Con
addServlets(httpContext, appInfo);
return new ProtocolMetaData().addContext(httpContext);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
throw new DeploymentException("Unable to deploy", e);
}
@@ -324,19 +327,13 @@ public abstract class TomEEContainer<Con
}
protected File dumpFile(final Archive<?> archive) {
- String tmpDir = configuration.getAppWorkingDir();
+ final String tmpDir = configuration.getAppWorkingDir();
Files.deleteOnExit(new File(tmpDir));
- File file, folderFile;
+ File file;
int i = 0;
do { // be sure we don't override something existing
file = new File(tmpDir + File.separator + i++ + File.separator + archive.getName());
- if (file.isDirectory() || !file.getName().endsWith("ar")) {
- folderFile = file;
- } else {
- final String name = file.getName();
- folderFile = new File(file.getParentFile(), name.substring(0, name.length() - 4));
- }
} while (file.getParentFile().exists()); // we will delete the parent (to clean even complicated unpacking)
if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
LOGGER.warning("can't create " + file.getParent());
@@ -357,10 +354,10 @@ public abstract class TomEEContainer<Con
final Collection<String> paths = new ArrayList<String>();
try {
final Collection<AppInfo> appInfos = deployer().getDeployedApps();
- for (AppInfo info : appInfos) {
+ for (final AppInfo info : appInfos) {
paths.add(info.path);
}
- } catch (Exception e) { // don't throw an exception just because of this log info
+ } catch (final Exception e) { // don't throw an exception just because of this log info
// no-op
}
return paths;
@@ -380,17 +377,17 @@ public abstract class TomEEContainer<Con
return lookupDeployerWithRetry(5);
}
- protected Deployer lookupDeployerWithRetry(int retry) throws NamingException {
+ protected Deployer lookupDeployerWithRetry(final int retry) throws NamingException {
try {
final Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
properties.setProperty(Context.PROVIDER_URL, providerUrl());
return (Deployer) new InitialContext(properties).lookup("openejb/DeployerBusinessRemote");
- } catch (RuntimeException ne) { // surely "org.apache.openejb.client.ClientRuntimeException: Invalid response from server: -1"
+ } catch (final RuntimeException ne) { // surely "org.apache.openejb.client.ClientRuntimeException: Invalid response from server: -1"
if (retry > 1) {
try { // wait a bit before retrying
Thread.sleep(200);
- } catch (InterruptedException ignored) {
+ } catch (final InterruptedException ignored) {
// no-op
}
return lookupDeployerWithRetry(retry - 1);
@@ -398,7 +395,7 @@ public abstract class TomEEContainer<Con
if (Boolean.getBoolean("openejb.arquillian.debug") && retry >= 0) {
try { // wait a lot to be sure that's not a timing issue
Thread.sleep(10000);
- } catch (InterruptedException ignored) {
+ } catch (final InterruptedException ignored) {
// no-op
}
return lookupDeployerWithRetry(-1);
@@ -421,11 +418,11 @@ public abstract class TomEEContainer<Con
}
@Override
- public void undeploy(Archive<?> archive) throws DeploymentException {
+ public void undeploy(final Archive<?> archive) throws DeploymentException {
final DeployedApp deployed = moduleIds.get(archive.getName());
try {
deployer().undeploy(deployed.path);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
throw new DeploymentException("Unable to undeploy " + archive.getName(), e);
} finally {
@@ -441,37 +438,15 @@ public abstract class TomEEContainer<Con
}
@Override
- public void deploy(Descriptor descriptor) throws DeploymentException {
+ public void deploy(final Descriptor descriptor) throws DeploymentException {
throw new UnsupportedOperationException("Not implemented");
}
@Override
- public void undeploy(Descriptor descriptor) throws DeploymentException {
+ public void undeploy(final Descriptor descriptor) throws DeploymentException {
throw new UnsupportedOperationException("Not implemented");
}
- private static String startWithSlash(final String s) {
- if (s == null) {
- return "/";
- }
- if (s.startsWith("/")) {
- return s;
- }
- return "/" + s;
- }
-
- private static String uniqueSlash(final String contextRoot, final String mapping) {
- boolean ctxSlash = contextRoot.endsWith("/");
- boolean mappingSlash = mapping.startsWith("/");
- if (ctxSlash && mappingSlash) {
- return contextRoot.substring(0, contextRoot.length() - 1) + mapping;
- }
- if ((!ctxSlash && mappingSlash) || (ctxSlash && !mappingSlash)) {
- return contextRoot + mapping;
- }
- return contextRoot + "/" + mapping;
- }
-
public static class DeployedApp {
public final File file;
public final String path;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java Sat May 24 01:49:45 2014
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.openejb.arquillian.common;
import org.apache.openejb.AppContext;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Zips.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Zips.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Zips.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Zips.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.common;
@@ -27,11 +27,11 @@ public class Zips {
private static final Logger logger = Logger.getLogger(Zips.class.getName());
- public static void unzip(File zipFile, File destination) {
+ public static void unzip(final File zipFile, final File destination) {
unzip(zipFile, destination, false);
}
- public static void unzip(File zipFile, File destination, boolean noparent) {
+ public static void unzip(final File zipFile, final File destination, final boolean noparent) {
logger.info(String.format("Extracting '%s' to '%s'", zipFile.getAbsolutePath(), destination.getAbsolutePath()));
@@ -49,7 +49,9 @@ public class Zips {
while ((entry = in.getNextEntry()) != null) {
String path = entry.getName();
- if (noparent) path = path.replaceFirst("^[^/]+/", "");
+ if (noparent) {
+ path = path.replaceFirst("^[^/]+/", "");
+ }
final File file = new File(destination, path);
if (entry.isDirectory()) {
@@ -69,7 +71,7 @@ public class Zips {
in.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.log(Level.SEVERE, "Unable to unzip " + zipFile.getAbsolutePath(), e);
throw new IllegalStateException("Unable to unzip " + zipFile.getAbsolutePath(), e);
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/AppResourceProducer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/AppResourceProducer.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/AppResourceProducer.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/AppResourceProducer.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -36,7 +36,7 @@ public class AppResourceProducer {
@SuiteScoped
private InstanceProducer<Context> context;
- public void produce(final @Observes BeforeClass bs) {
+ public void produce(@Observes final BeforeClass bs) {
try {
final Assembler a = SystemInstance.get().getComponent(Assembler.class);
context.set(a.getContainerSystem().getJNDIContext());
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedRemoteExtension.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedRemoteExtension.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedRemoteExtension.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedRemoteExtension.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.embedded;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEConfiguration.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEConfiguration.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEConfiguration.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEConfiguration.java Sat May 24 01:49:45 2014
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.embedded;
@@ -129,12 +129,12 @@ public class EmbeddedTomEEConfiguration
final ByteArrayInputStream bais = new ByteArrayInputStream(getProperties().getBytes());
try {
properties.load(bais);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new OpenEJBRuntimeException(e);
} finally {
try {
IO.close(bais);
- } catch (IOException ignored) {
+ } catch (final IOException ignored) {
// no-op
}
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -16,15 +16,6 @@
*/
package org.apache.openejb.arquillian.embedded;
-import java.io.File;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
-import javax.servlet.http.HttpSession;
-
import org.apache.openejb.arquillian.common.ArquillianFilterRunner;
import org.apache.openejb.arquillian.common.Files;
import org.apache.openejb.arquillian.common.TestClassDiscoverer;
@@ -44,6 +35,14 @@ import org.jboss.arquillian.container.sp
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet;
import org.jboss.shrinkwrap.api.Archive;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.servlet.http.HttpSession;
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
public class EmbeddedTomEEContainer extends TomEEContainer<EmbeddedTomEEConfiguration> {
private static final Map<Archive<?>, File> ARCHIVES = new ConcurrentHashMap<Archive<?>, File>();
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEExtension.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEExtension.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEExtension.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEExtension.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.openejb.arquillian.embedded;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/ActionServlet.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/ActionServlet.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/ActionServlet.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/ActionServlet.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
@@ -35,111 +35,111 @@ public class ActionServlet extends HttpS
@EJB(name = "movies")
private Movies moviesBean;
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- process(request, response);
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- process(request, response);
- }
-
- private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- HttpSession session = request.getSession();
-
- List<Movie> movies = null;
- ListIterator<Movie> listIterator = null;
- int display = 5;
-
- String action = request.getParameter("action");
-
-
- if ("Add".equals(action)) {
-
- String title = request.getParameter("title");
- String director = request.getParameter("director");
- String genre = request.getParameter("genre");
- int rating = Integer.parseInt(request.getParameter("rating"));
- int year = Integer.parseInt(request.getParameter("year"));
-
- Movie movie = new Movie(title, director, genre, rating, year);
-
- moviesBean.addMovie(movie);
-
- } else if ("Remove".equals(action)) {
-
- String[] ids = request.getParameterValues("id");
- for (String id : ids) {
- moviesBean.deleteMovieId(new Long(id));
- }
-
- } else if (">>".equals(action)) {
-
- movies = (List) session.getAttribute("movies.collection");
- listIterator = (ListIterator) session.getAttribute("movies.iterator");
-
- } else if ("<<".equals(action)) {
-
- movies = (List) session.getAttribute("movies.collection");
- listIterator = (ListIterator) session.getAttribute("movies.iterator");
- for (int i = display * 2; i > 0 && listIterator.hasPrevious(); i--) {
- listIterator.previous(); // backup
- }
-
- } else if ("findByTitle".equals(action)) {
-
- movies = moviesBean.findByTitle(request.getParameter("key"));
-
- } else if ("findByDirector".equals(action)) {
-
- movies = moviesBean.findByDirector(request.getParameter("key"));
-
- } else if ("findByGenre".equals(action)) {
-
- movies = moviesBean.findByGenre(request.getParameter("key"));
- }
-
- if (movies == null) {
- try {
- movies = moviesBean.getMovies();
- } catch (Throwable e) {
- // We must not have run setup yet
- response.sendRedirect("setup.jsp");
- return;
- }
- }
-
- if (listIterator == null) {
- listIterator = movies.listIterator();
- }
-
- session.setAttribute("movies.collection", movies);
- session.setAttribute("movies.iterator", listIterator);
-
- List<Movie> moviesToShow = new ArrayList<Movie>();
-
- boolean hasPrevious = listIterator.hasPrevious();
-
- int start = listIterator.nextIndex();
+ @Override
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ process(request, response);
+ }
+
+ @Override
+ protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ process(request, response);
+ }
+
+ private void process(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ final HttpSession session = request.getSession();
+
+ List<Movie> movies = null;
+ ListIterator<Movie> listIterator = null;
+ final int display = 5;
+
+ final String action = request.getParameter("action");
+
+
+ if ("Add".equals(action)) {
+
+ final String title = request.getParameter("title");
+ final String director = request.getParameter("director");
+ final String genre = request.getParameter("genre");
+ final int rating = Integer.parseInt(request.getParameter("rating"));
+ final int year = Integer.parseInt(request.getParameter("year"));
+
+ final Movie movie = new Movie(title, director, genre, rating, year);
+
+ moviesBean.addMovie(movie);
+
+ } else if ("Remove".equals(action)) {
+
+ final String[] ids = request.getParameterValues("id");
+ for (final String id : ids) {
+ moviesBean.deleteMovieId(new Long(id));
+ }
+
+ } else if (">>".equals(action)) {
+
+ movies = (List) session.getAttribute("movies.collection");
+ listIterator = (ListIterator) session.getAttribute("movies.iterator");
+
+ } else if ("<<".equals(action)) {
+
+ movies = (List) session.getAttribute("movies.collection");
+ listIterator = (ListIterator) session.getAttribute("movies.iterator");
+ for (int i = display * 2; i > 0 && listIterator.hasPrevious(); i--) {
+ listIterator.previous(); // backup
+ }
+
+ } else if ("findByTitle".equals(action)) {
+
+ movies = moviesBean.findByTitle(request.getParameter("key"));
+
+ } else if ("findByDirector".equals(action)) {
+
+ movies = moviesBean.findByDirector(request.getParameter("key"));
+
+ } else if ("findByGenre".equals(action)) {
+
+ movies = moviesBean.findByGenre(request.getParameter("key"));
+ }
+
+ if (movies == null) {
+ try {
+ movies = moviesBean.getMovies();
+ } catch (final Throwable e) {
+ // We must not have run setup yet
+ response.sendRedirect("setup.jsp");
+ return;
+ }
+ }
+
+ if (listIterator == null) {
+ listIterator = movies.listIterator();
+ }
+
+ session.setAttribute("movies.collection", movies);
+ session.setAttribute("movies.iterator", listIterator);
+
+ final List<Movie> moviesToShow = new ArrayList<Movie>();
+
+ final boolean hasPrevious = listIterator.hasPrevious();
+
+ final int start = listIterator.nextIndex();
- for (int i=display; i > 0 && listIterator.hasNext(); i-- ) {
- Movie movie = (Movie) listIterator.next();
- moviesToShow.add(movie);
- }
+ for (int i=display; i > 0 && listIterator.hasNext(); i-- ) {
+ final Movie movie = (Movie) listIterator.next();
+ moviesToShow.add(movie);
+ }
- boolean hasNext = listIterator.hasNext();
-
- int end = listIterator.nextIndex();
- request.setAttribute("movies", moviesToShow);
- request.setAttribute("start", start);
- request.setAttribute("end", end);
- request.setAttribute("total", movies.size());
- request.setAttribute("display", display);
- request.setAttribute("hasNext", hasNext);
- request.setAttribute("hasPrev", hasPrevious);
-
- request.getRequestDispatcher("WEB-INF/moviefun.jsp").forward(request, response);
- }
+ final boolean hasNext = listIterator.hasNext();
+
+ final int end = listIterator.nextIndex();
+ request.setAttribute("movies", moviesToShow);
+ request.setAttribute("start", start);
+ request.setAttribute("end", end);
+ request.setAttribute("total", movies.size());
+ request.setAttribute("display", display);
+ request.setAttribute("hasNext", hasNext);
+ request.setAttribute("hasPrev", hasPrevious);
+
+ request.getRequestDispatcher("WEB-INF/moviefun.jsp").forward(request, response);
+ }
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movie.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movie.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movie.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movie.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
@@ -41,7 +41,7 @@ public class Movie implements Serializab
public Movie() {
}
- public Movie(String title, String director, String genre, int rating, int year) {
+ public Movie(final String title, final String director, final String genre, final int rating, final int year) {
this.director = director;
this.title = title;
this.year = year;
@@ -49,7 +49,7 @@ public class Movie implements Serializab
this.rating = rating;
}
- public Movie(String director, String title, int year) {
+ public Movie(final String director, final String title, final int year) {
this.director = director;
this.title = title;
this.year = year;
@@ -59,7 +59,7 @@ public class Movie implements Serializab
return id;
}
- public void setId(long id) {
+ public void setId(final long id) {
this.id = id;
}
@@ -67,7 +67,7 @@ public class Movie implements Serializab
return director;
}
- public void setDirector(String director) {
+ public void setDirector(final String director) {
this.director = director;
}
@@ -75,7 +75,7 @@ public class Movie implements Serializab
return title;
}
- public void setTitle(String title) {
+ public void setTitle(final String title) {
this.title = title;
}
@@ -83,7 +83,7 @@ public class Movie implements Serializab
return year;
}
- public void setYear(int year) {
+ public void setYear(final int year) {
this.year = year;
}
@@ -91,7 +91,7 @@ public class Movie implements Serializab
return genre;
}
- public void setGenre(String genre) {
+ public void setGenre(final String genre) {
this.genre = genre;
}
@@ -99,7 +99,7 @@ public class Movie implements Serializab
return rating;
}
- public void setRating(int rating) {
+ public void setRating(final int rating) {
this.rating = rating;
}
}
\ No newline at end of file
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MovieController.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MovieController.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MovieController.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MovieController.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
@@ -44,9 +44,6 @@ public class MovieController implements
private PaginationHelper pagination;
private int selectedItemIndex;
- public MovieController() {
- }
-
public Movie getSelected() {
if (current == null) {
current = new Movie();
@@ -99,7 +96,7 @@ public class MovieController implements
getFacade().addMovie(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("MovieCreated"));
return prepareCreate();
- } catch (Exception e) {
+ } catch (final Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
@@ -116,7 +113,7 @@ public class MovieController implements
getFacade().editMovie(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("MovieUpdated"));
return "View";
- } catch (Exception e) {
+ } catch (final Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
@@ -147,13 +144,13 @@ public class MovieController implements
try {
getFacade().deleteMovieId(current.getId());
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("MovieDeleted"));
- } catch (Exception e) {
+ } catch (final Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
}
}
private void updateCurrentItem() {
- int count = getFacade().count();
+ final int count = getFacade().count();
if (selectedItemIndex >= count) {
// selected index cannot be bigger than number of items:
selectedItemIndex = count - 1;
@@ -201,33 +198,33 @@ public class MovieController implements
@FacesConverter(forClass = Movie.class)
public static class MovieControllerConverter implements Converter {
- public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
+ public Object getAsObject(final FacesContext facesContext, final UIComponent component, final String value) {
if (value == null || value.length() == 0) {
return null;
}
- MovieController controller = (MovieController) facesContext.getApplication().getELResolver().
+ final MovieController controller = (MovieController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "movieController");
return controller.ejbFacade.find(getKey(value));
}
- long getKey(String value) {
- long key;
+ long getKey(final String value) {
+ final long key;
key = Long.parseLong(value);
return key;
}
- String getStringKey(long value) {
- StringBuffer sb = new StringBuffer();
+ String getStringKey(final long value) {
+ final StringBuffer sb = new StringBuffer();
sb.append(value);
return sb.toString();
}
- public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
+ public String getAsString(final FacesContext facesContext, final UIComponent component, final Object object) {
if (object == null) {
return null;
}
if (object instanceof Movie) {
- Movie o = (Movie) object;
+ final Movie o = (Movie) object;
return getStringKey(o.getId());
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + MovieController.class.getName());
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movies.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movies.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movies.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/Movies.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesImpl.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesImpl.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesImpl.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
@@ -39,7 +39,7 @@ public class MoviesImpl implements Movie
private EntityManager entityManager;
@Override
- public Movie find(Long id) {
+ public Movie find(final Long id) {
return entityManager.find(Movie.class, id);
}
@@ -49,56 +49,56 @@ public class MoviesImpl implements Movie
}
@Override
- public void addMovie(Movie movie) {
+ public void addMovie(final Movie movie) {
entityManager.persist(movie);
}
@Override
- public void editMovie(Movie movie) {
+ public void editMovie(final Movie movie) {
entityManager.merge(movie);
}
@Override
- public void deleteMovie(Movie movie) {
+ public void deleteMovie(final Movie movie) {
entityManager.remove(movie);
}
@Override
- public void deleteMovieId(long id) {
- Movie movie = entityManager.find(Movie.class, id);
+ public void deleteMovieId(final long id) {
+ final Movie movie = entityManager.find(Movie.class, id);
deleteMovie(movie);
}
@Override
public List<Movie> getMovies() {
- CriteriaQuery<Movie> cq = entityManager.getCriteriaBuilder().createQuery(Movie.class);
+ final CriteriaQuery<Movie> cq = entityManager.getCriteriaBuilder().createQuery(Movie.class);
cq.select(cq.from(Movie.class));
return entityManager.createQuery(cq).getResultList();
}
@Override
- public List<Movie> findByTitle(String title) {
+ public List<Movie> findByTitle(final String title) {
return findByStringField("title", title);
}
@Override
- public List<Movie> findByGenre(String genre) {
+ public List<Movie> findByGenre(final String genre) {
return findByStringField("genre", genre);
}
@Override
- public List<Movie> findByDirector(String director) {
+ public List<Movie> findByDirector(final String director) {
return findByStringField("director", director);
}
- private List<Movie> findByStringField(String fieldname, String param) {
- CriteriaBuilder builder = entityManager.getCriteriaBuilder();
- CriteriaQuery<Movie> query = builder.createQuery(Movie.class);
- Root<Movie> root = query.from(Movie.class);
- EntityType<Movie> type = entityManager.getMetamodel().entity(Movie.class);
+ private List<Movie> findByStringField(final String fieldname, final String param) {
+ final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
+ final CriteriaQuery<Movie> query = builder.createQuery(Movie.class);
+ final Root<Movie> root = query.from(Movie.class);
+ final EntityType<Movie> type = entityManager.getMetamodel().entity(Movie.class);
- Path<String> path = root.get(type.getDeclaredSingularAttribute(fieldname, String.class));
- Predicate condition = builder.like(path, "%" + param + "%");
+ final Path<String> path = root.get(type.getDeclaredSingularAttribute(fieldname, String.class));
+ final Predicate condition = builder.like(path, "%" + param + "%");
query.where(condition);
@@ -106,10 +106,10 @@ public class MoviesImpl implements Movie
}
@Override
- public List<Movie> findRange(int[] range) {
- CriteriaQuery<Movie> cq = entityManager.getCriteriaBuilder().createQuery(Movie.class);
+ public List<Movie> findRange(final int[] range) {
+ final CriteriaQuery<Movie> cq = entityManager.getCriteriaBuilder().createQuery(Movie.class);
cq.select(cq.from(Movie.class));
- TypedQuery<Movie> q = entityManager.createQuery(cq);
+ final TypedQuery<Movie> q = entityManager.createQuery(cq);
q.setMaxResults(range[1] - range[0]);
q.setFirstResult(range[0]);
return q.getResultList();
@@ -117,11 +117,11 @@ public class MoviesImpl implements Movie
@Override
public int count() {
- CriteriaQuery<Long> cq = entityManager.getCriteriaBuilder().createQuery(Long.class);
- Root<Movie> rt = cq.from(Movie.class);
+ final CriteriaQuery<Long> cq = entityManager.getCriteriaBuilder().createQuery(Long.class);
+ final Root<Movie> rt = cq.from(Movie.class);
cq.select(entityManager.getCriteriaBuilder().count(rt));
- TypedQuery<Long> q = entityManager.createQuery(cq);
- return (q.getSingleResult()).intValue();
+ final TypedQuery<Long> q = entityManager.createQuery(cq);
+ return q.getSingleResult().intValue();
}
}
\ No newline at end of file
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesRemote.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesRemote.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesRemote.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/MoviesRemote.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,11 +8,11 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,49 +8,40 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun;
-import java.io.IOException;
-import java.util.List;
+import org.superbiz.moviefun.setup.Setup;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import org.superbiz.moviefun.setup.Setup;
+import java.io.IOException;
+import java.util.List;
/**
* Servlet implementation class SetupServlet
*/
public class SetupServlet extends HttpServlet {
-
- @Inject private Setup setup;
-
- private static final long serialVersionUID = 1L;
+
+ @Inject private Setup setup;
+
+ private static final long serialVersionUID = 1L;
/**
- * @see HttpServlet#HttpServlet()
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
- public SetupServlet() {
- super();
- // TODO Auto-generated constructor stub
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ final List<Movie> addedMovies = setup.setup();
+ request.setAttribute("movies", addedMovies);
+ request.getRequestDispatcher("WEB-INF/setup.jsp").forward(request, response);
}
- /**
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
- */
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- List<Movie> addedMovies = setup.setup();
- request.setAttribute("movies", addedMovies);
- request.getRequestDispatcher("WEB-INF/setup.jsp").forward(request, response);
- }
-
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,35 +8,34 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun.setup;
-import java.util.ArrayList;
-import java.util.List;
+import org.superbiz.moviefun.Movie;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
-
-import org.superbiz.moviefun.Movie;
+import java.util.ArrayList;
+import java.util.List;
@ApplicationScoped
public class ExampleDataProducer {
- @Produces
- @Examples
- public List<Movie> createSampleMovies() {
- List<Movie> sampleMovies = new ArrayList<Movie>();
- sampleMovies.add(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005));
- sampleMovies.add(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004));
- sampleMovies.add(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003));
- sampleMovies.add(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002));
- sampleMovies.add(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001));
- sampleMovies.add(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001));
- sampleMovies.add(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000));
- return sampleMovies;
- }
+ @Produces
+ @Examples
+ public List<Movie> createSampleMovies() {
+ final List<Movie> sampleMovies = new ArrayList<Movie>();
+ sampleMovies.add(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005));
+ sampleMovies.add(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004));
+ sampleMovies.add(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003));
+ sampleMovies.add(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002));
+ sampleMovies.add(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001));
+ sampleMovies.add(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001));
+ sampleMovies.add(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000));
+ return sampleMovies;
+ }
}
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,21 +8,20 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun.setup;
+import javax.inject.Qualifier;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
-
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java?rev=1597233&r1=1597232&r2=1597233&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java Sat May 24 01:49:45 2014
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -8,32 +8,31 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.superbiz.moviefun.setup;
-import java.util.List;
+import org.superbiz.moviefun.Movie;
+import org.superbiz.moviefun.Movies;
import javax.ejb.EJB;
import javax.inject.Inject;
-
-import org.superbiz.moviefun.Movie;
-import org.superbiz.moviefun.Movies;
+import java.util.List;
public class Setup {
-
- @Inject @Examples private List<Movie> exampleMovies;
- @EJB private Movies moviesBean;
-
- public List<Movie> setup() {
- for (Movie movie : exampleMovies) {
- moviesBean.addMovie(movie);
- }
-
- return exampleMovies;
- }
+
+ @Inject @Examples private List<Movie> exampleMovies;
+ @EJB private Movies moviesBean;
+
+ public List<Movie> setup() {
+ for (final Movie movie : exampleMovies) {
+ moviesBean.addMovie(movie);
+ }
+
+ return exampleMovies;
+ }
}