Author: rhauch
Date: 2008-06-25 17:39:59 -0400 (Wed, 25 Jun 2008)
New Revision: 310
Added:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/AbstractProblemsTest.java
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ProblemTest.java
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/SimpleProblemsTest.java
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ThreadSafeProblemsTest.java
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
Log:
DNA-166 - Create threadsafe Problems implementation
http://jira.jboss.com/jira/browse/DNA-166
Added a thread-safe implementation of Problems, and added unit tests for SimpleProblems
and the new ThreadSafeProblems.
Added:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
(rev 0)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,253 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.jboss.dna.common.i18n.I18n;
+
+/**
+ * A list of problems for some execution context. The problems will be {@link #iterator()
returned} in the order in which they
+ * were encountered (although this cannot be guaranteed in contexts involving multiple
threads or processes).
+ *
+ * @author Randall Hauch
+ * @author John Verhaeg
+ */
+public abstract class AbstractProblems implements Problems {
+
+ protected static final List<Problem> EMPTY_PROBLEMS = Collections.emptyList();
+
+ public void addError( I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
params, null, null, null));
+ }
+
+ public void addError( Throwable throwable,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
params, null, null, throwable));
+ }
+
+ public void addError( I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
params, resource, location, null));
+ }
+
+ public void addError( Throwable throwable,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
params, resource, location, throwable));
+ }
+
+ public void addError( int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, code, message, params, null, null,
null));
+ }
+
+ public void addError( Throwable throwable,
+ int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, code, message, params, null, null,
throwable));
+ }
+
+ public void addError( int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, code, message, params, resource,
location, null));
+ }
+
+ public void addError( Throwable throwable,
+ int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.ERROR, code, message, params, resource,
location, throwable));
+ }
+
+ public void addWarning( I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
params, null, null, null));
+ }
+
+ public void addWarning( Throwable throwable,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
params, null, null, throwable));
+ }
+
+ public void addWarning( I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
params, resource, location, null));
+ }
+
+ public void addWarning( Throwable throwable,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
params, resource, location, throwable));
+ }
+
+ public void addWarning( int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, code, message, params, null, null,
null));
+ }
+
+ public void addWarning( Throwable throwable,
+ int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, code, message, params, null, null,
throwable));
+ }
+
+ public void addWarning( int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, code, message, params, resource,
location, null));
+ }
+
+ public void addWarning( Throwable throwable,
+ int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.WARNING, code, message, params, resource,
location, throwable));
+ }
+
+ public void addInfo( I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
params, null, null, null));
+ }
+
+ public void addInfo( Throwable throwable,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
params, null, null, throwable));
+ }
+
+ public void addInfo( I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
params, resource, location, null));
+ }
+
+ public void addInfo( Throwable throwable,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
params, resource, location, throwable));
+ }
+
+ public void addInfo( int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, code, message, params, null, null,
null));
+ }
+
+ public void addInfo( Throwable throwable,
+ int code,
+ I18n message,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, code, message, params, null, null,
throwable));
+ }
+
+ public void addInfo( int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, code, message, params, resource,
location, null));
+ }
+
+ public void addInfo( Throwable throwable,
+ int code,
+ I18n message,
+ String resource,
+ String location,
+ Object... params ) {
+ addProblem(new Problem(Problem.Status.INFO, code, message, params, resource,
location, throwable));
+ }
+
+ public boolean hasProblems() {
+ return getProblems().size() > 0;
+ }
+
+ public boolean hasErrors() {
+ for (Problem problem : this.getProblems()) {
+ if (problem.getStatus() == Problem.Status.ERROR) return true;
+ }
+ return false;
+ }
+
+ public boolean hasWarnings() {
+ for (Problem problem : this.getProblems()) {
+ if (problem.getStatus() == Problem.Status.WARNING) return true;
+ }
+ return false;
+ }
+
+ public boolean hasInfo() {
+ for (Problem problem : this.getProblems()) {
+ if (problem.getStatus() == Problem.Status.INFO) return true;
+ }
+ return false;
+ }
+
+ public boolean isEmpty() {
+ return getProblems().isEmpty();
+ }
+
+ public int size() {
+ return getProblems().size();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.Problems#iterator()
+ */
+ public Iterator<Problem> iterator() {
+ return getProblems().iterator();
+ }
+
+ protected abstract void addProblem( Problem problem );
+
+ protected abstract List<Problem> getProblems();
+}
Property changes on:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2008-06-25
13:48:37 UTC (rev 309)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -24,6 +24,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.HashCode;
/**
* @author Randall Hauch
@@ -47,11 +48,13 @@
private final String resource;
private final String location;
- public Problem( Status status, int code, I18n message, Object... params ) {
- this(status, code, message, params, null, null, null);
- }
-
- public Problem( Status status, int code, I18n message, Object[] params, String
resource, String location, Throwable throwable ) {
+ public Problem( Status status,
+ int code,
+ I18n message,
+ Object[] params,
+ String resource,
+ String location,
+ Throwable throwable ) {
ArgCheck.isNotNull(status, "status");
ArgCheck.isNotNull(message, "message");
this.status = status;
@@ -79,6 +82,7 @@
/**
* Get the message written in the current locale.
+ *
* @return the message
*/
public String getMessageString() {
@@ -117,4 +121,76 @@
return this.throwable;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return HashCode.compute(status, code, message, resource, location);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (obj == this) return true;
+ if (obj instanceof Problem) {
+ Problem that = (Problem)obj;
+ if (this.getStatus() != that.getStatus()) return false;
+ if (this.getCode() != that.getCode()) return false;
+ if (!this.getMessage().equals(that.getMessage())) return false;
+ if (!this.getParameters().equals(that.getParameters())) return false;
+
+ String thisResource = this.getResource();
+ String thatResource = that.getResource();
+ if (thisResource != thatResource) {
+ if (thisResource == null || !thisResource.equals(thatResource)) return
false;
+ }
+
+ String thisLocation = this.getLocation();
+ String thatLocation = that.getLocation();
+ if (thisLocation != thatLocation) {
+ if (thisLocation == null || !thisLocation.equals(thatLocation)) return
false;
+ }
+
+ Throwable thisThrowable = this.getThrowable();
+ Throwable thatThrowable = that.getThrowable();
+ if (thisThrowable != thatThrowable) {
+ if (thisThrowable == null || !thisThrowable.equals(thatThrowable)) return
false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(this.getStatus()).append(": ");
+ if (this.getCode() != DEFAULT_CODE) {
+ sb.append("(").append(this.getCode()).append(") ");
+ }
+ sb.append(this.getMessageString());
+ if (this.getResource() != null) {
+ sb.append("
Resource=\"").append(this.getResource()).append("\"");
+ }
+ if (this.getLocation() != null) {
+ sb.append(" At
\"").append(this.getLocation()).append("\"");
+ }
+ if (this.getThrowable() != null) {
+ sb.append(" (threw
").append(this.getThrowable().getLocalizedMessage()).append(")");
+ }
+ return sb.toString();
+ }
+
}
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2008-06-25
13:48:37 UTC (rev 309)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -21,12 +21,9 @@
*/
package org.jboss.dna.common.collection;
-import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.i18n.I18n;
/**
* A list of problems for some execution context. The problems will be {@link #iterator()
returned} in the order in which they
@@ -36,229 +33,29 @@
* @author John Verhaeg
*/
@NotThreadSafe
-public class SimpleProblems implements Problems {
+public class SimpleProblems extends AbstractProblems {
- private static final List<Problem> EMPTY_PROBLEMS = Collections.emptyList();
-
private List<Problem> problems;
- public void addError( I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
params));
- }
-
- public void addError( Throwable throwable,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message, null,
null, throwable));
- }
-
- public void addError( I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
resource, location));
- }
-
- public void addError( Throwable throwable,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, Problem.DEFAULT_CODE, message,
resource, location, throwable));
- }
-
- public void addError( int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, code, message));
- }
-
- public void addError( Throwable throwable,
- int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, code, message, null, null,
throwable));
- }
-
- public void addError( int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, code, message, resource,
location));
- }
-
- public void addError( Throwable throwable,
- int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.ERROR, code, message, resource, location,
throwable));
- }
-
- public void addWarning( I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message));
- }
-
- public void addWarning( Throwable throwable,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
null, null, throwable));
- }
-
- public void addWarning( I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
resource, location));
- }
-
- public void addWarning( Throwable throwable,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, Problem.DEFAULT_CODE, message,
resource, location, throwable));
- }
-
- public void addWarning( int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, code, message));
- }
-
- public void addWarning( Throwable throwable,
- int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, code, message, null, null,
throwable));
- }
-
- public void addWarning( int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, code, message, resource,
location));
- }
-
- public void addWarning( Throwable throwable,
- int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.WARNING, code, message, resource, location,
throwable));
- }
-
- public void addInfo( I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message));
- }
-
- public void addInfo( Throwable throwable,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message, null,
null, throwable));
- }
-
- public void addInfo( I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
resource, location));
- }
-
- public void addInfo( Throwable throwable,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, Problem.DEFAULT_CODE, message,
resource, location, throwable));
- }
-
- public void addInfo( int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, code, message));
- }
-
- public void addInfo( Throwable throwable,
- int code,
- I18n message,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, code, message, null, null,
throwable));
- }
-
- public void addInfo( int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, code, message, resource, location));
- }
-
- public void addInfo( Throwable throwable,
- int code,
- I18n message,
- String resource,
- String location,
- Object... params ) {
- addProblem(new Problem(Problem.Status.INFO, code, message, resource, location,
throwable));
- }
-
- public boolean hasProblems() {
- return this.problems != null && this.problems.size() > 0;
- }
-
- public boolean hasErrors() {
- if (this.problems == null) return false;
- for (Problem problem : this.problems) {
- if (problem.getStatus() == Problem.Status.ERROR) return true;
- }
- return false;
- }
-
- public boolean hasWarnings() {
- if (this.problems == null) return false;
- for (Problem problem : this.problems) {
- if (problem.getStatus() == Problem.Status.WARNING) return true;
- }
- return false;
- }
-
- public boolean hasInfo() {
- if (this.problems == null) return false;
- for (Problem problem : this.problems) {
- if (problem.getStatus() == Problem.Status.INFO) return true;
- }
- return false;
- }
-
- public boolean isEmpty() {
- return this.problems == null || this.problems.isEmpty();
- }
-
- public int size() {
- if (this.problems == null) return 0;
- return this.problems.size();
- }
-
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.common.collection.Problems#iterator()
+ * @see org.jboss.dna.common.collection.AbstractProblems#addProblem(Problem)
*/
- public Iterator<Problem> iterator() {
- return (problems == null ? EMPTY_PROBLEMS.iterator() : problems.iterator());
- }
-
+ @Override
protected void addProblem( Problem problem ) {
if (problem == null) return;
if (problems == null) problems = new LinkedList<Problem>();
problems.add(problem);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#getProblems()
+ */
+ @Override
+ protected List<Problem> getProblems() {
+ return this.problems != null ? problems : EMPTY_PROBLEMS;
+ }
}
Added:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
(rev 0)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import net.jcip.annotations.ThreadSafe;
+
+/**
+ * A thread-safe list of problems for some execution context. The problems will be {@link
#iterator() returned} in the order in
+ * which they were encountered.
+ *
+ * @author Randall Hauch
+ */
+@ThreadSafe
+public class ThreadSafeProblems extends AbstractProblems {
+
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
+ private final List<Problem> problems = new LinkedList<Problem>();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#hasErrors()
+ */
+ @Override
+ public boolean hasErrors() {
+ try {
+ lock.readLock().lock();
+ return super.hasErrors();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#hasProblems()
+ */
+ @Override
+ public boolean hasProblems() {
+ try {
+ lock.readLock().lock();
+ return super.hasProblems();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#hasInfo()
+ */
+ @Override
+ public boolean hasInfo() {
+ try {
+ lock.readLock().lock();
+ return super.hasInfo();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#hasWarnings()
+ */
+ @Override
+ public boolean hasWarnings() {
+ try {
+ lock.readLock().lock();
+ return super.hasWarnings();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#isEmpty()
+ */
+ @Override
+ public boolean isEmpty() {
+ try {
+ lock.readLock().lock();
+ return super.isEmpty();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#size()
+ */
+ @Override
+ public int size() {
+ try {
+ lock.readLock().lock();
+ return super.size();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#addProblem(Problem)
+ */
+ @Override
+ protected void addProblem( Problem problem ) {
+ try {
+ lock.writeLock().lock();
+ problems.add(problem);
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblems#getProblems()
+ */
+ @Override
+ protected List<Problem> getProblems() {
+ // Return an unmodifiable copy ...
+ try {
+ lock.readLock().lock();
+ return Collections.unmodifiableList(new
ArrayList<Problem>(this.problems));
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+}
Property changes on:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/AbstractProblemsTest.java
===================================================================
---
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/AbstractProblemsTest.java
(rev 0)
+++
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/AbstractProblemsTest.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,395 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import java.util.Iterator;
+import org.jboss.dna.common.CommonI18n;
+import org.jboss.dna.common.collection.Problem.Status;
+import org.jboss.dna.common.i18n.I18n;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Randall Hauch
+ */
+public abstract class AbstractProblemsTest {
+
+ private Problems problems;
+ private Problem error;
+ private Problem warning;
+ private Problem info;
+ private I18n message;
+ private Throwable throwable;
+ private String location;
+ private String resource;
+
+ @Before
+ public void beforeEach() throws Exception {
+ problems = createProblems();
+ message = CommonI18n.argumentMayNotBeNull;
+ error = new Problem(Status.ERROR, 1, message, new Object[] {"error
msg"}, null, null, null);
+ warning = new Problem(Status.WARNING, 1, message, new Object[] {"warning
msg"}, null, null, null);
+ info = new Problem(Status.INFO, 1, message, new Object[] {"info msg"},
null, null, null);
+ throwable = new IllegalArgumentException(message.text("throwable"));
+ resource = "SomeResource";
+ location = "/Meaningless/location";
+ }
+
+ protected abstract Problems createProblems();
+
+ @Test
+ public void shouldBeEmptyImmediatelyAfterInstantiation() {
+ assertThat(problems.isEmpty(), is(true));
+ assertThat(problems.size(), is(0));
+ }
+
+ @Test
+ public void shouldAddErrorByMessageAndParametersUsingDefaultCode() {
+ error = new Problem(Status.ERROR, Problem.DEFAULT_CODE, message, new Object[]
{"error msg"}, null, null, null);
+ problems.addError(error.getMessage(), error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddErrorByCodeAndMesssageAndParameters() {
+ problems.addError(error.getCode(), error.getMessage(), error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddErrorByThrowableAndMessageAndParametersUsingDefaultCode() {
+ error = new Problem(Status.ERROR, Problem.DEFAULT_CODE, message, new Object[]
{"error msg"}, null, null, throwable);
+ problems.addError(error.getThrowable(), error.getMessage(),
error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddErrorByThrowableAndCodeAndMessageAndParameters() {
+ error = new Problem(Status.ERROR, 1, message, new Object[] {"error
msg"}, null, null, throwable);
+ problems.addError(error.getThrowable(), error.getCode(), error.getMessage(),
error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddErrorByMessageAndResourceAndLocationAndParametersUsingDefaultCode() {
+ error = new Problem(Status.ERROR, Problem.DEFAULT_CODE, message, new Object[]
{"error msg"}, resource, location, null);
+ problems.addError(error.getMessage(), error.getResource(), error.getLocation(),
error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddErrorByCodeAndMesssageAndResourceAndLocationAndParameters() {
+ error = new Problem(Status.ERROR, 1, message, new Object[] {"error
msg"}, resource, location, null);
+ problems.addError(error.getCode(), error.getMessage(), error.getResource(),
error.getLocation(), error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddErrorByThrowableAndMessageAndResourceAndLocationAndParametersUsingDefaultCode()
{
+ error = new Problem(Status.ERROR, Problem.DEFAULT_CODE, message, new Object[]
{"error msg"}, resource, location,
+ throwable);
+ problems.addError(error.getThrowable(),
+ error.getMessage(),
+ error.getResource(),
+ error.getLocation(),
+ error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddErrorByThrowableAndCodeAndMessageAndResourceAndLocationAndParameters() {
+ error = new Problem(Status.ERROR, 1, message, new Object[] {"error
msg"}, resource, location, throwable);
+ problems.addError(error.getThrowable(),
+ error.getCode(),
+ error.getMessage(),
+ error.getResource(),
+ error.getLocation(),
+ error.getParameters());
+ assertThat(problems.iterator().next(), is(error));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddWarningByMessageAndParametersUsingDefaultCode() {
+ warning = new Problem(Status.WARNING, Problem.DEFAULT_CODE, message, new Object[]
{"warning msg"}, null, null, null);
+ problems.addWarning(warning.getMessage(), warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddWarningByCodeAndMesssageAndParameters() {
+ problems.addWarning(warning.getCode(), warning.getMessage(),
warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddWarningByThrowableAndMessageAndParametersUsingDefaultCode() {
+ warning = new Problem(Status.WARNING, Problem.DEFAULT_CODE, message, new Object[]
{"warning msg"}, null, null, throwable);
+ problems.addWarning(warning.getThrowable(), warning.getMessage(),
warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddWarningByThrowableAndCodeAndMessageAndParameters() {
+ warning = new Problem(Status.WARNING, 1, message, new Object[] {"warning
msg"}, null, null, throwable);
+ problems.addWarning(warning.getThrowable(), warning.getCode(),
warning.getMessage(), warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddWarningByMessageAndResourceAndLocationAndParametersUsingDefaultCode() {
+ warning = new Problem(Status.WARNING, Problem.DEFAULT_CODE, message, new Object[]
{"warning msg"}, resource, location,
+ null);
+ problems.addWarning(warning.getMessage(), warning.getResource(),
warning.getLocation(), warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddWarningByCodeAndMesssageAndResourceAndLocationAndParameters() {
+ warning = new Problem(Status.WARNING, 1, message, new Object[] {"warning
msg"}, resource, location, null);
+ problems.addWarning(warning.getCode(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddWarningByThrowableAndMessageAndResourceAndLocationAndParametersUsingDefaultCode()
{
+ warning = new Problem(Status.WARNING, Problem.DEFAULT_CODE, message, new Object[]
{"warning msg"}, resource, location,
+ throwable);
+ problems.addWarning(warning.getThrowable(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddWarningByThrowableAndCodeAndMessageAndResourceAndLocationAndParameters() {
+ warning = new Problem(Status.WARNING, 1, message, new Object[] {"warning
msg"}, resource, location, throwable);
+ problems.addWarning(warning.getThrowable(),
+ warning.getCode(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ assertThat(problems.iterator().next(), is(warning));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddInfoByMessageAndParametersUsingDefaultCode() {
+ info = new Problem(Status.INFO, Problem.DEFAULT_CODE, message, new Object[]
{"info msg"}, null, null, null);
+ problems.addInfo(info.getMessage(), info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddInfoByCodeAndMesssageAndParameters() {
+ problems.addInfo(info.getCode(), info.getMessage(), info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddInfoByThrowableAndMessageAndParametersUsingDefaultCode() {
+ info = new Problem(Status.INFO, Problem.DEFAULT_CODE, message, new Object[]
{"info msg"}, null, null, throwable);
+ problems.addInfo(info.getThrowable(), info.getMessage(), info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddInfoByThrowableAndCodeAndMessageAndParameters() {
+ info = new Problem(Status.INFO, 1, message, new Object[] {"info msg"},
null, null, throwable);
+ problems.addInfo(info.getThrowable(), info.getCode(), info.getMessage(),
info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddInfoByMessageAndResourceAndLocationAndParametersUsingDefaultCode() {
+ info = new Problem(Status.INFO, Problem.DEFAULT_CODE, message, new Object[]
{"info msg"}, resource, location, null);
+ problems.addInfo(info.getMessage(), info.getResource(), info.getLocation(),
info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddInfoByCodeAndMesssageAndResourceAndLocationAndParameters() {
+ info = new Problem(Status.INFO, 1, message, new Object[] {"info msg"},
resource, location, null);
+ problems.addInfo(info.getCode(), info.getMessage(), info.getResource(),
info.getLocation(), info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddInfoByThrowableAndMessageAndResourceAndLocationAndParametersUsingDefaultCode() {
+ info = new Problem(Status.INFO, Problem.DEFAULT_CODE, message, new Object[]
{"info msg"}, resource, location, throwable);
+ problems.addInfo(info.getThrowable(), info.getMessage(), info.getResource(),
info.getLocation(), info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void
shouldAddInfoByThrowableAndCodeAndMessageAndResourceAndLocationAndParameters() {
+ info = new Problem(Status.INFO, 1, message, new Object[] {"info msg"},
resource, location, throwable);
+ problems.addInfo(info.getThrowable(),
+ info.getCode(),
+ info.getMessage(),
+ info.getResource(),
+ info.getLocation(),
+ info.getParameters());
+ assertThat(problems.iterator().next(), is(info));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ }
+
+ @Test
+ public void shouldAddProblemsAndMaintainOrder() {
+ assertThat(problems.hasErrors(), is(false));
+ assertThat(problems.hasWarnings(), is(false));
+ assertThat(problems.hasInfo(), is(false));
+ assertThat(problems.isEmpty(), is(true));
+ assertThat(problems.size(), is(0));
+ problems.addWarning(warning.getThrowable(),
+ warning.getCode(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ assertThat(problems.hasErrors(), is(false));
+ assertThat(problems.hasWarnings(), is(true));
+ assertThat(problems.hasInfo(), is(false));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(1));
+ problems.addError(error.getThrowable(),
+ error.getCode(),
+ error.getMessage(),
+ error.getResource(),
+ error.getLocation(),
+ error.getParameters());
+ assertThat(problems.hasErrors(), is(true));
+ assertThat(problems.hasWarnings(), is(true));
+ assertThat(problems.hasInfo(), is(false));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(2));
+ problems.addInfo(info.getThrowable(),
+ info.getCode(),
+ info.getMessage(),
+ info.getResource(),
+ info.getLocation(),
+ info.getParameters());
+ assertThat(problems.hasErrors(), is(true));
+ assertThat(problems.hasWarnings(), is(true));
+ assertThat(problems.hasInfo(), is(true));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(3));
+ problems.addWarning(warning.getThrowable(),
+ warning.getCode(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ problems.addError(error.getThrowable(),
+ error.getCode(),
+ error.getMessage(),
+ error.getResource(),
+ error.getLocation(),
+ error.getParameters());
+ problems.addWarning(warning.getThrowable(),
+ warning.getCode(),
+ warning.getMessage(),
+ warning.getResource(),
+ warning.getLocation(),
+ warning.getParameters());
+ problems.addError(error.getThrowable(),
+ error.getCode(),
+ error.getMessage(),
+ error.getResource(),
+ error.getLocation(),
+ error.getParameters());
+ assertThat(problems.hasErrors(), is(true));
+ assertThat(problems.hasWarnings(), is(true));
+ assertThat(problems.hasInfo(), is(true));
+ assertThat(problems.isEmpty(), is(false));
+ assertThat(problems.size(), is(7));
+ Iterator<Problem> iter = problems.iterator();
+ assertThat(iter.next(), is(warning));
+ assertThat(iter.next(), is(error));
+ assertThat(iter.next(), is(info));
+ assertThat(iter.next(), is(warning));
+ assertThat(iter.next(), is(error));
+ assertThat(iter.next(), is(warning));
+ assertThat(iter.next(), is(error));
+ assertThat(iter.hasNext(), is(false));
+ assertThat(problems.size(), is(7));
+ assertThat(problems.hasErrors(), is(true));
+ assertThat(problems.hasWarnings(), is(true));
+ assertThat(problems.hasInfo(), is(true));
+ assertThat(problems.isEmpty(), is(false));
+ }
+
+}
Property changes on:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/AbstractProblemsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ProblemTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ProblemTest.java
(rev 0)
+++
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ProblemTest.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import org.jboss.dna.common.CommonI18n;
+import org.jboss.dna.common.collection.Problem.Status;
+import org.jboss.dna.common.i18n.I18n;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Randall Hauch
+ */
+public class ProblemTest {
+
+ private Problem error;
+ private Problem warning;
+ private Problem info;
+ private I18n message;
+ private Object[] messageParameters;
+ private Throwable throwable;
+ private String location;
+ private String resource;
+
+ @Before
+ public void beforeEach() throws Exception {
+ message = CommonI18n.argumentMayNotBeNull;
+ throwable = new IllegalArgumentException(message.text("throwable"));
+ messageParameters = new Object[] {"message"};
+ resource = "SomeResource";
+ location = "/Meaningless/location";
+ error = new Problem(Status.ERROR, 1, message, messageParameters, resource,
location, throwable);
+ warning = new Problem(Status.WARNING, 1, message, messageParameters, resource,
location, throwable);
+ info = new Problem(Status.INFO, 1, message, messageParameters, resource,
location, throwable);
+ }
+
+ @Test
+ public void shouldHaveToString() {
+ assertThat(error.toString(), is("ERROR: (1) " +
message.text("message") + " Resource=\"" + resource +
"\" At \""
+ + location + "\" (threw " +
throwable.getLocalizedMessage() + ")"));
+ }
+
+ @Test
+ public void shouldHaveToStringWithoutDefaultCode() {
+ error = new Problem(Status.ERROR, Problem.DEFAULT_CODE, message, new Object[]
{"message"}, null, null, null);
+ assertThat(error.toString(), is("ERROR: " +
message.text("message")));
+ }
+
+ @Test
+ public void shouldHaveMessageString() {
+ messageParameters = new Object[] {"error msg"};
+ error = new Problem(Status.ERROR, 1, message, messageParameters, resource,
location, throwable);
+ messageParameters = new Object[] {"warning msg"};
+ warning = new Problem(Status.WARNING, 1, message, messageParameters, resource,
location, throwable);
+ messageParameters = new Object[] {"info msg"};
+ info = new Problem(Status.INFO, 1, message, messageParameters, resource,
location, throwable);
+ assertThat(error.getMessageString(), is(message.text("error msg")));
+ assertThat(warning.getMessageString(), is(message.text("warning
msg")));
+ assertThat(info.getMessageString(), is(message.text("info msg")));
+ }
+}
Property changes on:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ProblemTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/SimpleProblemsTest.java
===================================================================
---
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/SimpleProblemsTest.java
(rev 0)
+++
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/SimpleProblemsTest.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+
+/**
+ * @author Randall Hauch
+ */
+public class SimpleProblemsTest extends AbstractProblemsTest {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblemsTest#createProblems()
+ */
+ @Override
+ protected Problems createProblems() {
+ return new SimpleProblems();
+ }
+}
Property changes on:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/SimpleProblemsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ThreadSafeProblemsTest.java
===================================================================
---
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ThreadSafeProblemsTest.java
(rev 0)
+++
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ThreadSafeProblemsTest.java 2008-06-25
21:39:59 UTC (rev 310)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.collection;
+
+/**
+ * @author Randall Hauch
+ */
+public class ThreadSafeProblemsTest extends AbstractProblemsTest {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.common.collection.AbstractProblemsTest#createProblems()
+ */
+ @Override
+ protected Problems createProblems() {
+ return new ThreadSafeProblems();
+ }
+}
Property changes on:
trunk/dna-common/src/test/java/org/jboss/dna/common/collection/ThreadSafeProblemsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain