/** * Asserts that two objects refer to the same object. If they are not * the same an AssertionFailedError is thrown. */ static public void assertSame(Object expected, Object actual) { assertSame(null, expected, actual); }
/** * Asserts that two objects refer to the same object. If they are not the same an * AssertionFailedError is thrown. */ public static void assertSame(Object expected, Object actual) { assertSame(null, expected, actual); }
@Test public final void shouldAlwaysReturnTheSameCache() { final Cache<Object, Object> testDefaultCache1 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); final Cache<Object, Object> testDefaultCache2 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); assertSame( "InfinispanDefaultCacheFactoryBean should always return the same cache instance when being " + "called repeatedly. However, the cache instances are not the same.", testDefaultCache1, testDefaultCache2); } }
@Test public final void shouldAlwaysReturnTheSameCache() { final Cache<Object, Object> testDefaultCache1 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); final Cache<Object, Object> testDefaultCache2 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); assertSame( "InfinispanDefaultCacheFactoryBean should always return the same cache instance when being " + "called repeatedly. However, the cache instances are not the same.", testDefaultCache1, testDefaultCache2); } }
@Test public final void shouldAlwaysReturnTheSameCache() { final Cache<Object, Object> testDefaultCache1 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); final Cache<Object, Object> testDefaultCache2 = this.applicationContext.getBean( DEFAULT_CACHE_NAME, Cache.class); assertSame( "InfinispanDefaultCacheFactoryBean should always return the same cache instance when being " + "called repeatedly. However, the cache instances are not the same.", testDefaultCache1, testDefaultCache2); } }
@Test public void testNativeCache() throws Exception { assertSame(this.nativeCache, this.cache.getNativeCache()); }
@Test public void testNativeCache() throws Exception { assertSame(this.nativeCache, this.cache.getNativeCache()); }
@Test public void testNativeCache() throws Exception { assertSame(this.nativeCache, this.cache.getNativeCache()); }
@Test public void prof_02_profManagerConfigurationTest(){ Map<ProfilingDataManager.Subsystem, Boolean> profMap = new HashMap<>(); profMap.put(ProfilingDataManager.Subsystem.MODEL, true); profMap.put(ProfilingDataManager.Subsystem.PROVISIONING, false); profMap.put(ProfilingDataManager.Subsystem.REPOSITORY, false); profMap.put(ProfilingDataManager.Subsystem.SYNCHRONIZATION_SERVICE, false); profMap.put(ProfilingDataManager.Subsystem.TASK_MANAGER, false); profMap.put(ProfilingDataManager.Subsystem.UCF, false); profMap.put(ProfilingDataManager.Subsystem.WORKFLOW, false); profMap.put(ProfilingDataManager.Subsystem.WEB, false); ProfilingDataManager.getInstance().configureProfilingDataManager(profMap, TEST_MINUTE_DUMP_INTERVAL, true, false, false); ProfilingDataManager profManager = ProfilingDataManager.getInstance(); assertSame(profManager.getMinuteDumpInterval(), TEST_MINUTE_DUMP_INTERVAL); }
@Override public void call() { final SpringEmbeddedCacheManager objectUnderTest = new SpringEmbeddedCacheManager( cm); final EmbeddedCacheManager nativeCacheManagerReturned = objectUnderTest .getNativeCacheManager(); assertSame( "getNativeCacheManager() should have returned the EmbeddedCacheManager supplied at construction time. However, it retuned a different one.", cm, nativeCacheManagerReturned); } });
@Override public void call() { final SpringEmbeddedCacheManager objectUnderTest = new SpringEmbeddedCacheManager( cm); final EmbeddedCacheManager nativeCacheManagerReturned = objectUnderTest .getNativeCacheManager(); assertSame( "getNativeCacheManager() should have returned the EmbeddedCacheManager supplied at construction time. However, it retuned a different one.", cm, nativeCacheManagerReturned); } });
@Override public void call() { final SpringEmbeddedCacheManager objectUnderTest = new SpringEmbeddedCacheManager( cm); final EmbeddedCacheManager nativeCacheManagerReturned = objectUnderTest .getNativeCacheManager(); assertSame( "getNativeCacheManager() should have returned the EmbeddedCacheManager supplied at construction time. However, it retuned a different one.", cm, nativeCacheManagerReturned); } });
public void testEmptyString() throws Exception { ByteString byteString = ByteString.fromString(""); assertSame(ByteString.emptyString(), byteString); ExposedByteArrayOutputStream outputStream = new ExposedByteArrayOutputStream(); try (ObjectOutput output = new ObjectOutputStream(outputStream)) { ByteString.writeObject(output, byteString); } ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.getRawBuffer()); try (ObjectInput input = new ObjectInputStream(inputStream)) { ByteString byteString2 = ByteString.readObject(input); assertSame(ByteString.emptyString(), byteString2); } }
public void testBaseCustomInterceptorInjection() { AsyncInterceptor interceptor = cache.getAdvancedCache().getInterceptorChain().get(0); assertEquals(SomeInterceptor.class, interceptor.getClass()); SomeInterceptor someInterceptor = (SomeInterceptor) interceptor; assertSame(cache.getAdvancedCache().getLockManager(), someInterceptor.lm); assertSame(cache.getAdvancedCache().getDataContainer(), someInterceptor.dc); }
public void testBaseCustomAsyncInterceptorInjection() { AsyncInterceptor interceptor = cache.getAdvancedCache().getAsyncInterceptorChain().getInterceptors().get(0); assertEquals(SomeAsyncInterceptor.class, interceptor.getClass()); SomeAsyncInterceptor someAsyncInterceptor = (SomeAsyncInterceptor) interceptor; assertSame(cache.getAdvancedCache().getLockManager(), someAsyncInterceptor.lm); assertSame(cache.getAdvancedCache().getDataContainer(), someAsyncInterceptor.dc); }
public void revertRpcManager() { stopBlocking(); log.tracef("Restoring regular RpcManager on %s", getAddress()); RpcManager rpcManager = TestingUtil.extractComponent(cache, RpcManager.class); assertSame(this, rpcManager); TestingUtil.replaceComponent(cache, RpcManager.class, realOne, true); }
public void testBackgroundTasks() throws Exception { SemaphoreCompletionService<String> completionService = new SemaphoreCompletionService<>(executor2Threads, 1); CountDownLatch latch = new CountDownLatch(1); Future<String> backgroundInitFuture = completionService.submit(new BackgroundInitTask(completionService)); assertEquals("bla", backgroundInitFuture.get(1, SECONDS)); Future<String> dummyFuture = completionService.submit(new DummyTask()); assertSame(backgroundInitFuture, completionService.poll(1, SECONDS)); assertFalse(dummyFuture.isDone()); Future<String> backgroundEndFuture = completionService.backgroundTaskFinished(new BlockingTask(latch)); assertNull(completionService.poll(1, SECONDS)); assertFalse(dummyFuture.isDone()); latch.countDown(); assertEquals("bla", backgroundEndFuture.get(10, SECONDS)); assertEquals("bla", dummyFuture.get(10, SECONDS)); }
public void testConcurrency1WithinThread() throws Exception { SemaphoreCompletionService<String> completionService = new SemaphoreCompletionService<>(new WithinThreadExecutor(), 1); Future<String> future1 = completionService.submit(new DummyTask()); Future<String> future2 = completionService.poll(); assertSame(future1, future2); assertNotNull(future2); assertEquals("bla", future2.get()); }
@Override public void call() { Cache<Object, Object> cache = cm.getCache(); CacheLoader cacheLoader = TestingUtil.getCacheLoader(cache); assertSame(RestStore.class, cacheLoader.getClass()); cache.put("k", "v"); assertEquals(1, cacheManager.getCache().size()); cache.stop(); assertEquals(1, cacheManager.getCache().size()); } });
public void incrementStableIds(int topologyIdDelta, int rebalanceIdDelta) { assertSame(CacheTopology.Phase.NO_REBALANCE, stableTopology.getPhase()); assertNull(stableTopology.getPendingCH()); assertNull(stableTopology.getUnionCH()); stableTopology = new CacheTopology(stableTopology.getTopologyId() + topologyIdDelta, stableTopology.getRebalanceId() + rebalanceIdDelta, stableTopology.getCurrentCH(), null, null, stableTopology.getPhase(), stableTopology.getActualMembers(), stableTopology.getMembersPersistentUUIDs()); }