Repository: camel
Updated Branches:
  refs/heads/master af4b48147 -> 9c4449c09


CAMEL-10359: Fixed xml queryAll API, ported groovy test to junit for uniformity


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9c4449c0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c4449c0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c4449c0

Branch: refs/heads/master
Commit: 9c4449c093ecfd5948747b710365925ed7056d71
Parents: af4b481
Author: Dhiraj Bokde <dhira...@yahoo.com>
Authored: Thu Sep 29 19:41:32 2016 -0700
Committer: Dhiraj Bokde <dhira...@yahoo.com>
Committed: Thu Sep 29 19:41:32 2016 -0700

----------------------------------------------------------------------
 .../camel-salesforce-component/pom.xml          |  6 ---
 .../internal/processor/XmlRestProcessor.java    |  1 +
 .../api/utils/DateTimeUtilsTest.groovy          | 56 --------------------
 .../salesforce/api/utils/DateTimeUtilsTest.java | 47 ++++++++++++++++
 4 files changed, 48 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9c4449c0/components/camel-salesforce/camel-salesforce-component/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml 
b/components/camel-salesforce/camel-salesforce-component/pom.xml
index 8be8836..190c681 100644
--- a/components/camel-salesforce/camel-salesforce-component/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-component/pom.xml
@@ -41,12 +41,6 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.spockframework</groupId>
-      <artifactId>spock-core</artifactId>
-      <version>1.0-groovy-2.4</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-csv</artifactId>
       <version>${commons-csv-version}</version>

http://git-wip-us.apache.org/repos/asf/camel/blob/9c4449c0/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/XmlRestProcessor.java
----------------------------------------------------------------------
diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/XmlRestProcessor.java
 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/XmlRestProcessor.java
index 418e2fd..729649a 100644
--- 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/XmlRestProcessor.java
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/XmlRestProcessor.java
@@ -138,6 +138,7 @@ public class XmlRestProcessor extends AbstractRestProcessor 
{
             break;
 
         case QUERY:
+        case QUERY_ALL:
         case QUERY_MORE:
             // need to add alias for Salesforce XML that uses SObject name as 
root element
             exchange.setProperty(RESPONSE_ALIAS, "QueryResult");

http://git-wip-us.apache.org/repos/asf/camel/blob/9c4449c0/components/camel-salesforce/camel-salesforce-component/src/test/groovy/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
----------------------------------------------------------------------
diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/test/groovy/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
 
b/components/camel-salesforce/camel-salesforce-component/src/test/groovy/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
deleted file mode 100644
index 8452fe0..0000000
--- 
a/components/camel-salesforce/camel-salesforce-component/src/test/groovy/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.camel.component.salesforce.api.utils
-
-import spock.lang.Ignore
-import spock.lang.Specification
-import spock.lang.Unroll
-
-import java.time.ZoneId
-import java.time.ZonedDateTime
-
-class DateTimeUtilsTest extends Specification {
-    @Unroll
-    def "Date #zonedDateTime should render as #result"() {
-        expect:
-        DateTimeUtils.formatDateTime(zonedDateTime) == result
-
-        where:
-        zonedDateTime                                                          
        || result
-        ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, 
ZoneId.of("UTC+01:00:21")) || "1991-12-10T12:13:14.007+01:00"
-        ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, ZoneId.of("UTC"))  
        || "1991-12-10T12:13:14.007Z"
-        ZonedDateTime.of(1700, 1, 1, 1, 13, 14, 7000000, 
ZoneId.of("UTC+00:19:21"))    || "1700-01-01T01:13:14.007+00:19"
-        ZonedDateTime.of(1700, 2, 3, 2, 13, 14, 7000000, ZoneId.of("UTC"))     
        || "1700-02-03T02:13:14.007Z"
-    }
-
-    @Unroll
-    def "Date #dateAsString should parse to #result"() {
-        expect:
-        DateTimeUtils.parseDateTime(dateAsString) == result
-
-        where:
-        dateAsString                    || result
-        "1991-12-10T12:13:14.007+01:00" || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 7000000, ZoneId.of("+01:00"))
-        "1991-12-10T12:13:14+00:00"     || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
-        "1991-12-10T12:13:14.000+00:00" || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
-        "1991-12-10T12:13:14+0000"      || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
-        "1991-12-10T12:13:14.000+0000"  || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
-        "1991-12-10T12:13:14.007Z"      || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 7000000, ZoneId.of("Z"))
-        "1700-01-01T01:13:14.007+00:19" || ZonedDateTime.of(1700, 1, 1, 1, 13, 
14, 7000000, ZoneId.of("+00:19"))
-        "1700-02-03T02:13:14.007Z"      || ZonedDateTime.of(1700, 2, 3, 2, 13, 
14, 7000000, ZoneId.of("Z"))
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/9c4449c0/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.java
 
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.java
new file mode 100644
index 0000000..a08f73b
--- /dev/null
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.java
@@ -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.camel.component.salesforce.api.utils;
+
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DateTimeUtilsTest {
+
+    @Test
+    public void testFormatDateTime() {
+        assertEquals("1991-12-10T12:13:14.007+01:00", 
DateTimeUtils.formatDateTime(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 
7000000, ZoneId.of("UTC+01:00:21"))));
+        assertEquals("1991-12-10T12:13:14.007Z", 
DateTimeUtils.formatDateTime(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 
7000000, ZoneId.of("UTC"))));
+        assertEquals("1700-01-01T01:13:14.007+00:19", 
DateTimeUtils.formatDateTime(ZonedDateTime.of(1700, 1, 1, 1, 13, 14, 7000000, 
ZoneId.of("UTC+00:19:21"))));
+        assertEquals("1700-02-03T02:13:14.007Z", 
DateTimeUtils.formatDateTime(ZonedDateTime.of(1700, 2, 3, 2, 13, 14, 7000000, 
ZoneId.of("UTC"))));
+    }
+
+    @Test
+    public void testParseDateTime() {
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, 
ZoneId.of("+01:00")), 
DateTimeUtils.parseDateTime("1991-12-10T12:13:14.007+01:00"));
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 0, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1991-12-10T12:13:14+00:00"));
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 0, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1991-12-10T12:13:14.000+00:00"));
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 0, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1991-12-10T12:13:14+0000"));
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 0, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1991-12-10T12:13:14.000+0000"));
+        assertEquals(ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1991-12-10T12:13:14.007Z"));
+        assertEquals(ZonedDateTime.of(1700, 1, 1, 1, 13, 14, 7000000, 
ZoneId.of("+00:19")), 
DateTimeUtils.parseDateTime("1700-01-01T01:13:14.007+00:19"));
+        assertEquals(ZonedDateTime.of(1700, 2, 3, 2, 13, 14, 7000000, 
ZoneId.of("Z")), DateTimeUtils.parseDateTime("1700-02-03T02:13:14.007Z"));
+    }
+}

Reply via email to