/******************************************************************************* * Copyright (c) 2014 Imperial College London * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Raul Castro Fernandez - initial API and implementation ******************************************************************************/ package uk.ac.imperial.lsds.seep.comm.routing; import java.util.ArrayList; import java.util.HashMap; import uk.ac.imperial.lsds.seep.comm.serialization.DataTuple; import uk.ac.imperial.lsds.seep.operator.OperatorContext; import junit.framework.*; import uk.ac.imperial.lsds.seep.operator.Operator; /** * The class <code>RouterTest</code> contains tests for the class <code>{@link Router}</code>. * * @generatedBy CodePro at 18/10/13 19:00 * @author rc3011 * @version $Revision: 1.0 $ */ public class RouterTest extends TestCase { /** * Run the Router(boolean,HashMap<Integer,ArrayList<Integer>>) constructor test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testRouter_1() throws Exception { boolean requiresLogicalRouting = true; HashMap<Integer, ArrayList<Integer>> routeInfo = new HashMap(); Router result = new Router(requiresLogicalRouting, routeInfo); // add additional test code here assertNotNull(result); } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_1() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_2() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_3() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_4() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_5() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_6() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_7() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_8() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_9() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_10() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_11() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_12() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_13() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_14() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_15() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the void configureRoutingImpl(OperatorContext,ArrayList<Operator>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testConfigureRoutingImpl_16() throws Exception { Router fixture = new Router(true, new HashMap()); OperatorContext opContext = new OperatorContext(); opContext.setOriginalDownstream(new ArrayList()); ArrayList<Operator> downstream = new ArrayList(); fixture.configureRoutingImpl(opContext, downstream); // add additional test code here } /** * Run the int customHash(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testCustomHash_1() throws Exception { int value = 1; int result = Router.customHash(value); // add additional test code here assertEquals(-1526341861, result); } /** * Run the int customHash(String) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testCustomHash_2() throws Exception { String value = ""; int result = Router.customHash(value); // add additional test code here assertEquals(-771559539, result); } /** * Run the ArrayList<Integer> forward(DataTuple) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForward_1() throws Exception { Router fixture = new Router(true, new HashMap()); DataTuple dt = new DataTuple(); ArrayList<Integer> result = fixture.forward(dt); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.SecurityException: Exit while generating test cases // at com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkExit(CodeProJUnitSecurityManager.java:57) // at java.lang.Runtime.exit(Runtime.java:105) // at java.lang.System.exit(System.java:960) // at uk.ac.imperial.lsds.seep.comm.routing.Router.forward(Router.java:168) assertNotNull(result); } /** * Run the ArrayList<Integer> forwardToAllDownstream(DataTuple) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForwardToAllDownstream_1() throws Exception { Router fixture = new Router(false, new HashMap()); DataTuple dt = new DataTuple(); ArrayList<Integer> result = fixture.forwardToAllDownstream(dt); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.forwardToAllDownstream(Router.java:152) assertNotNull(result); } /** * Run the ArrayList<Integer> forwardToAllDownstream(DataTuple) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForwardToAllDownstream_2() throws Exception { Router fixture = new Router(true, new HashMap()); DataTuple dt = new DataTuple(); ArrayList<Integer> result = fixture.forwardToAllDownstream(dt); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.routeToAll(Router.java:139) // at uk.ac.imperial.lsds.seep.comm.routing.Router.forwardToAllDownstream(Router.java:149) assertNotNull(result); } /** * Run the ArrayList<Integer> forward_splitKey(DataTuple,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForward_splitKey_1() throws Exception { Router fixture = new Router(true, new HashMap()); DataTuple dt = new DataTuple(); int key = 1; ArrayList<Integer> result = fixture.forward_splitKey(dt, key); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.forward_splitKey(Router.java:182) assertNotNull(result); } /** * Run the ArrayList<Integer> forward_toOp(DataTuple,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForward_toOp_1() throws Exception { Router fixture = new Router(true, new HashMap()); DataTuple dt = new DataTuple(); int streamId = 1; ArrayList<Integer> result = fixture.forward_toOp(dt, streamId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.physicalRouting(Router.java:200) // at uk.ac.imperial.lsds.seep.comm.routing.Router.forward_toOp(Router.java:177) assertNotNull(result); } /** * Run the ArrayList<Integer> forward_toOp_splitKey(DataTuple,int,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testForward_toOp_splitKey_1() throws Exception { Router fixture = new Router(true, new HashMap()); DataTuple dt = new DataTuple(); int streamId = 1; int key = 1; ArrayList<Integer> result = fixture.forward_toOp_splitKey(dt, streamId, key); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.physicalRouting(Router.java:200) // at uk.ac.imperial.lsds.seep.comm.routing.Router.forward_toOp_splitKey(Router.java:188) assertNotNull(result); } /** * Run the ArrayList<Integer> getIndexesInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetIndexesInformation_1() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getIndexesInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getIndexesInformation(Router.java:61) assertNotNull(result); } /** * Run the ArrayList<Integer> getIndexesInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetIndexesInformation_2() throws Exception { Router fixture = new Router(true, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getIndexesInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getIndexesInformation(Router.java:64) assertNotNull(result); } /** * Run the ArrayList<Integer> getIndexesInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetIndexesInformation_3() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getIndexesInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getIndexesInformation(Router.java:61) assertNotNull(result); } /** * Run the ArrayList<Integer> getKeysInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetKeysInformation_1() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getKeysInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getKeysInformation(Router.java:79) assertNotNull(result); } /** * Run the ArrayList<Integer> getKeysInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetKeysInformation_2() throws Exception { Router fixture = new Router(true, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getKeysInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getKeysInformation(Router.java:82) assertNotNull(result); } /** * Run the ArrayList<Integer> getKeysInformation(int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testGetKeysInformation_3() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; ArrayList<Integer> result = fixture.getKeysInformation(oldOpId); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.getKeysInformation(Router.java:79) assertNotNull(result); } /** * Run the int[] newOperatorPartition(int,int,int,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testNewOperatorPartition_1() throws Exception { Router fixture = new Router(true, new HashMap()); int oldOpId = 1; int newOpId = 1; int oldOpIndex = 1; int newOpIndex = 1; int[] result = fixture.newOperatorPartition(oldOpId, newOpId, oldOpIndex, newOpIndex); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.configureRoutingStrategyForNewPartition(Router.java:240) // at uk.ac.imperial.lsds.seep.comm.routing.Router.newOperatorPartition(Router.java:222) assertNotNull(result); } /** * Run the int[] newOperatorPartition(int,int,int,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testNewOperatorPartition_2() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; int newOpId = 1; int oldOpIndex = 1; int newOpIndex = 1; int[] result = fixture.newOperatorPartition(oldOpId, newOpId, oldOpIndex, newOpIndex); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.newOperatorPartition(Router.java:226) assertNotNull(result); } /** * Run the int[] newStaticOperatorPartition(int,int,int,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testNewStaticOperatorPartition_1() throws Exception { Router fixture = new Router(true, new HashMap()); int oldOpId = 1; int newOpId = 1; int oldOpIndex = 1; int newOpIndex = 1; int[] result = fixture.newStaticOperatorPartition(oldOpId, newOpId, oldOpIndex, newOpIndex); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.configureRoutingStrategyForNewPartition(Router.java:240) // at uk.ac.imperial.lsds.seep.comm.routing.Router.newStaticOperatorPartition(Router.java:209) assertNotNull(result); } /** * Run the int[] newStaticOperatorPartition(int,int,int,int) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testNewStaticOperatorPartition_2() throws Exception { Router fixture = new Router(false, new HashMap()); int oldOpId = 1; int newOpId = 1; int oldOpIndex = 1; int newOpIndex = 1; int[] result = fixture.newStaticOperatorPartition(oldOpId, newOpId, oldOpIndex, newOpIndex); // add additional test code here // An unexpected exception was thrown in user code while executing this test: // java.lang.NullPointerException // at uk.ac.imperial.lsds.seep.comm.routing.Router.newStaticOperatorPartition(Router.java:213) assertNotNull(result); } /** * Run the void reconfigureRoutingInformation(ArrayList<Integer>,ArrayList<Integer>,ArrayList<Integer>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testReconfigureRoutingInformation_1() throws Exception { Router fixture = new Router(true, new HashMap()); ArrayList<Integer> downstreamIds = new ArrayList(); ArrayList<Integer> indexes = new ArrayList(); ArrayList<Integer> keys = new ArrayList(); fixture.reconfigureRoutingInformation(downstreamIds, indexes, keys); // add additional test code here } /** * Run the void reconfigureRoutingInformation(ArrayList<Integer>,ArrayList<Integer>,ArrayList<Integer>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testReconfigureRoutingInformation_2() throws Exception { Router fixture = new Router(true, new HashMap()); ArrayList<Integer> downstreamIds = new ArrayList(); ArrayList<Integer> indexes = new ArrayList(); ArrayList<Integer> keys = new ArrayList(); fixture.reconfigureRoutingInformation(downstreamIds, indexes, keys); // add additional test code here } /** * Run the ArrayList<Integer> routeToAll(ArrayList<Integer>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testRouteToAll_1() throws Exception { Router fixture = new Router(true, new HashMap()); ArrayList<Integer> logicalTargets = new ArrayList(); ArrayList<Integer> result = fixture.routeToAll(logicalTargets); // add additional test code here assertNotNull(result); assertEquals(0, result.size()); } /** * Run the ArrayList<Integer> routeToAll(ArrayList<Integer>) method test. * * @throws Exception * * @generatedBy CodePro at 18/10/13 19:00 */ public void testRouteToAll_2() throws Exception { Router fixture = new Router(true, new HashMap()); ArrayList<Integer> logicalTargets = new ArrayList(); ArrayList<Integer> result = fixture.routeToAll(logicalTargets); // add additional test code here assertNotNull(result); assertEquals(0, result.size()); } /** * Perform pre-test initialization. * * @throws Exception * if the initialization fails for some reason * * @see TestCase#setUp() * * @generatedBy CodePro at 18/10/13 19:00 */ protected void setUp() throws Exception { super.setUp(); // add additional set up code here } /** * Perform post-test clean-up. * * @throws Exception * if the clean-up fails for some reason * * @see TestCase#tearDown() * * @generatedBy CodePro at 18/10/13 19:00 */ protected void tearDown() throws Exception { super.tearDown(); // Add additional tear down code here } /** * Launch the test. * * @param args the command line arguments * * @generatedBy CodePro at 18/10/13 19:00 */ public static void main(String[] args) { if (args.length == 0) { // Run all of the tests junit.textui.TestRunner.run(RouterTest.class); } else { // Run only the named tests TestSuite suite = new TestSuite("Selected tests"); for (int i = 0; i < args.length; i++) { TestCase test = new RouterTest(); test.setName(args[i]); suite.addTest(test); } junit.textui.TestRunner.run(suite); } } }