You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/06/06 20:30:35 UTC

svn commit: r1132722 [2/2] - in /camel/trunk: apache-camel/ apache-camel/src/main/descriptors/ components/ components/camel-apns/ components/camel-apns/src/ components/camel-apns/src/main/ components/camel-apns/src/main/java/ components/camel-apns/src/...

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,91 @@
+/**
+ * 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;
+
+import com.notnoop.apns.APNS;
+import com.notnoop.apns.ApnsService;
+import com.notnoop.apns.EnhancedApnsNotification;
+import com.notnoop.apns.utils.ApnsServerStub;
+import com.notnoop.apns.utils.FixedCertificates;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.apns.factory.ApnsServiceFactory;
+import org.apache.camel.component.apns.util.ApnsUtils;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit test that we can produce JMS message from files
+ */
+public class ApnsProducerWithoutTokensHeaderTest extends CamelTestSupport {
+
+    private static final String FAKE_TOKEN = "19308314834701ACD8313AEBD92AEFDE192120371FE13982392831701318B943";
+
+    private ApnsServerStub server;
+
+    public ApnsProducerWithoutTokensHeaderTest() {
+        super();
+    }
+
+    @Before
+    public void startup() {
+        server = ApnsServerStub.prepareAndStartServer(FixedCertificates.TEST_GATEWAY_PORT, FixedCertificates.TEST_FEEDBACK_PORT);
+    }
+
+    @After
+    public void stop() {
+        server.stop();
+    }
+
+    @Test(timeout = 3000)
+    public void testProducerWithoutTokenHeader() throws Exception {
+        String message = "Hello World";
+        String messagePayload = APNS.newPayload().alertBody(message).build();
+
+        EnhancedApnsNotification apnsNotification = new EnhancedApnsNotification(1, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
+        server.stopAt(apnsNotification.length());
+
+        template.sendBody("direct:test", message);
+
+        server.messages.acquire();
+        assertArrayEquals(apnsNotification.marshall(), server.received.toByteArray());
+    }
+
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+
+        ApnsServiceFactory apnsServiceFactory = ApnsUtils.createDefaultTestConfiguration(camelContext);
+        ApnsService apnsService = apnsServiceFactory.getApnsService();
+
+        ApnsComponent apnsComponent = new ApnsComponent(apnsService);
+        camelContext.addComponent("apns", apnsComponent);
+
+        return camelContext;
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:test")
+                        .to("apns:notify?tokens=" + FAKE_TOKEN);
+            }
+        };
+    }
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,79 @@
+/**
+ * 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 com.notnoop.apns.ApnsService;
+import com.notnoop.apns.utils.FixedCertificates;
+
+import org.apache.camel.component.apns.model.ConnectionStrategy;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ApnsServiceFactoryTest {
+
+    @Test
+    public void testApnsServiceFactoryWithFixedCertificates() {
+        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificates();
+        ApnsService apnsService = apnsServiceFactory.getApnsService();
+
+        doBasicAsserts(apnsService);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testApnsServiceFactoryAsPool0() {
+        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(0);
+        ApnsService apnsService = apnsServiceFactory.getApnsService();
+
+        doBasicAsserts(apnsService);
+    }
+
+    @Test
+    public void testApnsServiceFactoryAsPool1() {
+        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(1);
+        ApnsService apnsService = apnsServiceFactory.getApnsService();
+
+        doBasicAsserts(apnsService);
+    }
+
+    private void doBasicAsserts(Object apnsService) {
+        Assert.assertNotNull(apnsService);
+        Assert.assertTrue(apnsService instanceof ApnsService);
+    }
+
+    public static ApnsServiceFactory createApnsServiceFactoryWithFixedCertificates() {
+        ApnsServiceFactory apnsServiceFactory = new ApnsServiceFactory();
+
+        apnsServiceFactory.setFeedbackHost(FixedCertificates.TEST_HOST);
+        apnsServiceFactory.setFeedbackPort(FixedCertificates.TEST_FEEDBACK_PORT);
+        apnsServiceFactory.setGatewayHost(FixedCertificates.TEST_HOST);
+        apnsServiceFactory.setGatewayPort(FixedCertificates.TEST_GATEWAY_PORT);
+        apnsServiceFactory.setSslContext(FixedCertificates.clientContext());
+
+        return apnsServiceFactory;
+    }
+
+    private ApnsServiceFactory createApnsServiceFactoryWithFixedCertificatesAsPool(int poolSize) {
+        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificates();
+        apnsServiceFactory.setConnectionStrategy(ConnectionStrategy.POOL);
+
+        apnsServiceFactory.setPoolSize(poolSize);
+
+        return apnsServiceFactory;
+    }
+
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/factory/ApnsServiceFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,86 @@
+/**
+ * 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.spring;
+
+import com.notnoop.apns.utils.ApnsServerStub;
+import com.notnoop.apns.utils.FixedCertificates;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.component.apns.model.InactiveDevice;
+import org.apache.camel.component.apns.util.ApnsUtils;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+/**
+ * Unit test that we can produce JMS message from files
+ */
+@ContextConfiguration
+public class SpringApnsConsumerTest extends AbstractJUnit4SpringContextTests {
+
+    @Autowired
+    protected CamelContext camelContext;
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint mock;
+
+    private ApnsServerStub server;
+
+    public SpringApnsConsumerTest() {
+        super();
+    }
+
+    @Before
+    public void startup() throws InterruptedException {
+        server = ApnsServerStub.prepareAndStartServer(FixedCertificates.TEST_GATEWAY_PORT, FixedCertificates.TEST_FEEDBACK_PORT);
+    }
+
+    @After
+    public void stop() {
+        server.stop();
+    }
+
+    @Test(timeout = 5000)
+    public void testConsumer() throws Exception {
+
+        byte[] deviceTokenBytes = ApnsUtils.createRandomDeviceTokenBytes();
+        String deviceToken = ApnsUtils.encodeHexToken(deviceTokenBytes);
+
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(InactiveDevice.class);
+
+        byte[] feedBackBytes = ApnsUtils.generateFeedbackBytes(deviceTokenBytes);
+        server.toSend.write(feedBackBytes);
+
+        Thread.sleep(1000);
+
+        mock.assertIsSatisfied();
+
+        InactiveDevice inactiveDevice = (InactiveDevice)mock.getExchanges().get(0).getIn().getBody();
+        Assert.assertNotNull(inactiveDevice);
+        Assert.assertNotNull(inactiveDevice.getDate());
+        Assert.assertNotNull(inactiveDevice.getDeviceToken());
+        Assert.assertEquals(deviceToken, inactiveDevice.getDeviceToken());
+    }
+
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/spring/SpringApnsConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,73 @@
+/**
+ * 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.util;
+
+import java.util.Random;
+
+import com.notnoop.apns.internal.ApnsFeedbackParsingUtilsAcessor;
+import com.notnoop.apns.internal.Utilities;
+import com.notnoop.apns.utils.FixedCertificates;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.apns.factory.ApnsServiceFactory;
+
+public final class ApnsUtils {
+
+    private static Random random = new Random();
+
+    private ApnsUtils() {
+        super();
+    }
+
+    public static byte[] createRandomDeviceTokenBytes() {
+        byte[] deviceTokenBytes = new byte[32];
+        random.nextBytes(deviceTokenBytes);
+
+        return deviceTokenBytes;
+    }
+
+    public static String encodeHexToken(byte[] deviceTokenBytes) {
+        String deviceToken = Utilities.encodeHex(deviceTokenBytes);
+
+        return deviceToken;
+    }
+
+    public static ApnsServiceFactory createDefaultTestConfiguration(CamelContext camelContext) {
+        ApnsServiceFactory apnsServiceFactory = new ApnsServiceFactory(camelContext);
+
+        apnsServiceFactory.setFeedbackHost(FixedCertificates.TEST_HOST);
+        apnsServiceFactory.setFeedbackPort(FixedCertificates.TEST_FEEDBACK_PORT);
+        apnsServiceFactory.setGatewayHost(FixedCertificates.TEST_HOST);
+        apnsServiceFactory.setGatewayPort(FixedCertificates.TEST_GATEWAY_PORT);
+        // apnsServiceFactory.setCertificatePath("classpath:/" +
+        // FixedCertificates.CLIENT_STORE);
+        // apnsServiceFactory.setCertificatePassword(FixedCertificates.CLIENT_PASSWD);
+        apnsServiceFactory.setSslContext(FixedCertificates.clientContext());
+
+        return apnsServiceFactory;
+    }
+
+    public static byte[] generateFeedbackBytes(byte[] deviceTokenBytes) {
+        byte[] feedbackBytes = ApnsFeedbackParsingUtilsAcessor.pack(
+        /* time_t */new byte[] {0, 0, 0, 0},
+        /* length */new byte[] {0, 32},
+        /* device token */deviceTokenBytes);
+
+        return feedbackBytes;
+    }
+
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/ApnsUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,52 @@
+/**
+ * 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.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AssertUtilsTest {
+
+    @Test
+    public void testAssertIsTrueValid() {
+        AssertUtils.isTrue(true, " message");
+    }
+
+    @Test
+    public void testAssertIsTrueInvalid() {
+        try {
+            AssertUtils.isTrue(false, "message");
+        } catch (IllegalArgumentException e) {
+            Assert.assertEquals("[Assert is true] message", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testAssertNoNullValid() {
+        AssertUtils.notNull(new Object(), " message");
+    }
+
+    @Test
+    public void testAssertNotNullInvalid() {
+        try {
+            AssertUtils.notNull(null, "message");
+        } catch (IllegalArgumentException e) {
+            Assert.assertEquals("[Assert not null] message", e.getMessage());
+        }
+    }
+
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/AssertUtilsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java (added)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java Mon Jun  6 18:30:33 2011
@@ -0,0 +1,53 @@
+/**
+ * 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.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StringUtilsTest {
+
+    @Test
+    public void testIsEmpty() {
+        Assert.assertFalse(StringUtils.isEmpty("test"));
+        Assert.assertFalse(StringUtils.isEmpty("a"));
+        Assert.assertTrue(StringUtils.isEmpty(""));
+        Assert.assertTrue(StringUtils.isEmpty(null));
+    }
+
+    @Test
+    public void testIsNotEmpty() {
+        Assert.assertTrue(StringUtils.isNotEmpty("test"));
+        Assert.assertTrue(StringUtils.isNotEmpty("a"));
+        Assert.assertFalse(StringUtils.isNotEmpty(""));
+        Assert.assertFalse(StringUtils.isNotEmpty(null));
+    }
+
+    @Test
+    public void testTrim() {
+        Assert.assertEquals("", StringUtils.trim(""));
+        Assert.assertEquals("", StringUtils.trim(" "));
+
+        Assert.assertEquals("test", StringUtils.trim("test"));
+        Assert.assertEquals("test", StringUtils.trim("test "));
+        Assert.assertEquals("test", StringUtils.trim(" test"));
+        Assert.assertEquals("test", StringUtils.trim(" test "));
+
+        Assert.assertEquals(null, StringUtils.trim(null));
+    }
+
+}

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/util/StringUtilsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-apns/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/resources/log4j.properties?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-apns/src/test/resources/log4j.properties Mon Jun  6 18:30:33 2011
@@ -0,0 +1,37 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing
+#
+log4j.rootLogger=INFO, file
+
+#log4j.logger.org.apache.camel=DEBUG
+log4j.logger.org.apache.camel.component.apns=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-apns-test.log
+log4j.appender.file.append=true
\ No newline at end of file

Propchange: camel/trunk/components/camel-apns/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-apns/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml?rev=1132722&view=auto
==============================================================================
--- camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml (added)
+++ camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml Mon Jun  6 18:30:33 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<!-- Configures the Camel Context-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <bean id="apnsServiceFactory" class="org.apache.camel.component.apns.factory.ApnsServiceFactory">
+    <property name="camelContext" ref="camel-apns-test"/>
+    <property name="feedbackHost" value="localhost"/>
+    <property name="feedbackPort" value="7843"/>
+    <property name="gatewayHost" value="localhost"/>
+    <property name="gatewayPort" value="7654"/>
+    <property name="sslContext" ref="sslContext"/>
+  </bean>
+
+  <bean id="apnsService" factory-bean="apnsServiceFactory" factory-method="getApnsService"/>
+
+  <bean id="sslContext" class="com.notnoop.apns.utils.FixedCertificates" factory-method="clientContext"/>
+
+  <bean id="apns" class="org.apache.camel.component.apns.ApnsComponent">
+    <property name="apnsService" ref="apnsService"/>
+  </bean>
+
+  <camelContext id="camel-apns-test" xmlns="http://camel.apache.org/schema/spring">
+    <route id="apns-test">
+      <from uri="apns:consumer?initialDelay=500&amp;delay=500&amp;timeUnit=MILLISECONDS"/>
+      <to uri="log:apns?showAll=true&amp;multiline=true"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+
+</beans>

Propchange: camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-apns/src/test/resources/org/apache/camel/component/apns/spring/SpringApnsConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1132722&r1=1132721&r2=1132722&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Mon Jun  6 18:30:33 2011
@@ -53,6 +53,7 @@
     <!-- regular modules in alphabetic order -->
     <module>camel-ahc</module>
     <module>camel-amqp</module>
+    <module>camel-apns</module>
     <module>camel-atom</module>
     <module>camel-aws</module>
     <module>camel-bean-validator</module>

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1132722&r1=1132721&r2=1132722&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Mon Jun  6 18:30:33 2011
@@ -93,6 +93,7 @@
     <jackson-version>1.8.1</jackson-version>
     <jain-sip-ri-bundle-version>1.2.154_1</jain-sip-ri-bundle-version>
     <jasypt-version>1.7</jasypt-version>
+    <java-apns-version>0.1.6</java-apns-version>
     <javassist-bundle-version>3.9.0.GA_1</javassist-bundle-version>
     <javax-mail-version>1.4.4</javax-mail-version>
     <jaxen-version>1.1.1</jaxen-version>
@@ -229,6 +230,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-apns</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-atom</artifactId>
         <version>${project.version}</version>
       </dependency>