Java Code Examples for junit.framework.TestCase#assertNotSame()
The following examples show how to use
junit.framework.TestCase#assertNotSame() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OFMatchTest.java From floodlight_with_topoguard with Apache License 2.0 | 5 votes |
public void testClone() { OFMatch match1 = new OFMatch(); OFMatch match2 = match1.clone(); TestCase.assertEquals(match1, match2); match2.setNetworkProtocol((byte) 4); match2.setWildcards(match2.getWildcards() & ~OFMatch.OFPFW_NW_PROTO); TestCase.assertNotSame(match1, match2); }
Example 2
Source File: PortUtilityTest.java From datasync with MIT License | 5 votes |
@Test public void testPortContentsReplace() throws SodaError, InterruptedException, IOException, LongRunningQueryException { File threeRowsFile = new File("src/test/resources/datasync_unit_test_three_rows.csv"); Soda2Publisher.replaceNew(sinkProducer, sinkDdl, UNITTEST_DATASET_ID, threeRowsFile, true); // Query for the rows of the source dataset. int sourceTotalRows = getTotalRows(UNITTEST_DATASET_ID); // Use one of our CSVs from Integration tests to reset the dataset (in case it's been changed). File twoRowsFile = new File("src/test/resources/datasync_unit_test_two_rows.csv"); Soda2Publisher.replaceNew(sinkProducer, sinkDdl, UNITTEST_PORT_RESULT_DATASET_ID, twoRowsFile, true); // Query for the rows of the sink dataset int sinkTotalRows = getTotalRows(UNITTEST_PORT_RESULT_DATASET_ID); // Simple test before we proceed: we want to make sure that the datasets // do not have the same amount of rows. TestCase.assertEquals(2, sinkTotalRows); TestCase.assertNotSame(sourceTotalRows, sinkTotalRows); // Perform the test operation... PortUtility.portContents(sourceProducer, sinkProducer, UNITTEST_DATASET_ID, UNITTEST_PORT_RESULT_DATASET_ID, PublishMethod.replace); // Grab both datasets' contents List<UnitTestDataset> sourceRows = sinkProducer.query(UNITTEST_DATASET_ID, SoqlQuery.SELECT_ALL, UnitTestDataset.LIST_TYPE); List<UnitTestDataset> sinkRows = sinkProducer.query(UNITTEST_PORT_RESULT_DATASET_ID, SoqlQuery.SELECT_ALL, UnitTestDataset.LIST_TYPE); // Run tests that ensure that the sink dataset's contents have been completely replaced // and are now identical to the source dataset's contents. TestCase.assertEquals(sourceRows.size(), sinkRows.size()); for (int i = 0; i < sourceRows.size(); i++) { TestCase.assertEquals(sourceRows.get(i).getId(), sinkRows.get(i).getId()); TestCase.assertEquals(sourceRows.get(i).getName(), sinkRows.get(i).getName()); TestCase.assertEquals(sourceRows.get(i).getAnother_name(), sinkRows.get(i).getAnother_name()); TestCase.assertEquals(sourceRows.get(i).getDate(), sinkRows.get(i).getDate()); } }
Example 3
Source File: TestDFSClientUpdateNameNodeSignature.java From RDFS with Apache License 2.0 | 4 votes |
/** * Test when name-node's finger-print changes, client re-fetch the * name-node proxy. */ public void testClientUpdateMethodList() throws IOException { InetSocketAddress addr = cluster.getNameNode().getNameNodeDNAddress(); DFSClient client = new DFSClient(addr, cluster.getNameNode().getConf()); ClientProtocol oldNamenode = client.namenode; // Client's name-node proxy should keep the same if the same namenode // sends the same fingerprint // OutputStream os = client.create("/testClientUpdateMethodList.txt", true); os.write(66); os.close(); TestCase.assertSame(oldNamenode, client.namenode); int oldFingerprint = cluster.getNameNode().getClientProtocolMethodsFingerprint(); TestCase.assertEquals(oldFingerprint, client.namenodeProtocolProxy .getMethodsFingerprint()); // Namenode's fingerprint will be different to client. Client is suppsoed // to get a new proxy. // cluster.getNameNode().setClientProtocolMethodsFingerprint(666); os = client.create("/testClientUpdateMethodList1.txt", true); os.write(88); os.close(); TestCase.assertNotSame(oldNamenode, client.namenode); // Since we didn't change method list of name-node, the fingerprint // got from the new proxy should be the same as the previous one. TestCase.assertEquals(oldFingerprint, client.namenodeProtocolProxy .getMethodsFingerprint()); // Client's name-node proxy should keep the same if the same namenode // sends the same fingerprint // ClientProtocol namenode1 = client.namenode; cluster.getNameNode().setClientProtocolMethodsFingerprint(oldFingerprint); DFSInputStream dis = client.open("/testClientUpdateMethodList.txt"); int val = dis.read(); TestCase.assertEquals(66, val); dis.close(); TestCase.assertSame(namenode1, client.namenode); // Namenode's fingerprint will be different to client. Client is suppsoed // to get a new proxy. // cluster.getNameNode().setClientProtocolMethodsFingerprint(888); dis = client.open("/testClientUpdateMethodList1.txt"); val = dis.read(); TestCase.assertEquals(88, val); dis.close(); // Since we didn't change method list of name-node, the fingerprint // got from the new proxy should be the same as the previous one. TestCase.assertNotSame(namenode1, client.namenode); }