incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1462035 - in /incubator/droids/branches/0.2.x-cleanup/droids-core/src: main/java/org/apache/droids/core/ test/java/org/apache/droids/core/ test/java/org/apache/droids/filter/
Date Thu, 28 Mar 2013 11:07:55 GMT
Author: tobr
Date: Thu Mar 28 11:07:55 2013
New Revision: 1462035

URL: http://svn.apache.org/r1462035
Log:
renamed and moved test/SimpleTask to core/BasicTask to have a basic implmentation of Task
used in the parser and filter tests

Added:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/BasicTask.java
      - copied, changed from r1461504, incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/SimpleTask.java
Removed:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/SimpleTask.java
Modified:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleQueue.java
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleTaskQueueWithHistory.java
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/filter/FragmentsFilterTest.java

Copied: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/BasicTask.java
(from r1461504, incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/SimpleTask.java)
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/BasicTask.java?p2=incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/BasicTask.java&p1=incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/SimpleTask.java&r1=1461504&r2=1462035&rev=1462035&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/SimpleTask.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/BasicTask.java
Thu Mar 28 11:07:55 2013
@@ -19,7 +19,10 @@ package org.apache.droids.core;
 import java.net.URI;
 import java.util.Date;
 
-public class SimpleTask implements Task {
+/**
+ * Basic Implementation of a task.
+ */
+public class BasicTask implements Task {
     private URI uri;
     private int depth;
     private boolean aborted;
@@ -28,7 +31,11 @@ public class SimpleTask implements Task 
 
     private static final long serialVersionUID = 2506491803180939447L;
 
-    public SimpleTask(URI uri, int depth) {
+    public BasicTask(URI uri) {
+        this(uri, 0);
+    }
+
+    public BasicTask(URI uri, int depth) {
         this.uri = uri;
         this.depth = depth;
         this.aborted = false;
@@ -74,7 +81,7 @@ public class SimpleTask implements Task 
     @SuppressWarnings("unchecked")
     @Override
     public Task createTask(URI uri) {
-        return new SimpleTask(uri, this.getDepth());
+        return new BasicTask(uri, this.getDepth());
     }
 
 }

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleQueue.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleQueue.java?rev=1462035&r1=1462034&r2=1462035&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleQueue.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleQueue.java
Thu Mar 28 11:07:55 2013
@@ -18,38 +18,37 @@ package org.apache.droids.core;
 
 import java.net.URI;
 
-import junit.framework.Assert;
-
+import static org.junit.Assert.*;
 import org.apache.droids.filter.MaxDepthTaskFilter;
 import org.junit.Before;
 import org.junit.Test;
 
 public class TestSimpleQueue {
 
-    MaxDepthTaskFilter<SimpleTask> filter;
+    MaxDepthTaskFilter<BasicTask> filter;
 
     @Before
     public final void initialize() {
-        filter = new MaxDepthTaskFilter<SimpleTask>();
+        filter = new MaxDepthTaskFilter<BasicTask>();
         filter.setMaxDepth(5);
     }
 
     @Test
     public void whenTaskBelowMaxDepthIsValidated_thenTaskIsValid() throws Exception {
-        final SimpleTask task = new SimpleTask(new URI("http://www.example.com"), 3);
-        Assert.assertNotNull(filter.filter(task));
+        final BasicTask task = new BasicTask(new URI("http://www.example.com"), 3);
+        assertNotNull(filter.filter(task));
     }
 
     @Test
     public void whenTaskEqualToMaxDepthIsValidated_thenTaskIsValid() throws Exception {
-        final SimpleTask task = new SimpleTask(new URI("http://www.example.com"), 5);
-        Assert.assertNotNull(filter.filter(task));
+        final BasicTask task = new BasicTask(new URI("http://www.example.com"), 5);
+        assertNotNull(filter.filter(task));
     }
 
     @Test
     public void whenTaskOverMaxDepthIsValidated_thenTaskIsNotValid() throws Exception {
-        final SimpleTask task = new SimpleTask(new URI("http://www.example.com"), 7);
-        Assert.assertNull(filter.filter(task));
+        final BasicTask task = new BasicTask(new URI("http://www.example.com"), 7);
+        assertNull(filter.filter(task));
     }
 
 }

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleTaskQueueWithHistory.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleTaskQueueWithHistory.java?rev=1462035&r1=1462034&r2=1462035&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleTaskQueueWithHistory.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/core/TestSimpleTaskQueueWithHistory.java
Thu Mar 28 11:07:55 2013
@@ -24,10 +24,6 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.Queue;
 
-import junit.framework.Assert;
-
-import org.apache.droids.core.SimpleTaskQueueWithHistory;
-import org.apache.droids.core.Task;
 import org.junit.Test;
 
 public class TestSimpleTaskQueueWithHistory {
@@ -38,38 +34,38 @@ public class TestSimpleTaskQueueWithHist
         Task task;
 
         queue = new SimpleTaskQueueWithHistory<Task>();
-        Assert.assertEquals(0, queue.size());
+        assertEquals(0, queue.size());
         uri = new URI("http://www.example.com");
-        Assert.assertNotNull(uri);
-        task = new SimpleTask(uri, 1);
-        Assert.assertNotNull(task);
+        assertNotNull(uri);
+        task = new BasicTask(uri, 1);
+        assertNotNull(task);
         queue.offer(task);
-        Assert.assertEquals(1, queue.size());
+        assertEquals(1, queue.size());
         queue.offer(task);
-        Assert.assertEquals(1, queue.size());
+        assertEquals(1, queue.size());
         queue.poll();
-        Assert.assertEquals(0, queue.size());
+        assertEquals(0, queue.size());
         queue.offer(task);
-        Assert.assertEquals(0, queue.size());
+        assertEquals(0, queue.size());
     }
 
     @Test
     public void testAddAll() throws URISyntaxException {
         Collection<Task> links = new LinkedList<Task>();
-        links.add(new SimpleTask(new URI("http://www.example.com"), 0));
-        links.add(new SimpleTask(new URI("http://www.example.com/1"), 1));
-        links.add(new SimpleTask(new URI("http://www.example.com/2"), 1));
-        links.add(new SimpleTask(new URI("http://www.example.com/3"), 1));
-        links.add(new SimpleTask(new URI("http://www.example.com/4"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com"), 0));
+        links.add(new BasicTask(new URI("http://www.example.com/1"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/2"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/3"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/4"), 1));
 
         Queue<Task> queue = new SimpleTaskQueueWithHistory<Task>();
         assertEquals(0, queue.size());
         queue.addAll(links);
         assertEquals(5, queue.size());
 
-        links.add(new SimpleTask(new URI("http://www.example.com/1"), 1));
-        links.add(new SimpleTask(new URI("http://www.example.com/5"), 1));
-        links.add(new SimpleTask(new URI("http://www.example.com/2"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/1"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/5"), 1));
+        links.add(new BasicTask(new URI("http://www.example.com/2"), 1));
 
         queue.addAll(links);
         assertEquals(6, queue.size());

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/filter/FragmentsFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/filter/FragmentsFilterTest.java?rev=1462035&r1=1462034&r2=1462035&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/filter/FragmentsFilterTest.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/test/java/org/apache/droids/filter/FragmentsFilterTest.java
Thu Mar 28 11:07:55 2013
@@ -1,7 +1,7 @@
 package org.apache.droids.filter;
 
+import org.apache.droids.core.BasicTask;
 import org.apache.droids.core.Filter;
-import org.apache.droids.core.SimpleTask;
 import org.apache.droids.core.Task;
 import org.junit.Test;
 import static org.junit.Assert.*;
@@ -21,7 +21,7 @@ public class FragmentsFilterTest {
     private String path = "/droids/";
     private String fragment = "top";
 
-    private Filter<SimpleTask> fragmentFilter = new FragmentFilter<SimpleTask>();
+    private Filter<BasicTask> fragmentFilter = new FragmentFilter<BasicTask>();
 
 
     @Test
@@ -34,7 +34,7 @@ public class FragmentsFilterTest {
         try {
             URI uri = new URI(scheme, host, path, fragment);
 
-            Task task = fragmentFilter.filter(new SimpleTask(uri, 0));
+            Task task = fragmentFilter.filter(new BasicTask(uri, 0));
             assertThat(uri, not(task.getURI()));
             assertThat(new URI(uri.toString().substring(0, uri.toString().indexOf('#'))),
is(task.getURI()));
         } catch (URISyntaxException e) {
@@ -46,7 +46,7 @@ public class FragmentsFilterTest {
     public void testEmptyFilterFragment() {
         try {
             URI uri = new URI(scheme, host, path, null);
-            Task task = fragmentFilter.filter(new SimpleTask(uri, 0));
+            Task task = fragmentFilter.filter(new BasicTask(uri, 0));
 
             assertThat(uri, is(task.getURI()));
         } catch (URISyntaxException e) {



Mime
View raw message