Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-01-10 12:16:08 -0500
committerRyan D. Brooks2014-01-10 12:16:08 -0500
commit1f33e0bf0a642c17b674bbeb791e88ea07c4726a (patch)
treea7f971fdceb0c59a0d174158e191c8442e46f695 /plugins/org.eclipse.osee.orcs.account.admin.test
parentf7524c42f21c8337830d46775bd438e8a96ea9f3 (diff)
downloadorg.eclipse.osee-1f33e0bf0a642c17b674bbeb791e88ea07c4726a.tar.gz
org.eclipse.osee-1f33e0bf0a642c17b674bbeb791e88ea07c4726a.tar.xz
org.eclipse.osee-1f33e0bf0a642c17b674bbeb791e88ea07c4726a.zip
feature[ats_ATS8933]: Create ORCS Account Admin Implementation
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.account.admin.test')
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/.project28
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/META-INF/MANIFEST.MF24
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/OrcsAccountAdminTestSuite.launch58
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/pom.xml47
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/OrcsAccountTestSuite.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageImplTest.java269
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsIntegrationRule.java53
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java23
10 files changed, 537 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/.classpath b/plugins/org.eclipse.osee.orcs.account.admin.test/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/.project b/plugins/org.eclipse.osee.orcs.account.admin.test/.project
new file mode 100644
index 0000000000..a6a791d41e
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.orcs.account.admin.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.account.admin.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..37ccf399fb
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE ORCS Account Admin Test (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.orcs.account.admin.test
+Bundle-Version: 0.17.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Fragment-Host: org.eclipse.osee.orcs.account.admin
+Require-Bundle: org.junit,
+ org.mockito;bundle-version="1.9.0",
+ org.hamcrest.core,
+ org.objenesis,
+ org.eclipse.equinox.event,
+ org.eclipse.core.runtime,
+ org.eclipse.osee.event.osgi,
+ org.eclipse.osee.logger,
+ org.eclipse.osee.framework.core,
+ org.eclipse.osee.framework.database,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.resource.management
+Import-Package: org.eclipse.osee.orcs.db.mock,
+ org.eclipse.osee.event,
+ org.eclipse.osee.executor.admin,
+ org.osgi.service.event
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/OrcsAccountAdminTestSuite.launch b/plugins/org.eclipse.osee.orcs.account.admin.test/OrcsAccountAdminTestSuite.launch
new file mode 100644
index 0000000000..8453c1a69c
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/OrcsAccountAdminTestSuite.launch
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<setAttribute key="additional_plugins">
+<setEntry value="org.eclipse.equinox.ds:1.4.101.v20130813-1853:default:true"/>
+<setEntry value="org.eclipse.osee.hsqldb:0.17.0.qualifier:default:false"/>
+<setEntry value="org.eclipse.osee.orcs.db.mock:0.17.0.qualifier:default:true"/>
+<setEntry value="org.hsqldb:2.2.9.qualifier:default:false"/>
+<setEntry value="org.mockito:1.9.0.qualifier:default:false"/>
+</setAttribute>
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<stringAttribute key="featureDefaultLocation" value="workspace"/>
+<stringAttribute key="featurePluginResolution" value="workspace"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/OrcsAccountTestSuite.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.osee.orcs.account.admin.OrcsAccountTestSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.osee.orcs.account.admin.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m &#13;&#10;-Dosee.log.default=ALL&#13;&#10;-Dlogback.configurationFile=logback-dev.xml&#13;&#10;-DNosgi.noShutdown=true&#13;&#10;-DNequinox.ds.print=true&#13;&#10;-DNequinox.ds.debug=true"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="lba.ote.outfile.conversion.app.convert"/>
+<booleanAttribute key="run_in_ui_thread" value="false"/>
+<setAttribute key="selected_features">
+<setEntry value="org.eclipse.osee.orcs.feature:default"/>
+<setEntry value="org.eclipse.osee.x.core.external.feature:default"/>
+<setEntry value="org.eclipse.osee.x.core.feature:default"/>
+</setAttribute>
+<booleanAttribute key="show_selected_only" value="true"/>
+<stringAttribute key="timestamp" value="1342653904563"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="true"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/build.properties b/plugins/org.eclipse.osee.orcs.account.admin.test/build.properties
new file mode 100644
index 0000000000..34d2e4d2da
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/pom.xml b/plugins/org.eclipse.osee.orcs.account.admin.test/pom.xml
new file mode 100644
index 0000000000..e034e9ef05
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.orcs.parent</artifactId>
+ <version>0.17.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.orcs.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.orcs.account.admin.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>OSEE ORCS Account Admin Test - (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.osee.orcs.account.admin.test</testSuite>
+ <testClass>org.eclipse.osee.orcs.account.admin.OrcsAccountTestSuite</testClass>
+ <dependencies>
+ <dependency>
+ <type>eclipse-feature</type>
+ <artifactId>org.eclipse.osee.x.core.external.feature</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ <dependency>
+ <type>eclipse-feature</type>
+ <artifactId>org.eclipse.osee.x.core.feature</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ <dependency>
+ <type>eclipse-feature</type>
+ <artifactId>org.eclipse.osee.orcs.feature</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/OrcsAccountTestSuite.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/OrcsAccountTestSuite.java
new file mode 100644
index 0000000000..3e0c0eac99
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/OrcsAccountTestSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.orcs.account.admin;
+
+import org.eclipse.osee.orcs.account.admin.integration.OsgiIntegrationTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({OsgiIntegrationTestSuite.class})
+public class OrcsAccountTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageImplTest.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageImplTest.java
new file mode 100644
index 0000000000..d9916db2c8
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageImplTest.java
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.orcs.account.admin.integration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.account.admin.AccessDetails;
+import org.eclipse.osee.account.admin.Account;
+import org.eclipse.osee.account.admin.AccountAccess;
+import org.eclipse.osee.account.admin.AccountAdmin;
+import org.eclipse.osee.account.admin.AccountPreferences;
+import org.eclipse.osee.account.admin.CreateAccountRequest;
+import org.eclipse.osee.account.admin.ds.AccountStorage;
+import org.eclipse.osee.framework.jdk.core.type.Identifiable;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.framework.jdk.core.util.Compare;
+import org.eclipse.osee.orcs.account.admin.internal.OrcsAccountStorageImpl;
+import org.eclipse.osee.orcs.db.mock.OsgiService;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+
+/**
+ * Test Case for {@link AccountAdmin} using {@link OrcsAccountStorageImpl}
+ *
+ * @author Roberto E. Escobar
+ */
+public class OrcsAccountStorageImplTest {
+
+ @Rule
+ public TestRule osgi = OrcsIntegrationRule.integrationRule(this, "osee.demo.hsql");
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Rule
+ public TestName testName = new TestName();
+
+ @OsgiService
+ private AccountStorage storage;
+
+ // @formatter:off
+ @Mock private CreateAccountRequest request;
+ @Mock private AccountPreferences preferences;
+ // @formatter:on
+
+ private String name;
+ private String email;
+ private String username;
+ private boolean active;
+ private Map<String, String> prefs;
+
+ private Identifiable<String> newAccount;
+
+ @Before
+ public void testSetup() {
+ initMocks(this);
+
+ String methodName = testName.getMethodName();
+
+ name = String.format("displayName-%s", methodName);
+ email = String.format("%s@email.com", methodName);
+ username = String.format("userName-%s", methodName);
+ active = true;
+
+ prefs = new HashMap<String, String>();
+ prefs.put("a", "1");
+ prefs.put("b", "2");
+ prefs.put("c", "true");
+
+ when(request.getDisplayName()).thenReturn(name);
+ when(request.getEmail()).thenReturn(email);
+ when(request.getUserName()).thenReturn(username);
+ when(request.getPreferences()).thenReturn(prefs);
+ when(request.isActive()).thenReturn(active);
+
+ newAccount = storage.createAccount(request);
+ }
+
+ @Test
+ public void testGetAllAccounts() {
+ ResultSet<Account> result = storage.getAllAccounts();
+ assertEquals(10, result.size());
+ }
+
+ @Test
+ public void testGetById() {
+ ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ Account account1 = result.getExactlyOne();
+ assertAccount(account1, newAccount.getGuid(), name, email, username, active, prefs);
+ }
+
+ @Test
+ public void testGetByUuiId() {
+ ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ Account account1 = result.getExactlyOne();
+ assertAccount(account1, newAccount.getGuid(), name, email, username, active, prefs);
+
+ ResultSet<Account> result2 = storage.getAccountByLocalId(account1.getId());
+ Account account2 = result2.getExactlyOne();
+ assertEquals(account1, account2);
+ assertAccount(account2, newAccount.getGuid(), name, email, username, active, prefs);
+ }
+
+ @Test
+ public void testGetByName() {
+ ResultSet<Account> result = storage.getAccountByName(name);
+ Account account = result.getExactlyOne();
+ assertAccount(account, newAccount.getGuid(), name, email, username, active, prefs);
+ }
+
+ @Test
+ public void testGetByEmail() {
+ ResultSet<Account> result = storage.getAccountByEmail(email);
+ Account account = result.getExactlyOne();
+ assertAccount(account, newAccount.getGuid(), name, email, username, active, prefs);
+ }
+
+ @Test
+ public void testGetByUserName() {
+ ResultSet<Account> result = storage.getAccountByUserName(username);
+ Account account = result.getExactlyOne();
+ assertAccount(account, newAccount.getGuid(), name, email, username, active, prefs);
+ }
+
+ @Test
+ public void testGetAccountPrefsByUuid() {
+ AccountPreferences actual = storage.getAccountPreferencesByUuid(newAccount.getGuid()).getExactlyOne();
+ assertPrefs(actual, newAccount.getGuid(), prefs);
+
+ AccountPreferences actual2 = storage.getAccountPreferencesById(actual.getId()).getExactlyOne();
+ assertPrefs(actual2, newAccount.getGuid(), prefs);
+ }
+
+ @Test
+ public void testGetAccountPrefsByLocalId() {
+ Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+
+ AccountPreferences actual = storage.getAccountPreferencesById(account.getId()).getExactlyOne();
+ assertPrefs(actual, account.getGuid(), account.getId(), prefs);
+ }
+
+ @Test
+ public void testSetActive() {
+ Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ assertAccount(account, newAccount.getGuid(), name, email, username, active, prefs);
+
+ storage.setActive(newAccount, false);
+
+ account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ assertFalse(account.isActive());
+
+ storage.setActive(newAccount, true);
+
+ account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ assertTrue(account.isActive());
+ }
+
+ @Test
+ public void testDeleteAccount() {
+ ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ assertEquals(1, result.size());
+
+ storage.deleteAccount(newAccount);
+
+ result = storage.getAccountByUuid(newAccount.getGuid());
+ assertTrue(result.isEmpty());
+ }
+
+ @Test
+ public void testSetAccountPreferences() {
+ Map<String, String> expected = new HashMap<String, String>();
+ expected.put("a", "x");
+ expected.put("b", "y");
+ expected.put("c", "z");
+ expected.put("d", "false");
+
+ storage.setAccountPreferences(newAccount, expected);
+
+ Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ AccountPreferences actual = account.getPreferences();
+ assertPrefs(actual, newAccount.getGuid(), account.getId(), expected);
+ }
+
+ @Test
+ public void testAccountAccess() {
+ String token = "myAccess";
+ String address = "myAddress";
+ String details = "myDetails";
+
+ AccessDetails accessDetails = Mockito.mock(AccessDetails.class);
+ when(accessDetails.getAccessDetails()).thenReturn(details);
+ when(accessDetails.getRemoteAddress()).thenReturn(address);
+
+ Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+
+ AccountAccess actual = storage.createAccountAccess(token, account, accessDetails);
+ assertEquals(details, actual.getAccessDetails());
+ assertEquals(address, actual.getAccessedFrom());
+ assertEquals(token, actual.getAccessToken());
+ assertEquals(account.getId(), actual.getAccountId());
+ assertNotNull(actual.getCreatedOn());
+ assertNotNull(actual.getLastAccessedOn());
+
+ //
+ ResultSet<AccountAccess> result = storage.getAccountAccessByAccessToken(token);
+ AccountAccess actualAccess = result.getExactlyOne();
+ assertEquals(actual, actualAccess);
+
+ storage.deleteAccountAccessByAccessToken(token);
+ assertEquals(true, storage.getAccountAccessByAccessToken(token).isEmpty());
+ }
+
+ private static void assertPrefs(AccountPreferences expected, String uuid, long accountId, Map<String, String> prefs) {
+ assertEquals(accountId, expected.getId());
+ assertPrefs(expected, uuid, prefs);
+ }
+
+ private static void assertPrefs(AccountPreferences expected, String uuid, Map<String, String> prefs) {
+ assertTrue(expected.getId() > 0L);
+
+ assertEquals(uuid, expected.getGuid());
+
+ Map<String, String> actual = expected.asMap();
+ if (prefs != null) {
+ assertNotNull(actual);
+ assertEquals(prefs.size(), actual.size());
+ assertPrefs(prefs, actual);
+ } else {
+ Assert.assertNull(actual);
+ }
+ }
+
+ private static void assertPrefs(Map<String, String> expected, Map<String, String> actual) {
+ assertEquals(false, Compare.isDifferent(expected, actual));
+ }
+
+ private static void assertAccount(Account account, String uuid, String name, String email, String username, boolean isActive, Map<String, String> prefs) {
+ assertTrue(account.getId() > 0L);
+ assertEquals(uuid, account.getGuid());
+
+ assertEquals(name, account.getName());
+ assertEquals(email, account.getEmail());
+ assertEquals(username, account.getUserName());
+ assertEquals(isActive, account.isActive());
+
+ assertPrefs(account.getPreferences(), uuid, prefs);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsIntegrationRule.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsIntegrationRule.java
new file mode 100644
index 0000000000..faba050ead
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsIntegrationRule.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.orcs.account.admin.integration;
+
+import org.eclipse.osee.account.admin.AccountAdmin;
+import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.db.mock.OseeDatabase;
+import org.eclipse.osee.orcs.db.mock.OsgiRule;
+import org.eclipse.osee.orcs.db.mock.OsgiService;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.osgi.service.event.EventAdmin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class OrcsIntegrationRule extends OsgiRule {
+
+ private OrcsIntegrationRule() {
+ // Utility
+ }
+
+ public static TestRule integrationRule(Object testObject, String dbId) {
+ return RuleChain.outerRule(new OseeDatabase(dbId)).around(new OsgiRule(new CheckServices(), testObject));
+ }
+
+ public static class CheckServices {
+ // @formatter:off
+ @OsgiService public Log log;
+ @OsgiService public EventAdmin eventAdmin;
+ @OsgiService public EventService eventService;
+ @OsgiService public ExecutorAdmin executorAdmin;
+ @OsgiService public IOseeDatabaseService dbService;
+ @OsgiService public IOseeModelFactoryService modelFactory;
+ @OsgiService public OrcsApi orcsApi;
+ @OsgiService public AccountAdmin accountAdmin;
+ // @formatter:on
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java
new file mode 100644
index 0000000000..76b24c91fa
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.orcs.account.admin.integration;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({OrcsAccountStorageImplTest.class})
+public class OsgiIntegrationTestSuite {
+ // Test Suite
+}

Back to the top