sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1614193 - in /sis/branches/JDK8/core/sis-metadata/src: main/java/org/apache/sis/internal/jaxb/code/ test/java/org/apache/sis/metadata/iso/service/ test/java/org/apache/sis/test/suite/
Date Mon, 28 Jul 2014 21:42:07 GMT
Author: desruisseaux
Date: Mon Jul 28 21:42:07 2014
New Revision: 1614193

URL: http://svn.apache.org/r1614193
Log:
Bug fix: enum shall not be marshalled when null.

Added:
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java?rev=1614193&r1=1614192&r2=1614193&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
[UTF-8] Mon Jul 28 21:42:07 2014
@@ -58,6 +58,9 @@ public final class SV_ParameterDirection
      */
     @Override
     public final SV_ParameterDirection marshal(final ParameterDirection e) {
+        if (e == null) {
+            return null;
+        }
         final SV_ParameterDirection wrapper = new SV_ParameterDirection();
         wrapper.value = value(e);
         return wrapper;

Added: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java?rev=1614193&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java
(added)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java
[UTF-8] Mon Jul 28 21:42:07 2014
@@ -0,0 +1,54 @@
+/*
+ * 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.service;
+
+import javax.xml.bind.JAXBException;
+import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.xml.Namespaces;
+import org.junit.Test;
+
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link DefaultParameter}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.5
+ * @version 0.5
+ * @module
+ */
+public final strictfp class DefaultParameterTest extends XMLTestCase {
+    /**
+     * Tests marshalling of an empty parameter. The main purpose is to ensure that
+     * the XML does not contains spurious elements like empty enumeration wrapper.
+     *
+     * @throws JAXBException if an error occurred during marshalling.
+     */
+    @Test
+    public void testMarshalEmpty() throws JAXBException {
+        final String xml = marshal(new DefaultParameter());
+        assertXmlEquals(
+                "<srv:SV_Parameter xmlns:srv=\"" + Namespaces.SRV + '"' +
+                                 " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+                "  <srv:repeatability>\n" +
+                "    <gco:Boolean>false</gco:Boolean>\n" +
+                "  </srv:repeatability>\n" +
+                "</srv:SV_Parameter>\n",
+                xml, "xlmns:*");
+    }
+}

Propchange: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultParameterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java?rev=1614193&r1=1614192&r2=1614193&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
[UTF-8] Mon Jul 28 21:42:07 2014
@@ -42,7 +42,10 @@ import static org.apache.sis.internal.sy
  * @version 0.5
  * @module
  */
-@DependsOn(org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class)
+@DependsOn({
+    org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class,
+    DefaultParameterTest.class
+})
 public final strictfp class DefaultServiceIdentificationTest extends XMLTestCase {
     /**
      * An XML file in this package containing a service identification.

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1614193&r1=1614192&r2=1614193&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Mon Jul 28 21:42:07 2014
@@ -73,6 +73,7 @@ import org.junit.BeforeClass;
     org.apache.sis.metadata.iso.identification.DefaultResolutionTest.class,
     org.apache.sis.metadata.iso.identification.DefaultBrowseGraphicTest.class,
     org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class,
+    org.apache.sis.metadata.iso.service.DefaultParameterTest.class,
     org.apache.sis.metadata.iso.service.DefaultServiceIdentificationTest.class,
     org.apache.sis.metadata.iso.quality.AbstractElementTest.class,
     org.apache.sis.metadata.iso.quality.AbstractPositionalAccuracyTest.class,



Mime
View raw message