camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hekon...@apache.org
Subject git commit: [APNS] Added extra tests.
Date Tue, 13 May 2014 07:48:12 GMT
Repository: camel
Updated Branches:
  refs/heads/master 3165cae60 -> 8b306d0ef


[APNS] Added extra tests.


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

Branch: refs/heads/master
Commit: 8b306d0efad1c22bc9276e3ec0b9d46e4ec5684f
Parents: 3165cae
Author: Henryk Konsek <hekonsek@gmail.com>
Authored: Tue May 13 09:30:12 2014 +0200
Committer: Henryk Konsek <hekonsek@gmail.com>
Committed: Tue May 13 09:47:50 2014 +0200

----------------------------------------------------------------------
 components/camel-apns/pom.xml                   |  5 ++
 .../ConfiguredApnsServiceFactoryTest.java       | 57 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8b306d0e/components/camel-apns/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-apns/pom.xml b/components/camel-apns/pom.xml
index 3117a64..ca67e3f 100644
--- a/components/camel-apns/pom.xml
+++ b/components/camel-apns/pom.xml
@@ -115,6 +115,11 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <!-- for testing apns -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/8b306d0e/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ConfiguredApnsServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ConfiguredApnsServiceFactoryTest.java
b/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ConfiguredApnsServiceFactoryTest.java
new file mode 100644
index 0000000..c48c6c0
--- /dev/null
+++ b/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ConfiguredApnsServiceFactoryTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.apns.factory;
+
+import java.io.IOException;
+import javax.net.ssl.SSLContext;
+
+import com.notnoop.apns.ApnsServiceBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class ConfiguredApnsServiceFactoryTest {
+
+    ApnsServiceBuilder apnsServiceBuilder = mock(ApnsServiceBuilder.class);
+
+    ApnsServiceFactory apnsServiceFactory = new ApnsServiceFactory() {
+        @Override
+        protected ApnsServiceBuilder configureServiceBuilder(ApnsServiceBuilder serviceBuilder)
{
+            apnsServiceBuilder.withSocksProxy("my.proxy.com", 6666);
+            return apnsServiceBuilder;
+        }
+    };
+
+    @Before
+    public void setUp() throws IOException {
+        apnsServiceFactory.setSslContext(mock(SSLContext.class));
+    }
+
+    @Test
+    public void shouldSetProxyOnDefaultServiceBuilder() {
+        // When
+        apnsServiceFactory.getApnsService();
+
+        // Then
+        verify(apnsServiceBuilder).withSocksProxy(anyString(), anyInt());
+    }
+
+}


Mime
View raw message