diff options
author | slewis | 2008-05-11 22:30:46 +0000 |
---|---|---|
committer | slewis | 2008-05-11 22:30:46 +0000 |
commit | 7917539efd9bba6ec185e708ac38f3d08f91d47c (patch) | |
tree | 480cd56d76468fc927614597169a7e273a433761 /tests/bundles/org.eclipse.ecf.tests.storage | |
parent | 3adf09025d1d299c886f16ff62d21bffd461a3c3 (diff) | |
download | org.eclipse.ecf-7917539efd9bba6ec185e708ac38f3d08f91d47c.tar.gz org.eclipse.ecf-7917539efd9bba6ec185e708ac38f3d08f91d47c.tar.xz org.eclipse.ecf-7917539efd9bba6ec185e708ac38f3d08f91d47c.zip |
initial checkin of org.eclipse.ecf.tests.storage for testing ECF IDStore in org.eclipse.ecf.storage
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests.storage')
10 files changed, 207 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/.classpath b/tests/bundles/org.eclipse.ecf.tests.storage/.classpath new file mode 100755 index 000000000..2fbb7a23e --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/.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/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/.project b/tests/bundles/org.eclipse.ecf.tests.storage/.project new file mode 100755 index 000000000..86f8fc255 --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.tests.storage</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> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.jdt.core.prefs b/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000..726a2df56 --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +#Fri May 09 14:03:57 PDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.pde.core.prefs b/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.pde.core.prefs new file mode 100755 index 000000000..eaed916cf --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Fri May 09 14:03:57 PDT 2008 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/META-INF/MANIFEST.MF b/tests/bundles/org.eclipse.ecf.tests.storage/META-INF/MANIFEST.MF new file mode 100755 index 000000000..6a8215064 --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ECF Securestorage Tests +Bundle-SymbolicName: org.eclipse.ecf.tests.storage +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.ecf.internal.tests.securestorage.Activator +Bundle-Vendor: Eclipse.org +Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Import-Package: org.eclipse.equinox.security.storage;version="1.0.0", + org.osgi.framework;version="1.3.0", + org.osgi.util.tracker;version="1.3.3" +Eclipse-LazyStart: true +Require-Bundle: org.junit;bundle-version="3.8.2", + org.eclipse.ecf.storage;bundle-version="1.0.0", + org.eclipse.ecf;bundle-version="2.0.0", + org.eclipse.equinox.common;bundle-version="3.4.0" +Bundle-ActivationPolicy: lazy diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/about.html b/tests/bundles/org.eclipse.ecf.tests.storage/about.html new file mode 100755 index 000000000..6a60a262f --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 29, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/build.properties b/tests/bundles/org.eclipse.ecf.tests.storage/build.properties new file mode 100755 index 000000000..34d2e4d2d --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/plugin.properties b/tests/bundles/org.eclipse.ecf.tests.storage/plugin.properties new file mode 100755 index 000000000..25da47d65 --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/plugin.properties @@ -0,0 +1,2 @@ +plugin.name=ECF Secure Storage API Tests +plugin.provider=Eclipse.org
\ No newline at end of file diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/internal/tests/securestorage/Activator.java b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/internal/tests/securestorage/Activator.java new file mode 100755 index 000000000..675b1494b --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/internal/tests/securestorage/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.ecf.internal.tests.securestorage; + +import org.eclipse.ecf.storage.IIDStore; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; + +public class Activator implements BundleActivator { + + private static Activator plugin; + + private BundleContext context; + + ServiceTracker storageServiceTracker; + + public static Activator getDefault() { + return plugin; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + this.context = context; + } + + public IIDStore getIDStore() { + if (storageServiceTracker == null) { + storageServiceTracker = new ServiceTracker(context, IIDStore.class.getName(), null); + storageServiceTracker.open(); + } + return (IIDStore) storageServiceTracker.getService(); + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (storageServiceTracker != null) { + storageServiceTracker.close(); + storageServiceTracker = null; + } + this.context = null; + plugin = null; + } + +} diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java new file mode 100755 index 000000000..f899d19ad --- /dev/null +++ b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 2008 Composent, Inc. and others. + * 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: + * Composent, Inc. - initial API and implementation + *****************************************************************************/ + +package org.eclipse.ecf.tests.securestorage; + +import junit.framework.TestCase; + +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.identity.IDFactory; +import org.eclipse.ecf.internal.tests.securestorage.Activator; +import org.eclipse.ecf.storage.IIDStore; +import org.eclipse.equinox.security.storage.ISecurePreferences; + +/** + * + */ +public class IDStoreTest extends TestCase { + + IIDStore idStore; + + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + idStore = Activator.getDefault().getIDStore(); + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + idStore = null; + } + + public void testIDStore() { + assertNotNull(idStore); + } + + public void testStoreGUID() throws Exception { + final ID newGUID = IDFactory.getDefault().createGUID(); + final ISecurePreferences prefs = idStore.getNode(newGUID); + assertNotNull(prefs); + } +} |