creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1403061 - in /creadur/whisker/trunk/apache-whisker-model/src: main/java/org/apache/creadur/whisker/model/ test/java/org/apache/creadur/whisker/model/
Date Sun, 28 Oct 2012 18:19:20 GMT
Author: rdonkin
Date: Sun Oct 28 18:19:20 2012
New Revision: 1403061

URL: http://svn.apache.org/viewvc?rev=1403061&view=rev
Log:
WHISKER-6 convenience for template usage

Added:
    creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java
  (with props)
    creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java
  (with props)
    creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java
  (with props)
Modified:
    creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java

Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java?rev=1403061&r1=1403060&r2=1403061&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java
(original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java
Sun Oct 28 18:19:20 2012
@@ -14,7 +14,7 @@
  * "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. 
+ * under the License.
  */
 package org.apache.creadur.whisker.model;
 
@@ -41,7 +41,7 @@ public class WithLicense implements Comp
      * @param license License shared by contained resources,
      * not null
      * @param copyrightNotice copyright claim
-     * shared by contained resources, not null
+     * shared by contained resources, possibly null
      * @param parameters parameters to specialise
      * the license family template, not null
      * @param organisations resources grouped by
@@ -60,12 +60,23 @@ public class WithLicense implements Comp
     /**
      * Gets the copyright claim shared
      * by the resources contained.
-     * @return not null
+     * @return possibly null
      */
     public String getCopyrightNotice() {
         return this.copyrightNotice;
     }
 
+
+    /**
+     * Indicates whether a copyright notice
+     * accumpianies this license.
+     * @return true when {@link #getCopyrightNotice()} is not null,
+     * false when {@link #getCopyrightNotice()} is null
+     */
+    public boolean hasCopyrightNotice() {
+        return getCopyrightNotice() != null;
+    }
+
     /**
      * Gets the presentation name for the license
      * shared by the resources contained.

Added: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java?rev=1403061&view=auto
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java
(added)
+++ creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java
Sun Oct 28 18:19:20 2012
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+package org.apache.creadur.whisker.model;
+
+import java.util.Collection;
+import java.util.Collections;
+
+public class LicenseBuilderForTesting {
+
+    private static final String DEFAULT_NAME = "Example License";
+    private static final String DEFAULT_URL = "http://example.org";
+    private static final String DEFAULT_ID = "example.org";
+    private static final String DEFAULT_LICENSE_TEXT = "This is the license text";
+
+    boolean isSourceRequired = false;
+    String baseText = DEFAULT_LICENSE_TEXT;
+    Collection<String> expectedParameters = Collections.<String> emptyList();
+    String id = DEFAULT_ID;
+    String url = DEFAULT_URL;
+    String name = DEFAULT_NAME;
+
+    public License build() {
+        return new License(isSourceRequired, baseText, expectedParameters, id, url, name);
+    }
+}

Propchange: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/LicenseBuilderForTesting.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java?rev=1403061&view=auto
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java
(added)
+++ creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java
Sun Oct 28 18:19:20 2012
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+package org.apache.creadur.whisker.model;
+
+
+import junit.framework.TestCase;
+
+public class TestWithLicense extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testWhenCopyrightNoticeIsNull() {
+        assertFalse(new WithLicenseBuilderForTesting()
+            .withCopyrightNotice(null).build()
+                .hasCopyrightNotice());
+    }
+
+
+    public void testWhenCopyrightNoticeIsNotNull() {
+        assertTrue(new WithLicenseBuilderForTesting()
+            .withCopyrightNotice("some notice").build()
+                .hasCopyrightNotice());
+    }
+
+}

Propchange: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/TestWithLicense.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java?rev=1403061&view=auto
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java
(added)
+++ creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java
Sun Oct 28 18:19:20 2012
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+package org.apache.creadur.whisker.model;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+public class WithLicenseBuilderForTesting {
+
+    License license = new LicenseBuilderForTesting().build();
+    @SuppressWarnings("unchecked")
+    Collection<ByOrganisation> organisations = Collections.EMPTY_LIST;
+    String copyrightNotice = null;
+    @SuppressWarnings("unchecked")
+    Map<String, String> parameters = Collections.EMPTY_MAP;
+
+    public WithLicenseBuilderForTesting withCopyrightNotice(String copyrightNotice) {
+        this.copyrightNotice = copyrightNotice;
+        return this;
+    }
+
+    public WithLicense build() {
+        return new WithLicense(license, copyrightNotice, parameters, organisations);
+    }
+}

Propchange: creadur/whisker/trunk/apache-whisker-model/src/test/java/org/apache/creadur/whisker/model/WithLicenseBuilderForTesting.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message