sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1482754 - in /sis/branches/JDK7/core/sis-metadata/src: main/java/org/apache/sis/metadata/iso/identification/ test/java/org/apache/sis/metadata/iso/identification/ test/java/org/apache/sis/test/suite/
Date Wed, 15 May 2013 10:49:52 GMT
Author: desruisseaux
Date: Wed May 15 10:49:51 2013
New Revision: 1482754

URL: http://svn.apache.org/r1482754
Log:
DefaultKeywords constructor shall accept an arbitrary amount of keywords.

Added:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java?rev=1482754&r1=1482753&r2=1482754&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
[UTF-8] Wed May 15 10:49:51 2013
@@ -75,11 +75,20 @@ public class DefaultKeywords extends ISO
     /**
      * Creates keywords initialized to the given key word.
      *
-     * @param keyword Commonly used word or formalised word or phrase used to describe
-     *                the subject, or {@code null} if none.
+     * @param keywords Commonly used words or formalised words or phrases used to describe
+     *                 the subject, or {@code null} if none.
      */
-    public DefaultKeywords(final CharSequence keyword) {
-        keywords = singleton(Types.toInternationalString(keyword), InternationalString.class);
+    public DefaultKeywords(final CharSequence... keywords) {
+        if (keywords != null) {
+            for (final CharSequence keyword : keywords) {
+                final InternationalString i18n = Types.toInternationalString(keyword);
+                if (this.keywords == null) {
+                    this.keywords = singleton(i18n, InternationalString.class);
+                } else {
+                    this.keywords.add(i18n);
+                }
+            }
+        }
     }
 
     /**

Added: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java?rev=1482754&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
(added)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
[UTF-8] Wed May 15 10:49:51 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.sis.metadata.iso.identification;
+
+import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link DefaultKeywords}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+public final strictfp class DefaultKeywordsTest extends TestCase {
+    /**
+     * Tests {@link DefaultKeywords#DefaultKeywords(CharSequence[])}.
+     */
+    @Test
+    public void testConstructor() {
+        final DefaultKeywords keywords = new DefaultKeywords("Keyword 1", "Keyword 2", "Keyword
3");
+        assertArrayEquals(new Object[] {
+            new SimpleInternationalString("Keyword 1"),
+            new SimpleInternationalString("Keyword 2"),
+            new SimpleInternationalString("Keyword 3")
+        }, keywords.getKeywords().toArray());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultKeywordsTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1482754&r1=1482753&r2=1482754&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Wed May 15 10:49:51 2013
@@ -33,6 +33,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
     org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
     org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultKeywordsTest.class,
     org.apache.sis.metadata.iso.identification.DefaultResolutionTest.class,
     org.apache.sis.metadata.iso.spatial.DefaultGeorectifiedTest.class,
     org.apache.sis.metadata.iso.maintenance.DefaultScopeDescriptionTest.class,



Mime
View raw message