DNA SVN: r438 - trunk/dna-common/src/test/java/org/jboss/dna/common.
by dna-commits@lists.jboss.org
Author: jverhaeg(a)redhat.com
Date: 2008-08-18 12:58:48 -0400 (Mon, 18 Aug 2008)
New Revision: 438
Modified:
trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java
Log:
DNA-206: Changed AbstractI18nTest to have a single test that first analyzes i18n fields for problems, then checks for global problems, where field checking triggers lazy localization that may reveal global problems.
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java 2008-08-17 22:33:27 UTC (rev 437)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java 2008-08-18 16:58:48 UTC (rev 438)
@@ -45,26 +45,30 @@
@Test
@SuppressWarnings( "unchecked" )
- public void shouldNotHaveLocalizationProblems() throws Exception {
- Method method = i18nClass.getDeclaredMethod("getLocalizationProblemLocales", (Class[])null);
- Set<Locale> locales = (Set<Locale>)method.invoke(null, (Object[])null);
- method = i18nClass.getDeclaredMethod("getLocalizationProblems", Locale.class);
- for (Locale locale : locales) {
- assertThat(((Set<String>)method.invoke(null, locale)).isEmpty(), is(true));
- }
- }
-
- @Test
- public void shouldNotHaveProblems() throws IllegalAccessException {
+ public void shouldNotHaveProblems() throws Exception {
for (Field fld : i18nClass.getDeclaredFields()) {
if (fld.getType() == I18n.class && (fld.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC
&& (fld.getModifiers() & Modifier.STATIC) == Modifier.STATIC
&& (fld.getModifiers() & Modifier.FINAL) != Modifier.FINAL) {
I18n i18n = (I18n)fld.get(null);
if (i18n.hasProblem()) {
- fail();
+ fail(i18n.problem());
}
}
}
+ // Check for global problems after checking field problems since global problems are detected lazily upon field usage
+ Method method = i18nClass.getDeclaredMethod("getLocalizationProblemLocales", (Class[])null);
+ Set<Locale> locales = (Set<Locale>)method.invoke(null, (Object[])null);
+ if (!locales.isEmpty()) {
+ method = i18nClass.getDeclaredMethod("getLocalizationProblems", Locale.class);
+ for (Locale locale : locales) {
+ Set<String> problems = (Set<String>)method.invoke(null, locale);
+ try {
+ assertThat(problems.isEmpty(), is(true));
+ } catch (AssertionError error) {
+ fail(problems.iterator().next());
+ }
+ }
+ }
}
}
15 years, 10 months
DNA SVN: r437 - in trunk: docs/examples/gettingstarted and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-17 18:33:27 -0400 (Sun, 17 Aug 2008)
New Revision: 437
Modified:
trunk/docs/examples/gettingstarted/pom.xml
trunk/docs/examples/gettingstarted/sequencers/pom.xml
trunk/pom.xml
Log:
DNA-204 Unit tests for dna-example-sequencers are not being executed in the Maven builds in the nightly Hudson jobs
http://jira.jboss.com/jira/browse/DNA-204
Added the example project(s) to the default profile for the Maven builds. We're getting to the point where the unit tests take a while to run, so we may want to create a reduced set of the projects for the developers to run locally. (I don't think we're there yet.)
Modified: trunk/docs/examples/gettingstarted/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/pom.xml 2008-08-17 22:12:24 UTC (rev 436)
+++ trunk/docs/examples/gettingstarted/pom.xml 2008-08-17 22:33:27 UTC (rev 437)
@@ -5,7 +5,7 @@
<artifactId>getting_started</artifactId>
<packaging>pom</packaging>
<version>0.2-SNAPSHOT</version>
- <name>Getting Started examples</name>
+ <name>JBoss DNA Getting Started examples</name>
<description />
<modules>
Modified: trunk/docs/examples/gettingstarted/sequencers/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/pom.xml 2008-08-17 22:12:24 UTC (rev 436)
+++ trunk/docs/examples/gettingstarted/sequencers/pom.xml 2008-08-17 22:33:27 UTC (rev 437)
@@ -12,7 +12,7 @@
<artifactId>dna-example-sequencers</artifactId>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Sequencer Examples</name>
+ <name>JBoss DNA Sequencer Examples</name>
<description>Examples that showcase how to use sequencers with a JCR repository.</description>
<properties>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-08-17 22:12:24 UTC (rev 436)
+++ trunk/pom.xml 2008-08-17 22:33:27 UTC (rev 437)
@@ -110,6 +110,7 @@
<module>extensions/dna-connector-jbosscache</module>
<module>extensions/dna-mimetype-detector-aperture</module>
<module>dna-integration-tests</module>
+ <module>docs/examples/gettingstarted</module>
</modules>
<properties>
15 years, 10 months
DNA SVN: r436 - trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-17 18:12:24 -0400 (Sun, 17 Aug 2008)
New Revision: 436
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
Log:
DNA-203 - Unit tests for dna-example-sequencers don't work
http://jira.jboss.com/jira/browse/DNA-203
This must have regressed when we upgraded to Jackrabbit 1.4.5, but the unit tests for the examples were apparently not included in the continuous builds. (See DNA-204 for that.) We're blindly setting the "jcr:primaryType" property (along with all other properties) on all the nodes, but since that's supplied when creating the node, resetting the "jcr:primaryType" property is not necessary (and apparently no longer allowed). Added a check in the StreamSequencerAdapter to skip (re)setting this property on each node.
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java 2008-08-16 17:53:35 UTC (rev 435)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java 2008-08-17 22:12:24 UTC (rev 436)
@@ -183,6 +183,7 @@
final PathFactory pathFactory = context.getValueFactories().getPathFactory();
final NamespaceRegistry namespaceRegistry = context.getNamespaceRegistry();
final Path outputNodePath = pathFactory.create(outputNode.getPath());
+ final Name jcrPrimaryTypePropertyName = context.getValueFactories().getNameFactory().create("jcr:primaryType");
// Iterate over the entries in the output, in Path's natural order (shorter paths first and in lexicographical order by
// prefix and name)
@@ -223,6 +224,14 @@
for (SequencerOutputMap.PropertyValue property : entry.getPropertyValues()) {
String propertyName = property.getName().getString(namespaceRegistry, Path.NO_OP_ENCODER);
Object value = property.getValue();
+ if (jcrPrimaryTypePropertyName.equals(property.getName())) {
+ // Skip the primary type property (which is protected in Jackrabbit 1.5)
+ Logger.getLogger(this.getClass()).trace("Skipping property {0}/{1}={2}",
+ targetNode.getPath(),
+ propertyName,
+ value);
+ continue;
+ }
Logger.getLogger(this.getClass()).trace("Writing property {0}/{1}={2}", targetNode.getPath(), propertyName, value);
if (value instanceof Boolean) {
targetNode.setProperty(propertyName, ((Boolean)value).booleanValue());
15 years, 10 months
DNA SVN: r435 - trunk.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-16 13:53:35 -0400 (Sat, 16 Aug 2008)
New Revision: 435
Modified:
trunk/eclipse-preferences.epf
Log:
Added static favorites for new Mockito stubbing methods: doReturn(), doThrow(), doAnswer(), and doNothing(); also new anyCollection(), anyList(), and anyMap() methods
Modified: trunk/eclipse-preferences.epf
===================================================================
--- trunk/eclipse-preferences.epf 2008-08-15 23:09:52 UTC (rev 434)
+++ trunk/eclipse-preferences.epf 2008-08-16 17:53:35 UTC (rev 435)
@@ -72,7 +72,7 @@
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source=1.5
-/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.!
JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.stub;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matcher!
s.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteTh
at;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.jboss.dna.common.text.StringMatcher.startsWith;org.jboss.dna.spi.graph.connection.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.jboss.dna.common.collection.IsIteratorContaining.hasItems;org.jboss.dna.common.collection.IsIteratorContaining.hasItem.*
+/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.!
JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.stub;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matcher!
s.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteTh
at;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.jboss.dna.common.text.StringMatcher.startsWith;org.jboss.dna.spi.graph.connection.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.jboss.dna.common.collection.IsIteratorContaining.hasItems;org.jboss.dna.common.collection.IsIteratorContaining.hasItem.*;org.mockito.Mockito.doReturn;org.mockito.Mockito.doThrow;org.mockito.Mockito.doAnswer;org.mockito.Mockito.doNothing;org.mockito.Mockito.anyList;org.mockito.Mockito.anyMap;org.mockito.M!
ockito.anyCollection
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.gettersetter.use.is=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ignorelowercasenames=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=\#;java;javax;org;com;
15 years, 10 months
DNA SVN: r434 - trunk/dna-common/src/main/java/org/jboss/dna/common/util.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-15 19:09:52 -0400 (Fri, 15 Aug 2008)
New Revision: 434
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
Log:
Added to the JavaDoc that the method throws an IllegalArgumentException if the parameter is null, empty or blank.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 23:08:17 UTC (rev 433)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 23:09:52 UTC (rev 434)
@@ -65,9 +65,10 @@
/**
* Utility to convert {@link File} to {@link URL}.
*
- * @param filePath - the path of the file.
+ * @param filePath the path of the file
* @return the {@link URL} representation of the file.
* @throws MalformedURLException
+ * @throws IllegalArgumentException if the file path is null, empty or blank
*/
public static URL convertFileToURL( String filePath ) throws MalformedURLException {
ArgCheck.isNotEmpty(filePath, "filePath");
15 years, 10 months
DNA SVN: r433 - trunk/dna-common/src/main/java/org/jboss/dna/common/util.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-15 19:08:17 -0400 (Fri, 15 Aug 2008)
New Revision: 433
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
Log:
Corrected checking of parameters by using the ArgCheck utility, which performs the internationalization of the exception and which checks for an empty or blank string more efficiently. Also trimmed in input string.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 20:53:01 UTC (rev 432)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 23:08:17 UTC (rev 433)
@@ -31,6 +31,7 @@
/**
* Delete the file or directory at the supplied path. This method works on a directory that is not empty, unlike the
* {@link File#delete()} method.
+ *
* @param path the path to the file or directory that is to be deleted
* @return true if the file or directory at the supplied path existed and was successfully deleted, or false otherwise
*/
@@ -42,6 +43,7 @@
/**
* Delete the file or directory given by the supplied reference. This method works on a directory that is not empty, unlike
* the {@link File#delete()} method.
+ *
* @param fileOrDirectory the reference to the Java File object that is to be deleted
* @return true if the supplied file or directory existed and was successfully deleted, or false otherwise
*/
@@ -59,19 +61,17 @@
// Whether this is a file or empty directory, just delete it ...
return fileOrDirectory.delete();
}
-
+
/**
* Utility to convert {@link File} to {@link URL}.
*
* @param filePath - the path of the file.
* @return the {@link URL} representation of the file.
- * @throws MalformedURLException
+ * @throws MalformedURLException
*/
public static URL convertFileToURL( String filePath ) throws MalformedURLException {
- if(filePath == null || filePath.equals("")) {
- throw new IllegalArgumentException("file path is nil");
- }
- File file = new File(filePath);
+ ArgCheck.isNotEmpty(filePath, "filePath");
+ File file = new File(filePath.trim());
return file.toURI().toURL();
}
15 years, 10 months
DNA SVN: r432 - trunk/dna-common/src/main/java/org/jboss/dna/common/util.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-15 16:53:01 -0400 (Fri, 15 Aug 2008)
New Revision: 432
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
Log:
Utility to convert File} to URL
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 20:24:19 UTC (rev 431)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-08-15 20:53:01 UTC (rev 432)
@@ -23,6 +23,8 @@
package org.jboss.dna.common.util;
import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
public class FileUtil {
@@ -57,5 +59,20 @@
// Whether this is a file or empty directory, just delete it ...
return fileOrDirectory.delete();
}
+
+ /**
+ * Utility to convert {@link File} to {@link URL}.
+ *
+ * @param filePath - the path of the file.
+ * @return the {@link URL} representation of the file.
+ * @throws MalformedURLException
+ */
+ public static URL convertFileToURL( String filePath ) throws MalformedURLException {
+ if(filePath == null || filePath.equals("")) {
+ throw new IllegalArgumentException("file path is nil");
+ }
+ File file = new File(filePath);
+ return file.toURI().toURL();
+ }
}
15 years, 10 months
DNA SVN: r431 - in trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph: impl and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-08-15 16:24:19 -0400 (Fri, 15 Aug 2008)
New Revision: 431
Modified:
trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/DateTime.java
trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/JodaDateTime.java
Log:
DNA-202 - DateTime interface in SPI should have methods that return offsets into the future or past
http://jira.jboss.com/jira/browse/DNA-202
Added "plus" and "minus" methods to allow offseting by number of weeks, days, years, months, seconds, minutes, hours, milliseconds, etc.
Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/DateTime.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/DateTime.java 2008-08-14 21:41:37 UTC (rev 430)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/DateTime.java 2008-08-15 20:24:19 UTC (rev 431)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
import net.jcip.annotations.Immutable;
/**
@@ -270,4 +271,152 @@
*/
boolean isSameAs( DateTime other );
+ /**
+ * Subtract the specified about of time in the supplied units.
+ *
+ * @param timeAmount the amount of time to subtract
+ * @param unit the units of the amount of time; may not be null
+ * @return the instance in time the specified number of time before this instant
+ */
+ DateTime minus( long timeAmount,
+ TimeUnit unit );
+
+ /**
+ * Subtract the specified number of days from this time instant.
+ *
+ * @param days the number of days to subtract
+ * @return the instance in time the specified number of days before this instant
+ */
+ DateTime minusDays( int days );
+
+ /**
+ * Subtract the specified number of hours from this time instant.
+ *
+ * @param hours the number of hours to subtract
+ * @return the instance in time the specified number of hours before this instant
+ */
+ DateTime minusHours( int hours );
+
+ /**
+ * Subtract the specified number of milliseconds from this time instant.
+ *
+ * @param milliseconds the number of milliseconds to subtract
+ * @return the instance in time the specified number of milliseconds before this instant
+ */
+ DateTime minusMillis( int milliseconds );
+
+ /**
+ * Subtract the specified number of minutes from this time instant.
+ *
+ * @param minutes the number of minutes to subtract
+ * @return the instance in time the specified number of minutes before this instant
+ */
+ DateTime minusMinutes( int minutes );
+
+ /**
+ * Subtract the specified number of months from this time instant.
+ *
+ * @param months the number of months to subtract
+ * @return the instance in time the specified number of months before this instant
+ */
+ DateTime minusMonths( int months );
+
+ /**
+ * Subtract the specified number of seconds from this time instant.
+ *
+ * @param seconds the number of seconds to subtract
+ * @return the instance in time the specified number of seconds before this instant
+ */
+ DateTime minusSeconds( int seconds );
+
+ /**
+ * Subtract the specified number of weeks from this time instant.
+ *
+ * @param weeks the number of weeks to subtract
+ * @return the instance in time the specified number of weeks before this instant
+ */
+ DateTime minusWeeks( int weeks );
+
+ /**
+ * Subtract the specified number of years from this time instant.
+ *
+ * @param years the number of years to subtract
+ * @return the instance in time the specified number of years before this instant
+ */
+ DateTime minusYears( int years );
+
+ /**
+ * Add the specified about of time in the supplied units.
+ *
+ * @param timeAmount the amount of time to add
+ * @param unit the units of the amount of time; may not be null
+ * @return the instance in time the specified number of time after this instant
+ */
+ DateTime plus( long timeAmount,
+ TimeUnit unit );
+
+ /**
+ * Add the specified number of days from this time instant.
+ *
+ * @param days the number of days to add
+ * @return the instance in time the specified number of days after this instant
+ */
+ DateTime plusDays( int days );
+
+ /**
+ * Add the specified number of hours from this time instant.
+ *
+ * @param hours the number of hours to add
+ * @return the instance in time the specified number of hours after this instant
+ */
+ DateTime plusHours( int hours );
+
+ /**
+ * Add the specified number of milliseconds from this time instant.
+ *
+ * @param milliseconds the number of milliseconds to add
+ * @return the instance in time the specified number of milliseconds after this instant
+ */
+ DateTime plusMillis( int milliseconds );
+
+ /**
+ * Add the specified number of minutes from this time instant.
+ *
+ * @param minutes the number of minutes to add
+ * @return the instance in time the specified number of minutes after this instant
+ */
+ DateTime plusMinutes( int minutes );
+
+ /**
+ * Add the specified number of months from this time instant.
+ *
+ * @param months the number of months to add
+ * @return the instance in time the specified number of months after this instant
+ */
+ DateTime plusMonths( int months );
+
+ /**
+ * Add the specified number of seconds from this time instant.
+ *
+ * @param seconds the number of seconds to add
+ * @return the instance in time the specified number of seconds after this instant
+ */
+ DateTime plusSeconds( int seconds );
+
+ /**
+ * Add the specified number of weeks from this time instant.
+ *
+ * @param weeks the number of weeks to add
+ * @return the instance in time the specified number of weeks after this instant
+ */
+ DateTime plusWeeks( int weeks );
+
+ /**
+ * Add the specified number of years from this time instant.
+ *
+ * @param years the number of years to add
+ * @return the instance in time the specified number of years after this instant
+ */
+ DateTime plusYears( int years );
+
}
Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/JodaDateTime.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/JodaDateTime.java 2008-08-14 21:41:37 UTC (rev 430)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/JodaDateTime.java 2008-08-15 20:24:19 UTC (rev 431)
@@ -25,6 +25,7 @@
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.ArgCheck;
import org.joda.time.Chronology;
@@ -403,4 +404,170 @@
return this.compareTo(other) > 0;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minus(long, java.util.concurrent.TimeUnit)
+ */
+ public org.jboss.dna.spi.graph.DateTime minus( long timeAmount,
+ TimeUnit unit ) {
+ ArgCheck.isNotNull(unit, "unit");
+ return new JodaDateTime(this.instance.minus(TimeUnit.MILLISECONDS.convert(timeAmount, unit)));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusDays(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusDays( int days ) {
+ return new JodaDateTime(this.instance.minusDays(days));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusHours(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusHours( int hours ) {
+ return new JodaDateTime(this.instance.minusHours(hours));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusMillis(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusMillis( int milliseconds ) {
+ return new JodaDateTime(this.instance.minusMillis(milliseconds));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusMinutes(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusMinutes( int minutes ) {
+ return new JodaDateTime(this.instance.minusMinutes(minutes));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusMonths(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusMonths( int months ) {
+ return new JodaDateTime(this.instance.minusMonths(months));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusSeconds(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusSeconds( int seconds ) {
+ return new JodaDateTime(this.instance.minusSeconds(seconds));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusWeeks(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusWeeks( int weeks ) {
+ return new JodaDateTime(this.instance.minusWeeks(weeks));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#minusYears(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime minusYears( int years ) {
+ return new JodaDateTime(this.instance.minusYears(years));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plus(long, java.util.concurrent.TimeUnit)
+ */
+ public org.jboss.dna.spi.graph.DateTime plus( long timeAmount,
+ TimeUnit unit ) {
+ ArgCheck.isNotNull(unit, "unit");
+ return new JodaDateTime(this.instance.plus(TimeUnit.MILLISECONDS.convert(timeAmount, unit)));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusDays(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusDays( int days ) {
+ return new JodaDateTime(this.instance.plusDays(days));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusHours(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusHours( int hours ) {
+ return new JodaDateTime(this.instance.plusHours(hours));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusMillis(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusMillis( int milliseconds ) {
+ return new JodaDateTime(this.instance.plusMillis(milliseconds));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusMinutes(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusMinutes( int minutes ) {
+ return new JodaDateTime(this.instance.plusMinutes(minutes));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusMonths(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusMonths( int months ) {
+ return new JodaDateTime(this.instance.plusMonths(months));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusSeconds(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusSeconds( int seconds ) {
+ return new JodaDateTime(this.instance.plusSeconds(seconds));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusWeeks(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusWeeks( int weeks ) {
+ return new JodaDateTime(this.instance.plusWeeks(weeks));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.spi.graph.DateTime#plusYears(int)
+ */
+ public org.jboss.dna.spi.graph.DateTime plusYears( int years ) {
+ return new JodaDateTime(this.instance.plusYears(years));
+ }
+
}
15 years, 10 months
DNA SVN: r430 - trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-14 17:41:37 -0400 (Thu, 14 Aug 2008)
New Revision: 430
Modified:
trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java
Log:
support for sequencing constructors/methods with or without primitive type parameters, return primitive type and more test
Modified: trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java 2008-08-14 21:41:08 UTC (rev 429)
+++ trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java 2008-08-14 21:41:37 UTC (rev 430)
@@ -56,7 +56,7 @@
this.j = j;
}
- public void doSomething(int p1, int p2) {
+ public void doSomething(int p1, double p2) {
l = new ArrayList<String>();
l.add("N1");
}
15 years, 10 months
DNA SVN: r429 - trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-14 17:41:08 -0400 (Thu, 14 Aug 2008)
New Revision: 429
Modified:
trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
Log:
support for sequencing constructors/methods with or without primitive type parameters, return primitive type and more test
Modified: trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java 2008-08-14 21:40:16 UTC (rev 428)
+++ trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java 2008-08-14 21:41:08 UTC (rev 429)
@@ -159,13 +159,17 @@
// is(new Object[] {"x"}));
// support for methods sequencing (modifiers, return type, method name, parameters).Not supported are javadoc
+
+ // MySource() constructor
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[1]",
"java:name"),
is(new Object[] {"MySource"}));
+ // public MySource(int i, int j) constructor with parameters
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:modifier/java:modifierDeclaration[1]",
"java:modifierName"),
is(new Object[] {"public"}));
+
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]",
"java:name"),
is(new Object[] {"MySource"}));
@@ -184,15 +188,56 @@
"java:variableName"),
is(new Object[] {"j"}));
+ // public int getI() method
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[1]/java:modifier/java:modifierDeclaration[1]",
+ "java:modifierName"),
+ is(new Object[] {"public"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[1]/java:resultType/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"int"}));
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[1]",
"java:name"),
is(new Object[] {"getI"}));
+
+ // public void setI(int i) method
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:modifier/java:modifierDeclaration[1]",
+ "java:modifierName"),
+ is(new Object[] {"public"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:resultType/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"void"}));
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]",
"java:name"),
is(new Object[] {"setI"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"int"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:variable",
+ "java:variableName"),
+ is(new Object[] {"i"}));
+
+ // public void doSomething(int p1, int p2) method
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:modifier/java:modifierDeclaration[1]",
+ "java:modifierName"),
+ is(new Object[] {"public"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:resultType/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"void"}));
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]",
"java:name"),
is(new Object[] {"doSomething"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"int"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:variable",
+ "java:variableName"),
+ is(new Object[] {"p1"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType",
+ "java:typeName"),
+ is(new Object[] {"double"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType/java:variable",
+ "java:variableName"),
+ is(new Object[] {"p2"}));
}
Modified: trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java 2008-08-14 21:40:16 UTC (rev 428)
+++ trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java 2008-08-14 21:41:08 UTC (rev 429)
@@ -210,28 +210,28 @@
MethodTypeMemberMetadata methodTypeMemberMetadata1 = (MethodTypeMemberMetadata)methods.get(2);
assertTrue(methodTypeMemberMetadata1.getModifiers().size() == 1);
- assertEquals(methodTypeMemberMetadata1.getReturnType().getName(), "int");
+ assertEquals(methodTypeMemberMetadata1.getReturnType().getType(), "int");
assertNotNull(methodTypeMemberMetadata1);
assertThat(methodTypeMemberMetadata1.getName(), is("getI"));
assertTrue(methodTypeMemberMetadata1.getParameters().size() == 0);
MethodTypeMemberMetadata methodTypeMemberMetadata3 = (MethodTypeMemberMetadata)methods.get(3);
assertTrue(methodTypeMemberMetadata3.getModifiers().size() == 1);
- assertEquals(methodTypeMemberMetadata3.getReturnType().getName(), "void");
+ assertEquals(methodTypeMemberMetadata3.getReturnType().getType(), "void");
assertNotNull(methodTypeMemberMetadata3);
assertThat(methodTypeMemberMetadata3.getName(), is("setI"));
assertTrue(methodTypeMemberMetadata3.getParameters().size() == 1);
MethodTypeMemberMetadata methodTypeMemberMetadata4 = (MethodTypeMemberMetadata)methods.get(4);
assertTrue(methodTypeMemberMetadata4.getModifiers().size() == 1);
- assertEquals(methodTypeMemberMetadata4.getReturnType().getName(), "void");
+ assertEquals(methodTypeMemberMetadata4.getReturnType().getType(), "void");
assertNotNull(methodTypeMemberMetadata4);
assertThat(methodTypeMemberMetadata4.getName(), is("setJ"));
assertTrue(methodTypeMemberMetadata4.getParameters().size() == 1);
MethodTypeMemberMetadata methodTypeMemberMetadata5 = (MethodTypeMemberMetadata)methods.get(5);
assertTrue(methodTypeMemberMetadata5.getModifiers().size() == 1);
- assertEquals(methodTypeMemberMetadata5.getReturnType().getName(), "void");
+ assertEquals(methodTypeMemberMetadata5.getReturnType().getType(), "void");
assertNotNull(methodTypeMemberMetadata5);
assertThat(methodTypeMemberMetadata5.getName(), is("doSomething"));
assertTrue(methodTypeMemberMetadata5.getParameters().size() == 2);
15 years, 10 months