Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2013-04-24 21:42:36 -0400
committerGerrit Code Review @ Eclipse.org2013-05-01 18:13:13 -0400
commit4e209919113d47b70880b53c90fda98507c6aba7 (patch)
tree284df78dafbb5d21e870d032a2b3cd71bff4c629 /plugins/org.eclipse.osee.framework.core.server.test
parent910bff76856a2456569da5925f4f9504b72a23ed (diff)
downloadorg.eclipse.osee-4e209919113d47b70880b53c90fda98507c6aba7.tar.gz
org.eclipse.osee-4e209919113d47b70880b53c90fda98507c6aba7.tar.xz
org.eclipse.osee-4e209919113d47b70880b53c90fda98507c6aba7.zip
feature: Create cache admin bundle and tests
Create a wrapper over google cache to keep track of application caches. This the initial check-in of the CacheAdmin service. This service will be responsible for collecting and managing application caches. Change-Id: I678d6c43d633add1ed7890ae9207418adab655ef
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.server.test')
-rw-r--r--plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java102
-rw-r--r--plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionTestSuite.java1
2 files changed, 0 insertions, 103 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java
deleted file mode 100644
index 50caa8bcd0..0000000000
--- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.server.test.internal.session;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyList;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.server.internal.session.Cache;
-import org.eclipse.osee.framework.core.server.internal.session.CacheFactory;
-import org.eclipse.osee.framework.core.server.internal.session.ReadDataAccessor;
-import org.eclipse.osee.framework.core.server.internal.session.Session;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-/**
- * Test Case for {@link SessionCacheTest}
- *
- * @author Roberto E. Escobar
- */
-public class SessionCacheTest {
-
- private static Cache<String, Session> cache;
-
- @Mock
- private ReadDataAccessor<String, Session> lda;
- @Captor
- private ArgumentCaptor<Iterable<? extends String>> idCaptor;
-
- @Before
- public void initMocks() {
- MockitoAnnotations.initMocks(this);
-
- CacheFactory factory = new CacheFactory();
- cache = factory.create(lda);
- }
-
- @Test
- public void testGet() throws OseeCoreException {
- Session s = mock(Session.class);
- when(s.getGuid()).thenReturn("id1");
- when(lda.load("id1")).thenReturn(s);
-
- Session toCheck = cache.get("id1");
-
- assertEquals(s, toCheck);
- verify(lda).load("id1");
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetAll() throws OseeCoreException {
- List<String> allIds = new LinkedList<String>();
- allIds.add("id1");
- doReturn(allIds).when(lda).getAllKeys();
- Map<String, Session> map = new HashMap<String, Session>();
- Session session = mock(Session.class);
- map.put("id1", session);
- when(lda.load(anyList())).thenReturn(map);
- Iterable<Session> all = cache.getAll();
- verify(lda).getAllKeys();
- verify(lda).load(idCaptor.capture());
- assertEquals("id1", idCaptor.getValue().iterator().next());
- assertEquals(session, all.iterator().next());
- }
-
- @Test
- public void testReloadCache() throws OseeCoreException {
- Session s1 = mock(Session.class);
- Session s2 = mock(Session.class);
- when(s1.getGuid()).thenReturn("id1");
- when(s1.getGuid()).thenReturn("id1");
-
- when(lda.load("id1")).thenReturn(s1, s2);
-
- Session toCheck = cache.get("id1");
- assertEquals(s1, toCheck);
-
- cache.invalidateAll();
- toCheck = cache.get("id1");
- assertEquals(s2, toCheck);
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionTestSuite.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionTestSuite.java
index c4acdc5155..316a39f7e2 100644
--- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionTestSuite.java
@@ -16,7 +16,6 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ //
SessionTest.class, //
- SessionCacheTest.class, //
SessionFactoryTest.class, //
SessionManagerTest.class, //
})

Back to the top