use of org.apache.synapse.commons.executors.queues.FixedSizeQueue in project wso2-synapse by wso2.
the class PriorityExecutorSerializerTest method testSerialize.
/**
* Test serializing a PriorityExecutor created with FixedSizeQueues
*/
public void testSerialize() {
PriorityExecutor priorityExecutor = new PriorityExecutor();
priorityExecutor.setName("executor1");
List<InternalQueue> internalQueueList = new ArrayList<>();
internalQueueList.add(new FixedSizeQueue(10, 10));
internalQueueList.add(new FixedSizeQueue(5, 25));
MultiPriorityBlockingQueue multiPriorityBlockingQueue = new MultiPriorityBlockingQueue(internalQueueList, true, 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><queue size=\"10\" priority=\"10\" /><queue size=\"25\" priority=\"5\" /></queues>" + "<threads max=\"100\" core=\"20\" keep-alive=\"5\" />" + "</priorityExecutor>", element.toString());
}
use of org.apache.synapse.commons.executors.queues.FixedSizeQueue in project wso2-synapse by wso2.
the class PriorityExecutorSerializerTest method testSerializeGivenParentElement.
/**
* Test serializing a PriorityExecutor when parent element is defined
* @throws XMLStreamException
*/
public void testSerializeGivenParentElement() throws XMLStreamException {
OMElement parentElement = AXIOMUtil.stringToOM("<definitions></definitions>");
PriorityExecutor priorityExecutor = new PriorityExecutor();
priorityExecutor.setName("executor1");
List<InternalQueue> internalQueueList = new ArrayList<>();
internalQueueList.add(new FixedSizeQueue(10, 10));
internalQueueList.add(new FixedSizeQueue(5, 25));
MultiPriorityBlockingQueue multiPriorityBlockingQueue = new MultiPriorityBlockingQueue(internalQueueList, true, new PRRNextQueueAlgorithm());
priorityExecutor.setQueue(multiPriorityBlockingQueue);
PriorityExecutorSerializer.serialize(parentElement, priorityExecutor, "http://ws.apache.org/ns/synapse");
assertEquals("Invalid serialization of PriorityExecutor", "<definitions>" + "<priorityExecutor xmlns=\"http://ws.apache.org/ns/synapse\" name=\"executor1\">" + "<queues><queue size=\"10\" priority=\"10\" /><queue size=\"25\" priority=\"5\" /></queues>" + "<threads max=\"100\" core=\"20\" keep-alive=\"5\" />" + "</priorityExecutor>" + "</definitions>", parentElement.toString());
}
Aggregations