Author: hiranya
Date: Tue Aug  6 06:31:48 2013
New Revision: 1510865

URL: http://svn.apache.org/r1510865
Log:
Adding a recipient list endpoint serialization test

Added:
    
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/RecipientListEndpointSerializationTest.java
Modified:
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingJob.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingProcessor.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingJob.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingJob.java?rev=1510865&r1=1510864&r2=1510865&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingJob.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingJob.java
 Tue Aug  6 06:31:48 2013
@@ -78,18 +78,18 @@ public class ResequencingJob implements 
         }
 
         /** Extract the number of messages interested to come */
-        if (parameters != null && 
parameters.get(ResequencingProcessor.REQ_INIT_MSGS) != null) {
+        if (parameters.get(ResequencingProcessor.REQ_INIT_MSGS) != null) {
             processor.setRequiredInitMsgs(new 
AtomicInteger(Integer.parseInt((String) parameters.get(
                     ResequencingProcessor.REQ_INIT_MSGS))));
         }
         /** Extract the delay wait until the interested messages come */
-        if (parameters != null && 
parameters.get(ResequencingProcessor.REQ_INIT_MSGS_DELAY) != null) {
+        if (parameters.get(ResequencingProcessor.REQ_INIT_MSGS_DELAY) != null) 
{
             processor.setRequiredInitMsgsDelay(new 
AtomicInteger(Integer.parseInt((String) parameters.get(
                     ResequencingProcessor.REQ_INIT_MSGS_DELAY))));
         }
 
         /** Extract whether to delete duplicate messages */
-        if (parameters != null && 
parameters.get(ResequencingProcessor.DELETE_DUPLICATES) != null) {
+        if (parameters.get(ResequencingProcessor.DELETE_DUPLICATES) != null) {
             String result=(String) 
parameters.get(ResequencingProcessor.DELETE_DUPLICATES);
             if(result.equalsIgnoreCase("TRUE")){
                 processor.setDeleteDuplicates(new AtomicBoolean(true));

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingProcessor.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingProcessor.java?rev=1510865&r1=1510864&r2=1510865&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingProcessor.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/message/processors/resequence/ResequencingProcessor.java
 Tue Aug  6 06:31:48 2013
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.Atomi
 
 /**
  * This class will be used as the processor of the resequencer and set up
- * the necessary environment for the ReequencingJob.
+ * the necessary environment for the ResequencingJob.
  * This should be run periodically after given time interval and
  * for that this should be inherited from ScheduledMessageProcessor class
  */
@@ -126,8 +126,6 @@ public class ResequencingProcessor exten
      * This method use to find the minimum sequence number in the message 
store at the startup
      */
     private void findFirstSeqNum() {
-
-
         MessageStore store = configuration.getMessageStore(messageStore);
         SynapseXPath seqNoxPath = null;
 

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java?rev=1510865&r1=1510864&r2=1510865&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
 Tue Aug  6 06:31:48 2013
@@ -37,7 +37,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-/*
+/**
  * This class is instantiated by SimpleQuartzFactory (or by hand)
  * When it is initialized it creates a Quartz Scheduler with a job and a 
trigger
  * The class it starts is always an instance of SimpleQuartzJob

Added: 
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/RecipientListEndpointSerializationTest.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/RecipientListEndpointSerializationTest.java?rev=1510865&view=auto
==============================================================================
--- 
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/RecipientListEndpointSerializationTest.java
 (added)
+++ 
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/RecipientListEndpointSerializationTest.java
 Tue Aug  6 06:31:48 2013
@@ -0,0 +1,88 @@
+/*
+ *  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.synapse.config.xml.endpoints;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.synapse.config.xml.AbstractTestCase;
+import org.apache.synapse.endpoints.Endpoint;
+
+public class RecipientListEndpointSerializationTest extends AbstractTestCase {
+
+    public void testRecipientListEndpointScenarioOne()throws Exception {
+        String inputXml = "<endpoint 
xmlns=\"http://ws.apache.org/ns/synapse\";>" +
+                "<recipientlist>" +
+                "<endpoint>" +
+                "<address uri=\"http://localhost:9001/soap/LBService1\";>" +
+                "<enableAddressing/>" +
+                "</address>" +
+                "</endpoint>" +
+                "<endpoint>" +
+                "<address uri=\"http://localhost:9002/soap/LBService1\";>" +
+                "<enableAddressing/>" +
+                "</address>" +
+                "</endpoint>" +
+                "<endpoint>" +
+                "<address uri=\"http://localhost:9003/soap/LBService1\";>" +
+                "<enableAddressing/>" +
+                "</address>" +
+                "</endpoint>" +
+                "</recipientlist>" +
+                "</endpoint>";
+
+        OMElement inputElement = createOMElement(inputXml);
+        Endpoint endpoint = 
RecipientListEndpointFactory.getEndpointFromElement(
+                inputElement,true,null);
+        OMElement serializedOut = 
RecipientListEndpointSerializer.getElementFromEndpoint(endpoint);
+
+        assertTrue(compare(serializedOut, inputElement));
+    }
+
+    public void testRecipientListEndpointScenarioTwo()throws Exception {
+        String inputXml = "<endpoint 
xmlns=\"http://ws.apache.org/ns/synapse\";>" +
+                "<recipientlist>" +
+                "<member hostName=\"localhost\" httpPort=\"9000\" 
httpsPort=\"9005\"/>" +
+                "<member hostName=\"localhost\" httpPort=\"9001\" 
httpsPort=\"9006\"/>" +
+                "<member hostName=\"localhost\" httpPort=\"9002\" 
httpsPort=\"9007\"/>" +
+                "</recipientlist>" +
+                "</endpoint>";
+
+        OMElement inputElement = createOMElement(inputXml);
+        Endpoint endpoint = 
RecipientListEndpointFactory.getEndpointFromElement(
+                inputElement,true,null);
+        OMElement serializedOut = 
RecipientListEndpointSerializer.getElementFromEndpoint(endpoint);
+
+        assertTrue(compare(serializedOut, inputElement));
+    }
+
+    public void testRecipientListEndpointScenarioThree()throws Exception {
+        String inputXml = "<endpoint 
xmlns=\"http://ws.apache.org/ns/synapse\";>" +
+                "<recipientlist>" +
+                "<endpoints value=\"foo\" max-cache=\"10\"/>" +
+                "</recipientlist>" +
+                "</endpoint>";
+
+        OMElement inputElement = createOMElement(inputXml);
+        Endpoint endpoint = 
RecipientListEndpointFactory.getEndpointFromElement(
+                inputElement,true,null);
+        OMElement serializedOut = 
RecipientListEndpointSerializer.getElementFromEndpoint(endpoint);
+
+        assertTrue(compare(serializedOut, inputElement));
+    }
+}


Reply via email to