abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r519854 - in /incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext: TestSuite.java features/ features/FeatureTest.java
Date Mon, 19 Mar 2007 06:41:26 GMT
Author: jmsnell
Date: Sun Mar 18 23:41:25 2007
New Revision: 519854

URL: http://svn.apache.org/viewvc?view=rev&rev=519854
Log:
Add test case for the features draft

Added:
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/FeatureTest.java
Modified:
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java

Modified: incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java?view=diff&rev=519854&r1=519853&r2=519854
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
Sun Mar 18 23:41:25 2007
@@ -21,6 +21,7 @@
 import org.apache.abdera.test.ext.opensearch.*;
 import org.apache.abdera.test.ext.thread.ThreadTest;
 import org.apache.abdera.test.ext.bidi.BidiTest;
+import org.apache.abdera.test.ext.features.FeatureTest;
 import org.apache.abdera.test.ext.history.FeedPagingTest;
 
 public class TestSuite extends junit.framework.TestSuite {
@@ -36,5 +37,6 @@
     addTestSuite(ThreadTest.class);
     addTestSuite(MediaTest.class);
     addTestSuite(BidiTest.class);
+    addTestSuite(FeatureTest.class);
   }
 }

Added: incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/FeatureTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/FeatureTest.java?view=auto&rev=519854
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/FeatureTest.java
(added)
+++ incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/features/FeatureTest.java
Sun Mar 18 23:41:25 2007
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.test.ext.features;
+
+import junit.framework.TestCase;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.ext.features.Feature;
+import org.apache.abdera.ext.features.FeaturesHelper;
+import org.apache.abdera.model.Collection;
+
+public class FeatureTest extends TestCase {
+
+  public static void testFeatures() throws Exception {
+    Abdera abdera = new Abdera();
+    Collection coll = abdera.getFactory().newCollection();
+    FeaturesHelper.addFeature(
+      coll, "http://example.com/features/foo", 
+      true, null, "foo & here");
+    FeaturesHelper.addFeature(
+      coll, "http://example.com/features/bar", 
+      false, null, null);
+    FeaturesHelper.addControl(
+      coll, "http://example.com/features/bar", 
+      false, null, null);
+    assertTrue(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/foo"));
+    assertTrue(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/bar"));
+    assertTrue(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/foo",
+            "http://example.com/features/bar"));
+    assertFalse(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/foo",
+            "http://example.com/features/pez"));
+    assertFalse(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/pez",
+            "http://example.com/features/foo"));
+    assertFalse(FeaturesHelper.supportsFeature(
+      coll, "http://example.com/features/pez"));
+    Feature f = FeaturesHelper.getFeature(
+      coll, "http://example.com/features/foo");
+    assertTrue(f.isRequired());
+  }
+  
+}



Mime
View raw message