camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1145581 - in /camel/trunk/components/camel-apns/src: main/java/org/apache/camel/component/apns/ test/java/org/apache/camel/component/apns/
Date Tue, 12 Jul 2011 13:15:26 GMT
Author: davsclaus
Date: Tue Jul 12 13:15:25 2011
New Revision: 1145581

URL: http://svn.apache.org/viewvc?rev=1145581&view=rev
Log:
Polished

Modified:
    camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsConsumer.java
    camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsEndpoint.java
    camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsProducer.java
    camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsConsumerTest.java
    camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerTest.java
    camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java

Modified: camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsConsumer.java?rev=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsConsumer.java
(original)
+++ camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsConsumer.java
Tue Jul 12 13:15:25 2011
@@ -30,7 +30,6 @@ import org.apache.camel.impl.ScheduledPo
 
 public class ApnsConsumer extends ScheduledPollConsumer {
 
-    // TODO: Is the delay relay 3600 seconds?
     private static final int DEFAULT_CONSUME_INITIAL_DELAY = 10;
     private static final int DEFAULT_CONSUME_DELAY = 3600;
     private static final boolean DEFAULT_APNS_FIXED_DELAY = true;

Modified: camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsEndpoint.java?rev=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsEndpoint.java
(original)
+++ camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsEndpoint.java
Tue Jul 12 13:15:25 2011
@@ -33,8 +33,7 @@ import org.apache.camel.impl.ScheduledPo
  */
 public class ApnsEndpoint extends ScheduledPollEndpoint {
 
-    private CopyOnWriteArraySet<DefaultConsumer> consumers = new CopyOnWriteArraySet<DefaultConsumer>();
-
+    private final CopyOnWriteArraySet<DefaultConsumer> consumers = new CopyOnWriteArraySet<DefaultConsumer>();
     private String tokens;
 
     public ApnsEndpoint(String uri, ApnsComponent component) {
@@ -66,10 +65,8 @@ public class ApnsEndpoint extends Schedu
     }
 
     public Consumer createConsumer(Processor processor) throws Exception {
-
         ApnsConsumer apnsConsumer = new ApnsConsumer(this, processor);
         configureConsumer(apnsConsumer);
-
         return apnsConsumer;
     }
 

Modified: camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsProducer.java?rev=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsProducer.java
(original)
+++ camel/trunk/components/camel-apns/src/main/java/org/apache/camel/component/apns/ApnsProducer.java
Tue Jul 12 13:15:25 2011
@@ -32,15 +32,18 @@ import org.apache.camel.util.ObjectHelpe
 
 public class ApnsProducer extends DefaultProducer {
 
-    private ApnsEndpoint endpoint;
     private List<String> tokenList;
 
     public ApnsProducer(ApnsEndpoint endpoint) {
         super(endpoint);
-        this.endpoint = endpoint;
         initiate(endpoint);
     }
 
+    @Override
+    public ApnsEndpoint getEndpoint() {
+        return (ApnsEndpoint) super.getEndpoint();
+    }
+
     private void initiate(ApnsEndpoint apnsEndpoint) {
         configureTokens(apnsEndpoint);
     }
@@ -62,7 +65,7 @@ public class ApnsProducer extends Defaul
     private void notify(Exchange exchange) throws ApnsException {
         String message = exchange.getIn().getBody(String.class);
 
-        Collection<String> tokens = null;
+        Collection<String> tokens;
         if (isTokensConfiguredUsingUri()) {
             if (hasTokensHeader(exchange)) {
                 throw new IllegalArgumentException("Tokens already configured on endpoint
" + ApnsConstants.HEADER_TOKENS);
@@ -82,7 +85,7 @@ public class ApnsProducer extends Defaul
             payload = message;
         }
 
-        endpoint.getApnsService().push(tokens, payload);
+        getEndpoint().getApnsService().push(tokens, payload);
     }
 
     public String getHeaderTokens(Exchange exchange) {

Modified: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsConsumerTest.java?rev=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsConsumerTest.java
(original)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsConsumerTest.java
Tue Jul 12 13:15:25 2011
@@ -53,7 +53,7 @@ public class ApnsConsumerTest extends Ca
         server.stop();
     }
 
-    @Test(timeout = 10000)
+    @Test(timeout = 15000)
     public void testConsumer() throws Exception {
 
         byte[] deviceTokenBytes = ApnsUtils.createRandomDeviceTokenBytes();

Modified: camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerTest.java?rev=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerTest.java
(original)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerTest.java
Tue Jul 12 13:15:25 2011
@@ -55,7 +55,7 @@ public class ApnsProducerTest extends Ca
         server.stop();
     }
 
-    @Test(timeout = 3000)
+    @Test(timeout = 5000)
     public void testProducer() throws Exception {
         String message = "Hello World";
         String messagePayload = APNS.newPayload().alertBody(message).build();

Modified: 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=1145581&r1=1145580&r2=1145581&view=diff
==============================================================================
--- camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java
(original)
+++ camel/trunk/components/camel-apns/src/test/java/org/apache/camel/component/apns/ApnsProducerWithoutTokensHeaderTest.java
Tue Jul 12 13:15:25 2011
@@ -54,7 +54,7 @@ public class ApnsProducerWithoutTokensHe
         server.stop();
     }
 
-    @Test(timeout = 3000)
+    @Test(timeout = 5000)
     public void testProducerWithoutTokenHeader() throws Exception {
         String message = "Hello World";
         String messagePayload = APNS.newPayload().alertBody(message).build();



Mime
View raw message