Search in sources :

Example 1 with UnboundedQueue

use of org.apache.synapse.commons.executors.queues.UnboundedQueue in project wso2-synapse by wso2.

the class PriorityExecutorSerializerTest method testSerializeWithUnboundedQueues.

/**
 * Test serializing a PriorityExecutor created with UnboundedQueues
 */
public void testSerializeWithUnboundedQueues() {
    PriorityExecutor priorityExecutor = new PriorityExecutor();
    priorityExecutor.setName("executor1");
    List<InternalQueue> internalQueueList = new ArrayList<>();
    internalQueueList.add(new UnboundedQueue(10));
    internalQueueList.add(new UnboundedQueue(5));
    MultiPriorityBlockingQueue multiPriorityBlockingQueue = new MultiPriorityBlockingQueue(internalQueueList, false, new PRRNextQueueAlgorithm());
    priorityExecutor.setQueue(multiPriorityBlockingQueue);
    OMElement element = PriorityExecutorSerializer.serialize(null, priorityExecutor, "http://ws.apache.org/ns/synapse");
    assertEquals("Invalid serialization of PriorityExecutor", "<priorityExecutor xmlns=\"http://ws.apache.org/ns/synapse\" name=\"executor1\">" + "<queues isFixedSize=\"false\"><queue priority=\"10\" /><queue priority=\"5\" /></queues>" + "<threads max=\"100\" core=\"20\" keep-alive=\"5\" />" + "</priorityExecutor>", element.toString());
}
Also used : PRRNextQueueAlgorithm(org.apache.synapse.commons.executors.PRRNextQueueAlgorithm) UnboundedQueue(org.apache.synapse.commons.executors.queues.UnboundedQueue) ArrayList(java.util.ArrayList) OMElement(org.apache.axiom.om.OMElement) PriorityExecutor(org.apache.synapse.commons.executors.PriorityExecutor) MultiPriorityBlockingQueue(org.apache.synapse.commons.executors.MultiPriorityBlockingQueue) InternalQueue(org.apache.synapse.commons.executors.InternalQueue)

Aggregations

ArrayList (java.util.ArrayList)1 OMElement (org.apache.axiom.om.OMElement)1 InternalQueue (org.apache.synapse.commons.executors.InternalQueue)1 MultiPriorityBlockingQueue (org.apache.synapse.commons.executors.MultiPriorityBlockingQueue)1 PRRNextQueueAlgorithm (org.apache.synapse.commons.executors.PRRNextQueueAlgorithm)1 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)1 UnboundedQueue (org.apache.synapse.commons.executors.queues.UnboundedQueue)1