@Override public void doAssert() { org.testng.Assert.assertNotSame(actual, expected); } });
@Override public void doAssert() { org.testng.Assert.assertNotSame(actual, expected, message); } });
/** * Asserts that two objects do not refer to the same object. If they do, * an AssertionError is thrown. * @param actual the actual value * @param expected the expected value */ public static void assertNotSame(Object actual, Object expected) { assertNotSame(actual, expected, null); }
/** * Asserts that two objects do not refer to the same object. If they do, an AssertionError is * thrown. * * @param actual the actual value * @param expected the expected value */ public static void assertNotSame(Object actual, Object expected) { assertNotSame(actual, expected, null); }
@Override public void doAssert() { org.testng.Assert.assertNotSame(actual, expected, message); } });
@Override public void doAssert() { org.testng.Assert.assertNotSame(actual, expected); } });
@Test(dependsOnMethods = { "dirtyContext" }) public void verifyContextWasDirtied() { performCommonAssertions(); assertNotSame(super.applicationContext, this.dirtiedApplicationContext, "The application context should have been 'dirtied'."); this.dirtiedApplicationContext = super.applicationContext; }
protected static void assertNotCompact(Block block) { assertNotSame(block.copyRegion(0, block.getPositionCount()), block); }
@Test public void testCache() { PageFunctionCompiler cacheCompiler = new PageFunctionCompiler(createTestMetadataManager(), 100); assertSame( cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty()), cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty())); assertSame( cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint")), cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint"))); assertSame( cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint")), cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint2"))); assertSame( cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty()), cacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint2"))); PageFunctionCompiler noCacheCompiler = new PageFunctionCompiler(createTestMetadataManager(), 0); assertNotSame( noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty()), noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty())); assertNotSame( noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint")), noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint"))); assertNotSame( noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint")), noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint2"))); assertNotSame( noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.empty()), noCacheCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of("hint2"))); }
@Test public void testGetAllNodes() { DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig); AllNodes allNodes = manager.getAllNodes(); Set<Node> activeNodes = allNodes.getActiveNodes(); assertEqualsIgnoreOrder(activeNodes, this.activeNodes); for (Node actual : activeNodes) { for (Node expected : this.activeNodes) { assertNotSame(actual, expected); } } assertEqualsIgnoreOrder(activeNodes, manager.getNodes(ACTIVE)); Set<Node> inactiveNodes = allNodes.getInactiveNodes(); assertEqualsIgnoreOrder(inactiveNodes, this.inactiveNodes); for (Node actual : inactiveNodes) { for (Node expected : this.inactiveNodes) { assertNotSame(actual, expected); } } assertEqualsIgnoreOrder(inactiveNodes, manager.getNodes(INACTIVE)); }
private void testFast(boolean useInterceptor) { TestNG tng = create(); tng.setTestClasses(new Class[] { FooTest.class }); if (useInterceptor) { tng.setMethodInterceptor(new FastTestsFirstInterceptor()); } TestListenerAdapter tla = new TestListenerAdapter(); // tng.setParallel("methods"); tng.addListener((ITestNGListener) tla); tng.run(); Assert.assertEquals(tla.getPassedTests().size(), 3); ITestResult first = tla.getPassedTests().get(0); String method = "zzzfast"; if (useInterceptor) { Assert.assertEquals(first.getMethod().getMethodName(), method); } else { Assert.assertNotSame(first.getMethod().getMethodName(), method); } }
new IdealState((ZNRecord) znRecordSerializer.deserialize(znRecordSerializer.serialize(idealState.getRecord()))); _realtimeSegmentRelocator.relocateSegments(realtimeTagConfig, idealState); Assert.assertNotSame(idealState, prevIdealState); segmentNameToExpectedNumCompletedInstances.put("segment0", 1); verifySegmentAssignment(idealState, prevIdealState, completedInstanceList, nReplicas, new IdealState((ZNRecord) znRecordSerializer.deserialize(znRecordSerializer.serialize(idealState.getRecord()))); _realtimeSegmentRelocator.relocateSegments(realtimeTagConfig, idealState); Assert.assertNotSame(idealState, prevIdealState); segmentNameToExpectedNumCompletedInstances.put("segment0", 2); verifySegmentAssignment(idealState, prevIdealState, completedInstanceList, nReplicas, new IdealState((ZNRecord) znRecordSerializer.deserialize(znRecordSerializer.serialize(idealState.getRecord()))); _realtimeSegmentRelocator.relocateSegments(realtimeTagConfig, idealState); Assert.assertNotSame(idealState, prevIdealState); segmentNameToExpectedNumCompletedInstances.put("segment0", 3); verifySegmentAssignment(idealState, prevIdealState, completedInstanceList, nReplicas, new IdealState((ZNRecord) znRecordSerializer.deserialize(znRecordSerializer.serialize(idealState.getRecord()))); _realtimeSegmentRelocator.relocateSegments(realtimeTagConfig, idealState); Assert.assertNotSame(idealState, prevIdealState); segmentNameToExpectedNumCompletedInstances.put("segment1", 1); segmentNameToExpectedNumCompletedInstances.put("segment2", 1); new IdealState((ZNRecord) znRecordSerializer.deserialize(znRecordSerializer.serialize(idealState.getRecord()))); _realtimeSegmentRelocator.relocateSegments(realtimeTagConfig, idealState); Assert.assertNotSame(idealState, prevIdealState); segmentNameToExpectedNumCompletedInstances.put("segment1", 2); segmentNameToExpectedNumCompletedInstances.put("segment2", 2);
@Test public void testFileSystemCache() throws IOException { ImpersonatingHdfsAuthentication auth = new ImpersonatingHdfsAuthentication(new SimpleHadoopAuthentication()); HdfsEnvironment environment = new HdfsEnvironment( new HiveHdfsConfiguration(new HdfsConfigurationUpdater(new HiveClientConfig())), new HiveClientConfig(), auth); FileSystem fs1 = getFileSystem(environment, "user"); FileSystem fs2 = getFileSystem(environment, "user"); assertSame(fs1, fs2); FileSystem fs3 = getFileSystem(environment, "other_user"); assertNotSame(fs1, fs3); FileSystem fs4 = getFileSystem(environment, "other_user"); assertSame(fs3, fs4); }
@Test( enabled = true, dataProviderClass = TestUtils.class, dataProvider = STICKYNESS_PROVIDER ) public void testInvalidSessionNotFound( @Nonnull final SessionAffinityMode sessionAffinity ) throws IOException, InterruptedException, HttpException { setStickyness(sessionAffinity); final String sessionId1 = makeRequest( _httpClient, _portTomcat1, null ); assertNotNull( sessionId1, "No session created." ); /* * wait some time, as processExpires runs every second and the * maxInactiveTime is set to 1 sec... */ Thread.sleep( 2100 ); final String sessionId2 = makeRequest( _httpClient, _portTomcat1, sessionId1 ); assertNotSame( sessionId1, sessionId2, "Expired session returned." ); }
private void checkSessionFunctionalityWithMsmDisabled() throws IOException, HttpException, InterruptedException { assertTrue( _tomcat1.getManager().getMemcachedSessionService().isSticky() ); final String sessionId1 = makeRequest( _httpClient, _portTomcat1, null ); assertNotNull( sessionId1, "No session created." ); assertNull( new SessionIdFormat().extractMemcachedId( sessionId1 ), "Got a memcached node id, even with msm disabled." ); waitForSessionExpiration( true ); final String sessionId2 = makeRequest( _httpClient, _portTomcat1, sessionId1 ); assertNotSame( sessionId2, sessionId1, "SessionId not changed." ); }
assertNotSame( makeRequest( _httpClient, _portTomcat1, sessionId1 ), sessionId1, "The sessionId should have changed due to expired sessin" );
assertNotSame( makeRequest( _httpClient, _portTomcat1, sessionId1 ), sessionId1, "The sessionId should have changed due to expired sessin" );
/** * This test will submit several tasks two of which will * expire. We check the drainer(s) in the pending list * before and after the expiration. */ @Test(groups = "fast") public void testExpiringDualDrainer() throws Exception { // submit three tasks executorFront2.execute(slowTask); executorFront2.execute(countTask); executorFront2.execute(slowTask); Assert.assertEquals(mockExecutor.getNumPendingTasks(), 2); AnnotatedRunnable drainer2 = mockExecutor.getRunnableList().get(1); mockExecutor.removeHead().run(); // Drainer1 expires after the 1st task completes, // and is rescheduled to the end of the pending list. Assert.assertEquals(mockExecutor.getNumPendingTasks(), 2); // Drainer2 should be on the head of the pending list Assert.assertSame(drainer2, mockExecutor.getRunnableList().get(0)); mockExecutor.removeHead().run(); // Drainer2 expires after the 2nd and 3rd task complete. AnnotatedRunnable drainer1 = mockExecutor.getRunnableList().get(0); // Drainer1 should be on the head of the pending list Assert.assertNotSame(drainer1, drainer2); // should have 2 slow tasks and 1 count tasks Assert.assertEquals(count.get(), 3); // must clear the timer offset DateTimeUtils.setCurrentMillisOffset(0); }
final String secondNode = extractNodeId( sid2 ); assertNotSame( secondNode, firstNode, "First node again selected" );
assertNotSame( response2.getSessionId(), sessionId1 ); final String sessionId2 = response2.getResponseSessionId(); assertNotNull( sessionId2 );