From 05109de7609095a4c3167c4ef33c9258054e2826 Mon Sep 17 00:00:00 2001 From: jmisinco Date: Tue, 10 May 2011 16:25:17 -0700 Subject: refactor[bgz_343296]: Restructure org.eclipse.osee.framework.jdk.core.test to mirror the corresponding bundle --- .../META-INF/MANIFEST.MF | 2 +- .../tests/suite/CoreRuntimeFeatureTestsSuite.java | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../osee/framework/jdk/core/JdkCoreTestSuite.java | 32 +++ .../jdk/core/mock/MockFileWatcherListener.java | 67 +++++ .../jdk/core/rules/JdkCoreRuleTestSuite.java | 23 ++ .../jdk/core/rules/WordMLNewLineMakerRuleTest.java | 85 ++++++ .../jdk/core/rules/sample_icd_formatted.xml | 44 +++ .../framework/jdk/core/test/JdkCoreTestSuite.java | 32 --- .../core/test/mock/MockFileWatcherListener.java | 67 ----- .../jdk/core/test/mock/MockPropertyStore.java | 54 ---- .../jdk/core/test/mock/PropertyStoreTestUtil.java | 91 ------ .../jdk/core/test/rules/JdkCoreRuleTestSuite.java | 23 -- .../test/rules/WordMLNewLineMakerRuleTest.java | 85 ------ .../jdk/core/test/rules/sample_icd_formatted.xml | 44 --- .../jdk/core/test/text/JdkCoreTextTestSuite.java | 23 -- .../jdk/core/test/text/UtfReadingRuleTest.java | 115 -------- .../framework/jdk/core/test/text/utf8_input.xml | 1 - .../core/test/type/CompositeKeyHashMapTest.java | 40 --- .../jdk/core/test/type/JdkCoreTypeTestSuite.java | 30 -- .../jdk/core/test/type/MatchLocationTest.java | 72 ----- .../framework/jdk/core/test/type/PairTest.java | 85 ------ .../jdk/core/test/type/PropertyStoreTest.java | 254 ---------------- .../core/test/type/PropertyStoreWriterTest.java | 91 ------ .../framework/jdk/core/test/type/QuadTest.java | 146 ---------- .../framework/jdk/core/test/type/TripletTest.java | 111 ------- .../jdk/core/test/util/CollectionsTest.java | 113 -------- .../framework/jdk/core/test/util/CompareTest.java | 93 ------ .../framework/jdk/core/test/util/GUIDTest.java | 84 ------ .../jdk/core/test/util/HashCollectionTest.java | 185 ------------ .../jdk/core/test/util/HumanReadableIdTest.java | 319 --------------------- .../jdk/core/test/util/JdkCoreUtilTestSuite.java | 34 --- .../jdk/core/test/util/ProcessesTest.java | 77 ----- .../jdk/core/test/util/ReservedCharactersTest.java | 62 ---- .../framework/jdk/core/test/util/StringsTest.java | 70 ----- .../jdk/core/test/util/io/FileWatcherTest.java | 113 -------- .../jdk/core/test/util/io/IoTestSuite.java | 29 -- .../core/test/util/io/xml/ExcelXmlWriterTest.java | 78 ----- .../jdk/core/test/util/io/xml/IoXmlTestSuite.java | 24 -- .../framework/jdk/core/test/util/xml/JAXPTest.java | 235 --------------- .../jdk/core/test/util/xml/XmlTestSuite.java | 27 -- .../jdk/core/text/JdkCoreTextTestSuite.java | 23 ++ .../jdk/core/text/UtfReadingRuleTest.java | 115 ++++++++ .../osee/framework/jdk/core/text/utf8_input.xml | 1 + .../jdk/core/type/CompositeKeyHashMapTest.java | 40 +++ .../jdk/core/type/JdkCoreTypeTestSuite.java | 30 ++ .../framework/jdk/core/type/MatchLocationTest.java | 72 +++++ .../osee/framework/jdk/core/type/PairTest.java | 85 ++++++ .../framework/jdk/core/type/PropertyStoreTest.java | 251 ++++++++++++++++ .../jdk/core/type/PropertyStoreTestUtil.java | 92 ++++++ .../jdk/core/type/PropertyStoreWriterTest.java | 88 ++++++ .../osee/framework/jdk/core/type/QuadTest.java | 146 ++++++++++ .../osee/framework/jdk/core/type/TripletTest.java | 111 +++++++ .../framework/jdk/core/util/CollectionsTest.java | 113 ++++++++ .../osee/framework/jdk/core/util/CompareTest.java | 93 ++++++ .../osee/framework/jdk/core/util/GUIDTest.java | 84 ++++++ .../jdk/core/util/HashCollectionTest.java | 185 ++++++++++++ .../jdk/core/util/HumanReadableIdTest.java | 319 +++++++++++++++++++++ .../jdk/core/util/JdkCoreUtilTestSuite.java | 34 +++ .../framework/jdk/core/util/ProcessesTest.java | 77 +++++ .../jdk/core/util/ReservedCharactersTest.java | 62 ++++ .../osee/framework/jdk/core/util/StringsTest.java | 70 +++++ .../jdk/core/util/io/FileWatcherTest.java | 113 ++++++++ .../framework/jdk/core/util/io/IoTestSuite.java | 29 ++ .../jdk/core/util/io/xml/ExcelXmlWriterTest.java | 78 +++++ .../jdk/core/util/io/xml/IoXmlTestSuite.java | 24 ++ .../osee/framework/jdk/core/util/xml/JAXPTest.java | 235 +++++++++++++++ .../framework/jdk/core/util/xml/XmlTestSuite.java | 27 ++ .../META-INF/MANIFEST.MF | 2 +- .../resource/management/test/OptionsTest.java | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../server/tests/AllServerTestsSuite.java | 2 +- 73 files changed, 2858 insertions(+), 2917 deletions(-) create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/JdkCoreTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/mock/MockFileWatcherListener.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/JdkCoreRuleTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/WordMLNewLineMakerRuleTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/sample_icd_formatted.xml delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/JdkCoreTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockFileWatcherListener.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockPropertyStore.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/PropertyStoreTestUtil.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/JdkCoreRuleTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/WordMLNewLineMakerRuleTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/sample_icd_formatted.xml delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/JdkCoreTextTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/UtfReadingRuleTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/utf8_input.xml delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/CompositeKeyHashMapTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/JdkCoreTypeTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/MatchLocationTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PairTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreWriterTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/QuadTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/TripletTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CollectionsTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CompareTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/GUIDTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HashCollectionTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HumanReadableIdTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/JdkCoreUtilTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ProcessesTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ReservedCharactersTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/StringsTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/FileWatcherTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/IoTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/xml/ExcelXmlWriterTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/xml/IoXmlTestSuite.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/xml/JAXPTest.java delete mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/xml/XmlTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/JdkCoreTextTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/utf8_input.xml create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/CompositeKeyHashMapTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/JdkCoreTypeTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/MatchLocationTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/PairTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/PropertyStoreTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/PropertyStoreTestUtil.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/PropertyStoreWriterTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/QuadTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/type/TripletTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/CollectionsTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/CompareTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/GUIDTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/HashCollectionTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/HumanReadableIdTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/JdkCoreUtilTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/ProcessesTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/ReservedCharactersTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/StringsTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/io/FileWatcherTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/io/IoTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/io/xml/ExcelXmlWriterTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/io/xml/IoXmlTestSuite.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/xml/JAXPTest.java create mode 100644 plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/util/xml/XmlTestSuite.java diff --git a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF index 4529cfa4329..9f8d133409a 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF @@ -30,7 +30,7 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.core.test, org.eclipse.osee.framework.database.init, org.eclipse.osee.framework.database.test, - org.eclipse.osee.framework.jdk.core.test, + org.eclipse.osee.framework.jdk.core, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.io, org.eclipse.osee.framework.lifecycle.test, diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/suite/CoreRuntimeFeatureTestsSuite.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/suite/CoreRuntimeFeatureTestsSuite.java index b5f1287d92b..45409664176 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/suite/CoreRuntimeFeatureTestsSuite.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/suite/CoreRuntimeFeatureTestsSuite.java @@ -14,7 +14,7 @@ import org.eclipse.osee.framework.core.message.test.AllCoreMessageTestSuite; import org.eclipse.osee.framework.core.model.test.AllCoreModelTestSuite; import org.eclipse.osee.framework.core.test.FrameworkCoreTestSuite; import org.eclipse.osee.framework.database.test.DatabaseTestSuite; -import org.eclipse.osee.framework.jdk.core.test.JdkCoreTestSuite; +import org.eclipse.osee.framework.jdk.core.JdkCoreTestSuite; import org.eclipse.osee.framework.lifecycle.test.AllLifecycleTestSuite; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.jdk.core.test/META-INF/MANIFEST.MF index 0b7cf992bbf..d4fe79e31c9 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 0.9.9.qualifier Bundle-Vendor: Eclipse Open System Engineering Environment Fragment-Host: org.eclipse.osee.framework.jdk.core;bundle-version="0.4.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.osee.framework.jdk.core.test, - org.eclipse.osee.framework.jdk.core.test.mock, - org.eclipse.osee.framework.jdk.core.test.type +Export-Package: org.eclipse.osee.framework.jdk.core, + org.eclipse.osee.framework.jdk.core.mock, + org.eclipse.osee.framework.jdk.core.type Require-Bundle: org.junit diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/JdkCoreTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/JdkCoreTestSuite.java new file mode 100644 index 00000000000..c2e32873bba --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/JdkCoreTestSuite.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.jdk.core; + +import org.eclipse.osee.framework.jdk.core.rules.JdkCoreRuleTestSuite; +import org.eclipse.osee.framework.jdk.core.text.JdkCoreTextTestSuite; +import org.eclipse.osee.framework.jdk.core.type.JdkCoreTypeTestSuite; +import org.eclipse.osee.framework.jdk.core.util.JdkCoreUtilTestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * @author Roberto E. Escobar + */ + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + JdkCoreRuleTestSuite.class, + JdkCoreTextTestSuite.class, + JdkCoreTypeTestSuite.class, + JdkCoreUtilTestSuite.class,}) +public class JdkCoreTestSuite { + // Test Suite Class +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/mock/MockFileWatcherListener.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/mock/MockFileWatcherListener.java new file mode 100644 index 00000000000..b85af08b5cc --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/mock/MockFileWatcherListener.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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.jdk.core.mock; + +import java.util.Collection; +import org.eclipse.osee.framework.jdk.core.util.io.FileChangeEvent; +import org.eclipse.osee.framework.jdk.core.util.io.IFileWatcherListener; + +/** + * @author Roberto E. Escobar + */ +public class MockFileWatcherListener implements IFileWatcherListener { + + private int fileModifiedCallCount = 0; + private int handleExceptionCallCount = 0; + private Exception ex; + private Collection fileChangeEvents; + + @Override + public void filesModified(Collection fileChangeEvents) { + fileModifiedCallCount++; + this.fileChangeEvents = fileChangeEvents; + synchronized (this) { + notify(); + } + } + + @Override + public void handleException(Exception ex) { + handleExceptionCallCount++; + this.ex = ex; + synchronized (this) { + notify(); + } + } + + public int getFileModifiedCallCount() { + return fileModifiedCallCount; + } + + public int getHandleExceptionCallCount() { + return handleExceptionCallCount; + } + + public Exception getEx() { + return ex; + } + + public Collection getFileChangeEvents() { + return fileChangeEvents; + } + + public void clear() { + fileModifiedCallCount = 0; + handleExceptionCallCount = 0; + ex = null; + fileChangeEvents = null; + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/JdkCoreRuleTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/JdkCoreRuleTestSuite.java new file mode 100644 index 00000000000..490e19d2776 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/JdkCoreRuleTestSuite.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2004, 2010 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.jdk.core.rules; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * @author Roberto E. Escobar + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({WordMLNewLineMakerRuleTest.class}) +public class JdkCoreRuleTestSuite { + // Test Suite Class +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/WordMLNewLineMakerRuleTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/WordMLNewLineMakerRuleTest.java new file mode 100644 index 00000000000..92d3120e738 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/WordMLNewLineMakerRuleTest.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2010 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.jdk.core.rules; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.UnsupportedCharsetException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; +import org.eclipse.osee.framework.jdk.core.text.rules.WordMLNewLineMaker; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests ability of this WordMLNewLineMakerRule to make new paragraphs by injecting at specific points in the + * file. + * + * @see WordMLNewLineMaker + * @author Karol M. Wilk + */ +public final class WordMLNewLineMakerRuleTest { + + private final static String INPUT_FILE_NAME = "sample_icd_formatted.xml"; + private final static String NEW_WP_INJECTION_FINGERPRINT = + ""; + + private final WordMLNewLineMaker wordNewLineMaker = new WordMLNewLineMaker(); + private final Pattern paragraphRegex = Pattern.compile("].*?", Pattern.DOTALL); + + @Test + public void testNewLineInserts() { + ChangeSet modifiedFile = null; + try { + modifiedFile = wordNewLineMaker.computeChanges(getResourceData(INPUT_FILE_NAME)); + } catch (IOException ioex) { + System.err.println("Error: " + ioex.getMessage()); + Assert.fail("Unable to process the file, " + "WordMLNewLineMaker threw an IOException..."); + } catch (IllegalCharsetNameException illegalName) { + System.err.println("Error: " + illegalName.getMessage()); + Assert.fail("Illegal charset name specified, " + "WordMLNewLineMaker threw an " + "IllegalCharsetNameException..."); + } catch (UnsupportedCharsetException unsupportedEx) { + System.err.println("Error: " + unsupportedEx.getMessage()); + Assert.fail("Unsupported charset, " + "WordMLNewLineMaker threw an " + "UnsupportedCharsetException..."); + } + + Assert.assertTrue(modifiedFile.getSourceLength() != 0); + + //Test Does it contain new paragraph injected signature ? + String modifiedFileAsString = modifiedFile.toString(); + Assert.assertTrue(modifiedFileAsString.contains(NEW_WP_INJECTION_FINGERPRINT)); + + //Test Does it have 2 word paragraphs instead of 1 ? + Matcher wpMatcher = paragraphRegex.matcher(modifiedFileAsString); + int count = 0; + while (wpMatcher.find()) { + count++; + } + Assert.assertTrue(count == 2); + + } + + private static String getResourceData(String name) throws IOException { + InputStream inputStream = null; + try { + inputStream = WordMLNewLineMakerRuleTest.class.getResourceAsStream(name); + String data = Lib.inputStreamToString(inputStream); + Assert.assertTrue(Strings.isValid(data)); + return data; + } finally { + Lib.close(inputStream); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/sample_icd_formatted.xml b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/sample_icd_formatted.xml new file mode 100644 index 00000000000..2447e4f945c --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/sample_icd_formatted.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + 1.1 + + + + + + + + Test + + + + + + + + of the new line maker. + + + . Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in ante nulla. Sed rhoncus lacinia nunc id vehicula. In eu metus at erat suscipit elementum. Aliquam posuere ante vel tellus tincidunt nec consequat ante ultrices. Proin luctus luctus convallis. Suspendisse potenti. + + + Nunc pulvinar arcu id libero ullamcorper in bibendum dolor elementum. Etiam euismod felis a felis pharetra sed eleifend mi interdum. Vivamus nisl elit, porta sed sagittis nec, lacinia quis dolor. Nam rhoncus nisl sed libero varius non aliquam purus faucibus. Curabitur non ante dui, pretium condimentum purus. Aliquam + + + congue, diam vel egestas consectetur, magna metus porta turpis, id tincidunt odio felis a justo. Maecenas sagittis pretium diam, at aliquam nisi convallis ut. Maecenas commodo egestas porttitor. In libero mauris, sollicitudin sit amet semper sit amet, posuere vel erat. Vestibulum sed sapien at nisi suscipit volutpat auctor suscipit odio. + + + + + diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/JdkCoreTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/JdkCoreTestSuite.java deleted file mode 100644 index 29e78eb9623..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/JdkCoreTestSuite.java +++ /dev/null @@ -1,32 +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.jdk.core.test; - -import org.eclipse.osee.framework.jdk.core.test.rules.JdkCoreRuleTestSuite; -import org.eclipse.osee.framework.jdk.core.test.text.JdkCoreTextTestSuite; -import org.eclipse.osee.framework.jdk.core.test.type.JdkCoreTypeTestSuite; -import org.eclipse.osee.framework.jdk.core.test.util.JdkCoreUtilTestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ - -@RunWith(Suite.class) -@Suite.SuiteClasses({ - JdkCoreRuleTestSuite.class, - JdkCoreTextTestSuite.class, - JdkCoreTypeTestSuite.class, - JdkCoreUtilTestSuite.class,}) -public class JdkCoreTestSuite { - // Test Suite Class -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockFileWatcherListener.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockFileWatcherListener.java deleted file mode 100644 index bcadfe688d0..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockFileWatcherListener.java +++ /dev/null @@ -1,67 +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.jdk.core.test.mock; - -import java.util.Collection; -import org.eclipse.osee.framework.jdk.core.util.io.FileChangeEvent; -import org.eclipse.osee.framework.jdk.core.util.io.IFileWatcherListener; - -/** - * @author Roberto E. Escobar - */ -public class MockFileWatcherListener implements IFileWatcherListener { - - private int fileModifiedCallCount = 0; - private int handleExceptionCallCount = 0; - private Exception ex; - private Collection fileChangeEvents; - - @Override - public void filesModified(Collection fileChangeEvents) { - fileModifiedCallCount++; - this.fileChangeEvents = fileChangeEvents; - synchronized (this) { - notify(); - } - } - - @Override - public void handleException(Exception ex) { - handleExceptionCallCount++; - this.ex = ex; - synchronized (this) { - notify(); - } - } - - public int getFileModifiedCallCount() { - return fileModifiedCallCount; - } - - public int getHandleExceptionCallCount() { - return handleExceptionCallCount; - } - - public Exception getEx() { - return ex; - } - - public Collection getFileChangeEvents() { - return fileChangeEvents; - } - - public void clear() { - fileModifiedCallCount = 0; - handleExceptionCallCount = 0; - ex = null; - fileChangeEvents = null; - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockPropertyStore.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockPropertyStore.java deleted file mode 100644 index 6741fa8c5c8..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/MockPropertyStore.java +++ /dev/null @@ -1,54 +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.jdk.core.test.mock; - -import java.util.Map; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; - -/** - * @author Roberto E. Escobar - */ -public class MockPropertyStore extends PropertyStore { - - private static final long serialVersionUID = 750608597542081776L; - - public MockPropertyStore() { - super(); - } - - public MockPropertyStore(String id) { - super(id); - } - - public MockPropertyStore(Map properties) { - super(properties); - } - - @Override - public void setId(String name) { - super.setId(name); - } - - @Override - public Map getItems() { - return super.getItems(); - } - - @Override - public Map getArrays() { - return super.getArrays(); - } - - @Override - public Map getPropertyStores() { - return super.getPropertyStores(); - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/PropertyStoreTestUtil.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/PropertyStoreTestUtil.java deleted file mode 100644 index 6d89d299de0..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/mock/PropertyStoreTestUtil.java +++ /dev/null @@ -1,91 +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.jdk.core.test.mock; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.TreeMap; -import org.junit.Assert; - -/** - * @author Roberto E. Escobar - */ -public final class PropertyStoreTestUtil { - - private PropertyStoreTestUtil() { - // Utility Class - } - - public static void checkArrays(String[] expArray, String[] actualArray) { - Assert.assertEquals(expArray.length, actualArray.length); - for (int index = 0; index < expArray.length; index++) { - Assert.assertEquals(expArray[index], actualArray[index]); - } - } - - public static MockPropertyStore createPropertyStore() { - MockPropertyStore store = new MockPropertyStore(); - Assert.assertEquals("", store.getId()); - Assert.assertNotNull(store.getItems()); - Assert.assertNotNull(store.getArrays()); - Assert.assertTrue(store.isEmpty()); - return store; - } - - public static MockPropertyStore createPropertyStore(String id) { - MockPropertyStore store = new MockPropertyStore(id); - Assert.assertEquals(id, store.getId()); - Assert.assertNotNull(store.getItems()); - Assert.assertNotNull(store.getArrays()); - return store; - } - - public static MockPropertyStore createPropertyStore(Map properties) { - MockPropertyStore store = new MockPropertyStore(properties); - Assert.assertEquals(properties, store.getItems()); - Assert.assertEquals(String.valueOf(properties.hashCode()), store.getId()); - Assert.assertNotNull(store.getItems()); - Assert.assertNotNull(store.getArrays()); - return store; - } - - public static void checkEquals(MockPropertyStore expected, MockPropertyStore actual) { - Assert.assertEquals(expected.getId(), actual.getId()); - checkPropertiesEqual(expected.getItems(), actual.getItems()); - checkPropertiesEqual(expected.getArrays(), actual.getArrays()); - checkPropertiesEqual(expected.getPropertyStores(), actual.getPropertyStores()); - } - - public static void checkPropertiesEqual(Map expected, Map actual) { - Assert.assertEquals(expected.size(), actual.size()); - for (Entry expectedEntry : expected.entrySet()) { - Object expectedValue = expectedEntry.getValue(); - Object actualValue = actual.get(expectedEntry.getKey()); - if (expectedValue instanceof String[]) { - String[] expArray = (String[]) expectedValue; - String[] actualArray = (String[]) actualValue; - checkArrays(expArray, actualArray); - } else { - Assert.assertEquals(expectedValue, actualValue); - } - } - } - - public static Map convertPropertiesToMap(Properties props) { - Map result = new TreeMap(); - for (Entry entry : props.entrySet()) { - result.put((String) entry.getKey(), entry.getValue()); - } - return result; - } - -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/JdkCoreRuleTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/JdkCoreRuleTestSuite.java deleted file mode 100644 index 343a3734a80..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/JdkCoreRuleTestSuite.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jdk.core.test.rules; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({WordMLNewLineMakerRuleTest.class}) -public class JdkCoreRuleTestSuite { - // Test Suite Class -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/WordMLNewLineMakerRuleTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/WordMLNewLineMakerRuleTest.java deleted file mode 100644 index 4f3a455cbe9..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/WordMLNewLineMakerRuleTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.rules; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.IllegalCharsetNameException; -import java.nio.charset.UnsupportedCharsetException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; -import org.eclipse.osee.framework.jdk.core.text.rules.WordMLNewLineMaker; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.junit.Assert; -import org.junit.Test; - -/** - * Tests ability of this WordMLNewLineMakerRule to make new paragraphs by injecting at specific points in the - * file. - * - * @see WordMLNewLineMaker - * @author Karol M. Wilk - */ -public final class WordMLNewLineMakerRuleTest { - - private final static String INPUT_FILE_NAME = "sample_icd_formatted.xml"; - private final static String NEW_WP_INJECTION_FINGERPRINT = - ""; - - private final WordMLNewLineMaker wordNewLineMaker = new WordMLNewLineMaker(); - private final Pattern paragraphRegex = Pattern.compile("].*?", Pattern.DOTALL); - - @Test - public void testNewLineInserts() { - ChangeSet modifiedFile = null; - try { - modifiedFile = wordNewLineMaker.computeChanges(getResourceData(INPUT_FILE_NAME)); - } catch (IOException ioex) { - System.err.println("Error: " + ioex.getMessage()); - Assert.fail("Unable to process the file, " + "WordMLNewLineMaker threw an IOException..."); - } catch (IllegalCharsetNameException illegalName) { - System.err.println("Error: " + illegalName.getMessage()); - Assert.fail("Illegal charset name specified, " + "WordMLNewLineMaker threw an " + "IllegalCharsetNameException..."); - } catch (UnsupportedCharsetException unsupportedEx) { - System.err.println("Error: " + unsupportedEx.getMessage()); - Assert.fail("Unsupported charset, " + "WordMLNewLineMaker threw an " + "UnsupportedCharsetException..."); - } - - Assert.assertTrue(modifiedFile.getSourceLength() != 0); - - //Test Does it contain new paragraph injected signature ? - String modifiedFileAsString = modifiedFile.toString(); - Assert.assertTrue(modifiedFileAsString.contains(NEW_WP_INJECTION_FINGERPRINT)); - - //Test Does it have 2 word paragraphs instead of 1 ? - Matcher wpMatcher = paragraphRegex.matcher(modifiedFileAsString); - int count = 0; - while (wpMatcher.find()) { - count++; - } - Assert.assertTrue(count == 2); - - } - - private static String getResourceData(String name) throws IOException { - InputStream inputStream = null; - try { - inputStream = WordMLNewLineMakerRuleTest.class.getResourceAsStream(name); - String data = Lib.inputStreamToString(inputStream); - Assert.assertTrue(Strings.isValid(data)); - return data; - } finally { - Lib.close(inputStream); - } - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/sample_icd_formatted.xml b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/sample_icd_formatted.xml deleted file mode 100644 index 2447e4f945c..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/rules/sample_icd_formatted.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - 1.1 - - - - - - - - Test - - - - - - - - of the new line maker. - - - . Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in ante nulla. Sed rhoncus lacinia nunc id vehicula. In eu metus at erat suscipit elementum. Aliquam posuere ante vel tellus tincidunt nec consequat ante ultrices. Proin luctus luctus convallis. Suspendisse potenti. - - - Nunc pulvinar arcu id libero ullamcorper in bibendum dolor elementum. Etiam euismod felis a felis pharetra sed eleifend mi interdum. Vivamus nisl elit, porta sed sagittis nec, lacinia quis dolor. Nam rhoncus nisl sed libero varius non aliquam purus faucibus. Curabitur non ante dui, pretium condimentum purus. Aliquam - - - congue, diam vel egestas consectetur, magna metus porta turpis, id tincidunt odio felis a justo. Maecenas sagittis pretium diam, at aliquam nisi convallis ut. Maecenas commodo egestas porttitor. In libero mauris, sollicitudin sit amet semper sit amet, posuere vel erat. Vestibulum sed sapien at nisi suscipit volutpat auctor suscipit odio. - - - - - diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/JdkCoreTextTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/JdkCoreTextTestSuite.java deleted file mode 100644 index 007c5ef1d3b..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/JdkCoreTextTestSuite.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.text; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Karol M. Wilk - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({UtfReadingRuleTest.class}) -public class JdkCoreTextTestSuite { - // Test Suite -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/UtfReadingRuleTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/UtfReadingRuleTest.java deleted file mode 100644 index ab23c806991..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/UtfReadingRuleTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.text; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.nio.charset.UnsupportedCharsetException; -import java.util.Stack; -import org.eclipse.osee.framework.jdk.core.text.Rule; -import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.junit.Assert; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -/** - * Tests ability to read files in charsets, particularly UTF8 - * - *
- * {@link Rule}
- * {@link Lib}
- * 
- * - * @author Karol M. Wilk - */ -public final class UtfReadingRuleTest { - - private static final String FILE_INPUT = "utf8_input.xml"; - - @org.junit.Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - - private File getInputFile() throws IOException { - File outfile = tempFolder.newFile("utf8_input_copy.xml"); - URL url = UtfReadingRuleTest.class.getResource(FILE_INPUT); - InputStream inputStream = null; - try { - inputStream = new BufferedInputStream(url.openStream()); - Lib.inputStreamToFile(inputStream, outfile); - } finally { - Lib.close(inputStream); - } - return outfile; - } - - @Test - public void testWrongFileName() throws IOException { - Utf8TestRule rule = new Utf8TestRule(); - rule.process(new File("./notexistentFile.txt")); - Assert.assertNull(rule.lastOutput); - } - - @Test - public void testCharset() { - Stack charsetStack = new Stack(); - charsetStack.add("UnknownCharset"); - charsetStack.add("UTF-8"); - - Utf8TestRule rule = new Utf8TestRule(); - while (!charsetStack.isEmpty()) { - try { - File inputFile = getInputFile(); - rule.setCharsetString(charsetStack.pop()); - rule.process(inputFile); - } catch (Exception ex) { - Assert.assertTrue("unexpected/wrong exception thrown testCharset(), Exception: " + ex.toString(), - ex instanceof UnsupportedCharsetException || ex instanceof UnsupportedEncodingException); - } - } - } - - @Test - public void testUtf8ReadData() throws IOException { - Utf8TestRule rule = new Utf8TestRule(); - try { - File inputFile = getInputFile(); - rule.process(inputFile); - } catch (UnsupportedCharsetException ex) { - Assert.assertTrue(true); - } catch (Exception ex) { - Assert.fail("unexpected/wrong exception thrown testCharset()"); - } - - //trim off extra data - String expectedUtf8String = Lib.fileToString(getInputFile()); - String actual = rule.getLastOutput().toString().trim(); - Assert.assertEquals(expectedUtf8String, actual); - } - - private static final class Utf8TestRule extends Rule { - private CharSequence lastOutput; - - @Override - public ChangeSet computeChanges(final CharSequence seq) { - lastOutput = seq; - return new ChangeSet(seq); - } - - public CharSequence getLastOutput() { - return lastOutput; - } - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/utf8_input.xml b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/utf8_input.xml deleted file mode 100644 index e2b766c1876..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/text/utf8_input.xml +++ /dev/null @@ -1 +0,0 @@ -€ \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/CompositeKeyHashMapTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/CompositeKeyHashMapTest.java deleted file mode 100644 index 9124fb295f3..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/CompositeKeyHashMapTest.java +++ /dev/null @@ -1,40 +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.jdk.core.test.type; - -import java.util.List; -import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; -import org.eclipse.osee.framework.jdk.core.type.Pair; -import org.junit.Assert; -import org.junit.Test; - -/** - * @author Ryan Schmitt - */ -public class CompositeKeyHashMapTest { - @Test - public void testEnumerateKeys() { - CompositeKeyHashMap testMap = new CompositeKeyHashMap(); - testMap.put("red", "blue", "value1"); - testMap.put("red", "green", "value2"); - testMap.put("red", "red", "value3"); - - testMap.put("green", "green", "value4"); - testMap.put("blue", "green", "value5"); - List> keyPairs = testMap.getEnumeratedKeys(); - Assert.assertEquals(5, keyPairs.size()); - Assert.assertTrue(keyPairs.contains(new Pair("red", "red"))); - Assert.assertTrue(keyPairs.contains(new Pair("red", "green"))); - Assert.assertTrue(keyPairs.contains(new Pair("red", "blue"))); - Assert.assertTrue(keyPairs.contains(new Pair("green", "green"))); - Assert.assertTrue(keyPairs.contains(new Pair("blue", "green"))); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/JdkCoreTypeTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/JdkCoreTypeTestSuite.java deleted file mode 100644 index 434cf411577..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/JdkCoreTypeTestSuite.java +++ /dev/null @@ -1,30 +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.jdk.core.test.type; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - CompositeKeyHashMapTest.class, - MatchLocationTest.class, - PairTest.class, - PropertyStoreTest.class, - PropertyStoreWriterTest.class, - QuadTest.class, - TripletTest.class}) -public class JdkCoreTypeTestSuite { - // Test Suite -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/MatchLocationTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/MatchLocationTest.java deleted file mode 100644 index 00b64fa4914..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/MatchLocationTest.java +++ /dev/null @@ -1,72 +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.jdk.core.test.type; - -import java.util.HashMap; -import org.eclipse.osee.framework.jdk.core.type.MatchLocation; -import org.junit.Assert; - -/** - * Test Case for {@link MatchLocation} - * - * @author Roberto E. Escobar - */ -public class MatchLocationTest { - - private static int a = 144; - private static int b = 233; - private static MatchLocation mapToPi = new MatchLocation(a, b); - private static MatchLocation mapToE = new MatchLocation(b, a); - private static MatchLocation alsoMapToPi = new MatchLocation(a, b); - private static MatchLocation alsoMapToE = new MatchLocation(b, a); - - @org.junit.Test - public void testConstructor() { - Assert.assertTrue(a == mapToPi.getStartPosition()); - Assert.assertTrue(b == mapToPi.getEndPosition()); - Assert.assertTrue(b != mapToPi.getStartPosition()); - Assert.assertTrue(a != mapToPi.getEndPosition()); - } - - @org.junit.Test - public void testEquals() { - Assert.assertTrue(mapToPi.equals(mapToPi)); - Assert.assertTrue(mapToPi.equals(alsoMapToPi)); - Assert.assertFalse(mapToPi.equals(mapToE)); - } - - @org.junit.Test - public void testSetters() { - MatchLocation newLocation = new MatchLocation(0, 0); - newLocation.setStartPosition(a); - newLocation.setEndPosition(b); - Assert.assertTrue(a == newLocation.getStartPosition()); - Assert.assertTrue(b == newLocation.getEndPosition()); - Assert.assertTrue(b != newLocation.getStartPosition()); - Assert.assertTrue(a != newLocation.getEndPosition()); - Assert.assertTrue(newLocation.set(a, b).equals(newLocation)); - } - - @org.junit.Test - public void testHashCorrectness() { - HashMap hash = new HashMap(); - hash.put(mapToPi, Math.PI); - hash.put(mapToE, Math.E); - Assert.assertTrue(hash.get(mapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(mapToE).equals(Math.E)); - Assert.assertTrue(hash.get(alsoMapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(alsoMapToE).equals(Math.E)); - Assert.assertFalse(hash.get(mapToPi).equals(Math.E)); - Assert.assertFalse(hash.get(mapToE).equals(Math.PI)); - Assert.assertFalse(mapToPi.equals(mapToE)); - Assert.assertTrue(mapToPi.equals(mapToPi)); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PairTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PairTest.java deleted file mode 100644 index 907ac0d8764..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PairTest.java +++ /dev/null @@ -1,85 +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.jdk.core.test.type; - -import java.util.HashMap; -import org.eclipse.osee.framework.jdk.core.type.Pair; -import org.junit.Assert; - -/** - * @author Ryan Schmitt - */ -public class PairTest { - private static Integer a = Integer.valueOf(144); - private static Integer b = Integer.valueOf(233); - private static Pair mapToPi = new Pair(a, b); - private static Pair mapToE = new Pair(b, a); - private static Pair alsoMapToPi = new Pair(a, b); - private static Pair alsoMapToE = new Pair(b, a); - private static Pair firstEntryNull = new Pair(null, 144); - private static Pair secondEntryNull = new Pair(144, null); - private static Pair nonNull = new Pair(15, 144); - - @org.junit.Test - public void testConstructor() { - Assert.assertTrue(a.equals(mapToPi.getFirst())); - Assert.assertTrue(b.equals(mapToPi.getSecond())); - Assert.assertFalse(b.equals(mapToPi.getFirst())); - Assert.assertFalse(a.equals(mapToPi.getSecond())); - } - - @org.junit.Test - public void testEquals() { - Assert.assertTrue(mapToPi.equals(mapToPi)); - Assert.assertTrue(mapToPi.equals(alsoMapToPi)); - Assert.assertFalse(mapToPi.equals(mapToE)); - } - - @org.junit.Test - public void testNulls() { - Assert.assertTrue(firstEntryNull.equals(firstEntryNull)); - Assert.assertFalse(firstEntryNull.equals(nonNull)); - - Assert.assertTrue(secondEntryNull.equals(secondEntryNull)); - Assert.assertFalse(secondEntryNull.equals(nonNull)); - - Assert.assertTrue(firstEntryNull.toString().equals("[null, 144]")); - Assert.assertTrue(secondEntryNull.toString().equals("[144, null]")); - Assert.assertTrue(nonNull.toString().equals("[15, 144]")); - } - - @org.junit.Test - public void testSetters() { - Pair newPair = new Pair(0, 0); - newPair.setFirst(a); - newPair.setSecond(b); - Assert.assertTrue(a.equals(newPair.getFirst())); - Assert.assertTrue(b.equals(newPair.getSecond())); - Assert.assertFalse(b.equals(newPair.getFirst())); - Assert.assertFalse(a.equals(newPair.getSecond())); - Assert.assertTrue(newPair.set(a, b).equals(newPair)); - } - - @org.junit.Test - public void testHashCorrectness() { - HashMap, Double> hash = new HashMap, Double>(); - hash.put(mapToPi, Math.PI); - hash.put(mapToE, Math.E); - Assert.assertTrue(hash.get(mapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(mapToE).equals(Math.E)); - Assert.assertTrue(hash.get(alsoMapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(alsoMapToE).equals(Math.E)); - Assert.assertFalse(hash.get(mapToPi).equals(Math.E)); - Assert.assertFalse(hash.get(mapToE).equals(Math.PI)); - Assert.assertFalse(mapToPi.equals(mapToE)); - Assert.assertTrue(mapToPi.equals(mapToPi)); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreTest.java deleted file mode 100644 index 670b646215c..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreTest.java +++ /dev/null @@ -1,254 +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.jdk.core.test.type; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.eclipse.osee.framework.jdk.core.test.mock.MockPropertyStore; -import org.eclipse.osee.framework.jdk.core.test.mock.PropertyStoreTestUtil; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; -import org.junit.Assert; - -/** - * Test Case For {@link PropertyStore} - * - * @author Roberto E. Escobar - */ -public class PropertyStoreTest { - - @org.junit.Test - public void testCreateWithProperties() { - Map properties = PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties()); - - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(properties); - PropertyStoreTestUtil.checkPropertiesEqual(properties, store1.getItems()); - Assert.assertTrue(!properties.equals(store1.getArrays())); - } - - @org.junit.Test - public void testCreateWithId() { - String id = "123456"; - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(id); - Assert.assertEquals(id, store1.getId()); - } - - @org.junit.Test - public void testEqualsAndHashCode() { - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore("ID"); - store1.put("key1", 12.3f); - store1.put("key2", 543L); - store1.put("key3", new String[] {"entry1", "entry2", "entry3"}); - - Assert.assertFalse(store1.equals("Test")); - - MockPropertyStore store2 = PropertyStoreTestUtil.createPropertyStore("ID"); - store2.put("key1", 12.3f); - store2.put("key2", 543L); - store2.put("key3", new String[] {"entry1", "entry2", "entry3"}); - - Assert.assertTrue(store1.equals(store2)); - - int hash = store1.hashCode(); - Assert.assertEquals(hash, store2.hashCode()); - // Check that it didn't change - Assert.assertEquals(hash, store2.hashCode()); - - store2.put("key2", 542L); - Assert.assertTrue(!store1.equals(store2)); - Assert.assertTrue(hash != store2.hashCode()); - - store2.put("key2", 543L); - Assert.assertTrue(store1.equals(store2)); - - store2.put("key3", new String[] {"entry1", "entry2"}); - Assert.assertTrue(!store1.equals(store2)); - - store2.put("key3", new String[] {"entry1", "entry2", "entry4"}); - Assert.assertTrue(!store1.equals(store2)); - } - - @org.junit.Test - public void testToString() { - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore("ID"); - store1.put("key1", 12.3f); - store1.put("key2", 543L); - store1.put("key3", new String[] {"entry1", "entry2", "entry3"}); - store1.put("key4", new String[] {"entry4", "entry5"}); - - String strStore1 = store1.toString(); - String expected = - "Id:[ID] Data:{key1=12.3, key2=543} Arrays:{key3=[entry1, entry2, entry3], key4=[entry4, entry5]}"; - - Assert.assertEquals(expected, strStore1); - } - - @org.junit.Test - public void testNumberException() { - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(); - - try { - store1.getDouble("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("No setting found for key: [key1]", ex.getLocalizedMessage()); - } - - try { - store1.getFloat("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("No setting found for key: [key1]", ex.getLocalizedMessage()); - } - try { - store1.getInt("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("No setting found for key: [key1]", ex.getLocalizedMessage()); - } - try { - store1.getLong("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("No setting found for key: [key1]", ex.getLocalizedMessage()); - } - store1.put("key1", "hello"); - try { - store1.getDouble("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("For input string: \"hello\"", ex.getLocalizedMessage()); - } - try { - store1.getFloat("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("For input string: \"hello\"", ex.getLocalizedMessage()); - } - try { - store1.getInt("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("For input string: \"hello\"", ex.getLocalizedMessage()); - } - try { - store1.getLong("key1"); - } catch (NumberFormatException ex) { - Assert.assertEquals("For input string: \"hello\"", ex.getLocalizedMessage()); - } - Assert.assertEquals("hello", store1.get("key1")); - } - - @org.junit.Test - public void testSetsAndGets() throws Exception { - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(); - store1.setId("myId"); - store1.put("key1", true); - store1.put("key2", "aKey"); - store1.put("key3", 0.1112); - store1.put("key4", 12); - store1.put("key5", 12.3f); - store1.put("key6", 543L); - store1.put("key6.5", ""); - store1.put("key7", new String[] {"entry1", "entry2", "entry3"}); - store1.put("key8", new String[] {"entry4", "entry5", "entry6"}); - MockPropertyStore nested = - PropertyStoreTestUtil.createPropertyStore(PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties())); - store1.put("key9", nested); - - Set set1 = new TreeSet(store1.keySet()); - PropertyStoreTestUtil.checkArrays(new String[] {"key1", "key2", "key3", "key4", "key5", "key6", "key6.5"}, - set1.toArray(new String[set1.size()])); - Set set2 = new TreeSet(store1.arrayKeySet()); - PropertyStoreTestUtil.checkArrays(new String[] {"key7", "key8"}, set2.toArray(new String[set2.size()])); - - Assert.assertEquals("myId", store1.getId()); - Assert.assertEquals(true, store1.getBoolean("key1")); - Assert.assertEquals("aKey", store1.get("key2")); - Assert.assertEquals(0.1112, store1.getDouble("key3"), 0); - Assert.assertEquals(12, store1.getInt("key4")); - Assert.assertEquals(12.3f, store1.getFloat("key5"), 0); - Assert.assertEquals(543L, store1.getLong("key6")); - Assert.assertEquals("", store1.get("key6.5")); - - PropertyStoreTestUtil.checkArrays(new String[] {"entry1", "entry2", "entry3"}, store1.getArray("key7")); - PropertyStoreTestUtil.checkArrays(new String[] {"entry4", "entry5", "entry6"}, store1.getArray("key8")); - - PropertyStoreTestUtil.checkEquals(nested, (MockPropertyStore) store1.getPropertyStore("key9")); - } - - @org.junit.Test - public void testNullSetsAndGets() { - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore("HelloId"); - Assert.assertEquals("HelloId", store1.getId()); - store1.setId(null); - - Assert.assertEquals("", store1.getId()); - - store1.put("key1", (String) null); - Assert.assertEquals("", store1.get("key1")); - - store1.put("key2", (String[]) null); - Assert.assertTrue(store1.getArray("key2").length == 0); - - store1.put("key3", (PropertyStore) null); - Assert.assertTrue(store1.getPropertyStores().isEmpty()); - Assert.assertNull(store1.getPropertyStore("key3")); - } - - @org.junit.Test - public void testSaveAndLoad() throws Exception { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(); - store1.put("key1", true); - store1.put("key2", "aKey"); - store1.put("key3", 0.1112); - store1.put("key4", 12); - store1.put("key5", 12.3f); - store1.put("key6", 543L); - store1.put("key7", new String[] {"entry1", "entry2", "entry3"}); - store1.put("key8", new String[] {"entry4", "entry5", "entry6"}); - store1.put( - "key9", - PropertyStoreTestUtil.createPropertyStore(PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties()))); - - store1.save(outputStream); - - MockPropertyStore store2 = PropertyStoreTestUtil.createPropertyStore(); - store2.load(new ByteArrayInputStream(outputStream.toByteArray())); - - PropertyStoreTestUtil.checkEquals(store1, store2); - } - - @org.junit.Test - public void testSaveAndLoadRW() throws Exception { - StringWriter writer = new StringWriter(); - - MockPropertyStore store1 = PropertyStoreTestUtil.createPropertyStore(); - store1.put("key1", true); - store1.put("key2", "aKey"); - store1.put("key3", 0.1112); - store1.put("key4", 12); - store1.put("key5", 12.3f); - store1.put("key6", 543L); - store1.put("key7", new String[] {"entry1", "entry2", "entry3"}); - store1.put("key8", new String[] {"entry4", "entry5", "entry6"}); - store1.put( - "key9", - PropertyStoreTestUtil.createPropertyStore(PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties()))); - - store1.save(writer); - - MockPropertyStore store2 = PropertyStoreTestUtil.createPropertyStore(); - store2.load(new InputStreamReader(new ByteArrayInputStream(writer.toString().getBytes("utf-8")), "utf-8")); - - PropertyStoreTestUtil.checkEquals(store1, store2); - } - -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreWriterTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreWriterTest.java deleted file mode 100644 index 8f27de2f81c..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/PropertyStoreWriterTest.java +++ /dev/null @@ -1,91 +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.jdk.core.test.type; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.StringReader; -import java.io.StringWriter; -import org.eclipse.osee.framework.jdk.core.test.mock.MockPropertyStore; -import org.eclipse.osee.framework.jdk.core.test.mock.PropertyStoreTestUtil; -import org.eclipse.osee.framework.jdk.core.type.PropertyStoreWriter; -import org.junit.Before; -import org.junit.Test; - -/** - * Test Case for {@link PropertyStoreWriter} - * - * @author Roberto E. Escobar - */ -public class PropertyStoreWriterTest { - private MockPropertyStore store; - private MockPropertyStore nested; - private PropertyStoreWriter writer; - - @Before - public void setup() { - writer = new PropertyStoreWriter(); - store = PropertyStoreTestUtil.createPropertyStore(); - store.setId("myId"); - store.put("key1", true); - store.put("key2", "aKey"); - store.put("key3", 0.1112); - store.put("key4", 12); - store.put("key5", 12.3f); - store.put("key6", 543L); - store.put("key6.5", ""); - store.put("key7", new String[] {"entry1", "entry2", "entry3"}); - store.put("key8", new String[] {"entry4", "entry5", "entry6"}); - nested = - PropertyStoreTestUtil.createPropertyStore(PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties())); - nested.put("inner array 1", new String[] {"value1", "value2"}); - nested.put( - "inner store 1", - PropertyStoreTestUtil.createPropertyStore(PropertyStoreTestUtil.convertPropertiesToMap(System.getProperties()))); - store.put("key9", nested); - } - - @Test - public void testReadWriteStream() throws Exception { - MockPropertyStore actual = PropertyStoreTestUtil.createPropertyStore(); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - writer.save(store, outputStream); - writer.load(actual, new ByteArrayInputStream(outputStream.toByteArray())); - - PropertyStoreTestUtil.checkEquals(store, actual); - } - - @Test - public void testReadWrite() throws Exception { - MockPropertyStore actual = PropertyStoreTestUtil.createPropertyStore(); - StringWriter stringWriter = new StringWriter(); - writer.save(store, stringWriter); - writer.load(actual, new StringReader(stringWriter.toString())); - PropertyStoreTestUtil.checkEquals(store, actual); - } - - @Test - public void testLoadingXml() throws Exception { - String value = - " "; - MockPropertyStore actual = PropertyStoreTestUtil.createPropertyStore(); - writer.load(actual, new StringReader(value)); - MockPropertyStore expected = PropertyStoreTestUtil.createPropertyStore("coverage.item"); - expected.put("line", "68"); - expected.put("testUnits", ""); - expected.put("executeNum", "4"); - expected.put("guid", "APc07YhpXgobKwrbROgA"); - expected.put("methodType", "Not_Covered"); - expected.put("methodNum", "4"); - expected.put("text", "OseeLog.log(Activator.class, Level.SEVERE, ex);"); - PropertyStoreTestUtil.checkEquals(expected, actual); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/QuadTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/QuadTest.java deleted file mode 100644 index 37205aa8dc9..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/QuadTest.java +++ /dev/null @@ -1,146 +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.jdk.core.test.type; - -import java.util.HashMap; -import org.eclipse.osee.framework.jdk.core.type.Quad; -import org.junit.Assert; - -/** - * @author Roberto E. Escobar - */ -public class QuadTest { - private final Integer a = 144; - private final Integer b = 233; - private final Integer c = 433; - private final Integer d = 555; - private final Quad mapToPi = new Quad(a, b, - c, d); - private final Quad mapToE = new Quad(b, c, - d, a); - - private final Quad alsoMapToPi = new Quad(a, - b, c, d); - private final Quad alsoMapToE = new Quad(b, - c, d, a); - - private final Quad firstEntryNull = - new Quad(null, 222, 333, 444); - private final Quad secondEntryNull = - new Quad(111, null, 333, 444); - private final Quad thirdEntryNull = - new Quad(111, 222, null, 444); - private final Quad fourthEntryNull = - new Quad(111, 222, 333, null); - private final Quad nonNull = new Quad(111, - 222, 333, 444); - - @org.junit.Test - public void testConstructor() { - Assert.assertTrue(a.equals(mapToPi.getFirst())); - Assert.assertTrue(b.equals(mapToPi.getSecond())); - Assert.assertTrue(c.equals(mapToPi.getThird())); - Assert.assertTrue(d.equals(mapToPi.getFourth())); - - Assert.assertFalse(a.equals(mapToPi.getSecond())); - Assert.assertFalse(a.equals(mapToPi.getThird())); - Assert.assertFalse(a.equals(mapToPi.getFourth())); - - Assert.assertFalse(b.equals(mapToPi.getFirst())); - Assert.assertFalse(b.equals(mapToPi.getThird())); - Assert.assertFalse(b.equals(mapToPi.getFourth())); - - Assert.assertFalse(c.equals(mapToPi.getFirst())); - Assert.assertFalse(c.equals(mapToPi.getSecond())); - Assert.assertFalse(c.equals(mapToPi.getFourth())); - - Assert.assertFalse(d.equals(mapToPi.getFirst())); - Assert.assertFalse(d.equals(mapToPi.getSecond())); - Assert.assertFalse(d.equals(mapToPi.getThird())); - } - - @org.junit.Test - public void testEquals() { - Assert.assertTrue(mapToPi.equals(mapToPi)); - Assert.assertTrue(mapToPi.equals(alsoMapToPi)); - Assert.assertFalse(mapToPi.equals(mapToE)); - } - - @org.junit.Test - public void testNulls() { - Assert.assertTrue(firstEntryNull.equals(firstEntryNull)); - Assert.assertFalse(firstEntryNull.equals(nonNull)); - - Assert.assertTrue(secondEntryNull.equals(secondEntryNull)); - Assert.assertFalse(secondEntryNull.equals(nonNull)); - - Assert.assertTrue(thirdEntryNull.equals(thirdEntryNull)); - Assert.assertFalse(thirdEntryNull.equals(nonNull)); - - Assert.assertTrue(fourthEntryNull.equals(fourthEntryNull)); - Assert.assertFalse(fourthEntryNull.equals(nonNull)); - - Assert.assertTrue(firstEntryNull.toString().equals("[null, 222, 333, 444]")); - Assert.assertTrue(secondEntryNull.toString().equals("[111, null, 333, 444]")); - Assert.assertTrue(thirdEntryNull.toString().equals("[111, 222, null, 444]")); - Assert.assertTrue(fourthEntryNull.toString().equals("[111, 222, 333, null]")); - Assert.assertTrue(nonNull.toString().equals("[111, 222, 333, 444]")); - } - - @org.junit.Test - public void testSetters() { - Quad newPair = new Quad(0, 0, 0, 0); - newPair.setFirst(a); - newPair.setSecond(b); - newPair.setThird(c); - newPair.setFourth(d); - - Assert.assertTrue(a.equals(newPair.getFirst())); - Assert.assertTrue(b.equals(newPair.getSecond())); - Assert.assertTrue(c.equals(newPair.getThird())); - Assert.assertTrue(d.equals(newPair.getFourth())); - - Assert.assertFalse(a.equals(newPair.getSecond())); - Assert.assertFalse(a.equals(newPair.getThird())); - Assert.assertFalse(a.equals(newPair.getFourth())); - - Assert.assertFalse(b.equals(newPair.getFirst())); - Assert.assertFalse(b.equals(newPair.getThird())); - Assert.assertFalse(b.equals(newPair.getFourth())); - - Assert.assertFalse(c.equals(newPair.getFirst())); - Assert.assertFalse(c.equals(newPair.getSecond())); - Assert.assertFalse(c.equals(newPair.getFourth())); - - Assert.assertFalse(d.equals(newPair.getFirst())); - Assert.assertFalse(d.equals(newPair.getSecond())); - Assert.assertFalse(d.equals(newPair.getThird())); - - Quad anotherPair = new Quad(0, 0, 0, 0); - Assert.assertTrue(anotherPair.set(a, b, c, d).equals(anotherPair)); - } - - @org.junit.Test - public void testHashCorrectness() { - HashMap, Double> hash = - new HashMap, Double>(); - hash.put(mapToPi, Math.PI); - hash.put(mapToE, Math.E); - Assert.assertTrue(hash.get(mapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(mapToE).equals(Math.E)); - Assert.assertTrue(hash.get(alsoMapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(alsoMapToE).equals(Math.E)); - Assert.assertFalse(hash.get(mapToPi).equals(Math.E)); - Assert.assertFalse(hash.get(mapToE).equals(Math.PI)); - Assert.assertFalse(mapToPi.equals(mapToE)); - Assert.assertTrue(mapToPi.equals(mapToPi)); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/TripletTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/TripletTest.java deleted file mode 100644 index b7348d0ac9b..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/type/TripletTest.java +++ /dev/null @@ -1,111 +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.jdk.core.test.type; - -import java.util.HashMap; -import org.eclipse.osee.framework.jdk.core.type.Triplet; -import org.junit.Assert; - -/** - * @author Roberto E. Escobar - */ -public class TripletTest { - private final Integer a = 144; - private final Integer b = 233; - private final Integer c = 533; - private final Triplet mapToPi = new Triplet(a, b, c); - private final Triplet mapToE = new Triplet(b, c, a); - - private final Triplet alsoMapToPi = new Triplet(a, b, c); - private final Triplet alsoMapToE = new Triplet(b, c, a); - - private final Triplet firstEntryNull = new Triplet(null, 222, - 333); - private final Triplet secondEntryNull = new Triplet(111, null, - 333); - private final Triplet thirdEntryNull = new Triplet(111, 222, - null); - private final Triplet nonNull = new Triplet(111, 222, 333); - - @org.junit.Test - public void testConstructor() { - Assert.assertTrue(a.equals(mapToPi.getFirst())); - Assert.assertTrue(b.equals(mapToPi.getSecond())); - Assert.assertTrue(c.equals(mapToPi.getThird())); - - Assert.assertFalse(b.equals(mapToPi.getFirst())); - Assert.assertFalse(a.equals(mapToPi.getSecond())); - } - - @org.junit.Test - public void testEquals() { - Assert.assertTrue(mapToPi.equals(mapToPi)); - Assert.assertTrue(mapToPi.equals(alsoMapToPi)); - Assert.assertFalse(mapToPi.equals(mapToE)); - } - - @org.junit.Test - public void testNulls() { - Assert.assertTrue(firstEntryNull.equals(firstEntryNull)); - Assert.assertFalse(firstEntryNull.equals(nonNull)); - - Assert.assertTrue(secondEntryNull.equals(secondEntryNull)); - Assert.assertFalse(secondEntryNull.equals(nonNull)); - - Assert.assertTrue(thirdEntryNull.equals(thirdEntryNull)); - Assert.assertFalse(thirdEntryNull.equals(nonNull)); - - Assert.assertTrue(firstEntryNull.toString().equals("[null, 222, 333]")); - Assert.assertTrue(secondEntryNull.toString().equals("[111, null, 333]")); - Assert.assertTrue(thirdEntryNull.toString().equals("[111, 222, null]")); - Assert.assertTrue(nonNull.toString().equals("[111, 222, 333]")); - } - - @org.junit.Test - public void testSetters() { - Triplet newPair = new Triplet(0, 0, 0); - newPair.setFirst(a); - newPair.setSecond(b); - newPair.setThird(c); - - Assert.assertTrue(a.equals(newPair.getFirst())); - Assert.assertTrue(b.equals(newPair.getSecond())); - Assert.assertTrue(c.equals(newPair.getThird())); - - Assert.assertFalse(a.equals(newPair.getSecond())); - Assert.assertFalse(a.equals(newPair.getThird())); - - Assert.assertFalse(b.equals(newPair.getFirst())); - Assert.assertFalse(b.equals(newPair.getThird())); - - Assert.assertFalse(c.equals(newPair.getFirst())); - Assert.assertFalse(c.equals(newPair.getSecond())); - - Triplet anotherPair = new Triplet(0, 0, 0); - Assert.assertTrue(anotherPair.set(a, b, c).equals(anotherPair)); - } - - @org.junit.Test - public void testHashCorrectness() { - HashMap, Double> hash = - new HashMap, Double>(); - hash.put(mapToPi, Math.PI); - hash.put(mapToE, Math.E); - Assert.assertTrue(hash.get(mapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(mapToE).equals(Math.E)); - Assert.assertTrue(hash.get(alsoMapToPi).equals(Math.PI)); - Assert.assertTrue(hash.get(alsoMapToE).equals(Math.E)); - Assert.assertFalse(hash.get(mapToPi).equals(Math.E)); - Assert.assertFalse(hash.get(mapToE).equals(Math.PI)); - Assert.assertFalse(mapToPi.equals(mapToE)); - Assert.assertTrue(mapToPi.equals(mapToPi)); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CollectionsTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CollectionsTest.java deleted file mode 100644 index 3b10a8dca18..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CollectionsTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import org.junit.Assert; -import org.eclipse.osee.framework.jdk.core.util.Collections; -import org.junit.Test; - -/** - * @author Donald G. Dunne - */ -public class CollectionsTest { - - @Test - public void moveItem() { - - List items = null; - - // Move item forward - insert before - items = getTestList(); - boolean result = Collections.moveItem(items, "B", "D", false); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("A", "C", "B", "D", "E"), items); - - // Move item backward - insert before - items = getTestList(); - result = Collections.moveItem(items, "D", "B", false); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("A", "D", "B", "C", "E"), items); - - // Move item forward - insert after - items = getTestList(); - result = Collections.moveItem(items, "B", "D", true); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("A", "C", "D", "B", "E"), items); - - // Move item backward - insert after - items = getTestList(); - result = Collections.moveItem(items, "D", "B", true); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("A", "B", "D", "C", "E"), items); - - // Move item forward to end - items = getTestList(); - result = Collections.moveItem(items, "C", "E", false); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("A", "B", "D", "C", "E"), items); - - // Move item forward to end - items = getTestList(); - result = Collections.moveItem(items, "A", "E", true); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("B", "C", "D", "E", "A"), items); - - // Move item backward to beginning - items = getTestList(); - result = Collections.moveItem(items, "E", "A", false); - Assert.assertTrue(result); - Assert.assertEquals(Arrays.asList("E", "A", "B", "C", "D"), items); - - // Try moving something that doesn't exist - items = getTestList(); - result = Collections.moveItem(items, "F", "C", false); - // should fail - Assert.assertFalse(result); - // no change - Assert.assertEquals(Arrays.asList("A", "B", "C", "D", "E"), items); - - // Try moving to somewhere that doesn't exist - items = getTestList(); - result = Collections.moveItem(items, "C", "F", false); - // should fail - Assert.assertFalse(result); - // no change - Assert.assertEquals(Arrays.asList("A", "B", "C", "D", "E"), items); - - } - - @Test - public void test_setComplement() throws Exception { - Collection A = Arrays.asList(1, 2, 3, 8); - Collection B = Arrays.asList(1, 3, 5, 15, 20); - - Collection complementSet = Collections.setComplement(A, B); - Assert.assertTrue(complementSet.size() == 2); - Assert.assertTrue(complementSet.contains(2)); - Assert.assertTrue(complementSet.contains(8)); - - complementSet = Collections.setComplement(B, A); - Assert.assertTrue(complementSet.size() == 3); - Assert.assertTrue(complementSet.contains(5)); - Assert.assertTrue(complementSet.contains(15)); - Assert.assertTrue(complementSet.contains(20)); - } - - private List getTestList() { - List newList = new ArrayList(); - newList.addAll(Arrays.asList("A", "B", "C", "D", "E")); - return newList; - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CompareTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CompareTest.java deleted file mode 100644 index a578eaf8b9f..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/CompareTest.java +++ /dev/null @@ -1,93 +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.jdk.core.test.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import org.eclipse.osee.framework.jdk.core.util.Compare; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -/** - * Test Case for {@link Compare} - * - * @author Roberto E. Escobar - */ -@RunWith(Parameterized.class) -public class CompareTest { - - protected final Object object1; - protected final Object object2; - protected final boolean expected; - - public CompareTest(Object object1, Object object2, boolean expected) { - this.object1 = object1; - this.object2 = object2; - this.expected = expected; - } - - @Test - public void testObjects() { - boolean actual = Compare.isDifferent(object1, object2); - Assert.assertEquals(expected, actual); - } - - @Parameters - public static Collection data() { - Collection data = new ArrayList(); - data.add(new Object[] {"abc", "abc", false}); - data.add(new Object[] {"abc", "abc1", true}); - data.add(new Object[] {null, "abc", true}); - data.add(new Object[] {"abc", null, true}); - data.add(new Object[] {null, null, false}); - - data.add(new Object[] {1, null, true}); - data.add(new Object[] {null, 2, true}); - data.add(new Object[] {1, 1, false}); - - data.add(new Object[] {"1", 1, true}); - - data.add(new Object[] {Arrays.asList("one", "two", "three"), Arrays.asList("one", "two", "three"), false}); - data.add(new Object[] {Arrays.asList("two", "one", "three"), Arrays.asList("three", "one", "two"), false}); - data.add(new Object[] {Arrays.asList("one", "three"), Arrays.asList("one", "two", "three"), true}); - - data.add(new Object[] {new String[] {"one", "two", "three"}, new String[] {"one", "two", "three"}, false}); - data.add(new Object[] {new String[] {"two", "one", "three"}, new String[] {"three", "one", "two"}, false}); - data.add(new Object[] {new String[] {"one", "three"}, new String[] {"one", "two", "three"}, true}); - data.add(new Object[] {new String[] {"one", "two", "two", "three"}, new String[] {"one", "two", "three"}, true}); - - data.add(new Object[] {map("a", "b", "c", "d"), map("a", "b", "c", "d"), false}); - data.add(new Object[] {map("a", "b", "c", "d"), map("a", "c", "b", "d"), false}); - data.add(new Object[] {map("a", "b", "c", "d"), map("a", "c", "b", "b", "d"), true}); - return data; - } - - private static Map> map(Object key, Object... values) { - Map> map = new HashMap>(); - Collection objects = map.get(key); - if (objects == null) { - objects = new ArrayList(); - map.put(key, objects); - } else { - objects.clear(); - } - if (values != null && values.length > 0) { - objects.addAll(Arrays.asList(values)); - } - return map; - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/GUIDTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/GUIDTest.java deleted file mode 100644 index ee821d3e073..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/GUIDTest.java +++ /dev/null @@ -1,84 +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 - *******************************************************************************/ -/******************************************************************************* - * 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.jdk.core.test.util; - -import org.eclipse.osee.framework.jdk.core.util.GUID; -import org.junit.Assert; - -/** - * @author Roberto E. Escobar - */ -public class GUIDTest { - - @org.junit.Test - public void testInvalidGuids() { - final String[] invalidHrids = - { - "short", - "AAABDBYPet4AGJyrc_LONG_", - "AAABGumk_InvalidChar!", - "AAABGumk_InvalidChar#", - "AAABGumk_InvalidChar@", - "AAABGumk_InvalidChar^"}; - for (String invalid : invalidHrids) { - Assert.assertFalse("Invalid HRID " + invalid + " passes validity test", GUID.isValid(invalid)); - } - } - - @org.junit.Test - public void testValidGeneration() { - for (int i = 0; i < 50000; i++) { - String guid = GUID.create(); - Assert.assertTrue("Generated GUID " + guid + " fails validity test", GUID.isValid(guid)); - } - } - - @org.junit.Test - public void testValidGuids() { - final String[] validGuids = - { - "AAABDBYPet4AGJyrc9dY1w", - "AAABGumk_y8AFBnQMxZ58g", - "AAABGyedHw8AphA8L4XexQ", - "AAABDBYtCDsAVk2xBsTGzQ", - "AAABF_Ss2Q0AR8+yEx51WQ", - "AAABHUWIY34B7y_TEmEslg", - "AAABHZzkLCgBebkFSon4wA", - "AAABGuAX6cAB0Si2OIQ+YQ", - "AAABGassf08BOe_BF6k6vA", - "AAABHGv_u1gBGrilXclyUA", - "AAABDBYsngcAVk2xSlMcyw", - "AAABGm+v1uEA389GY8zirw", - "AAABDBYrxw4AVk2xHBRmhQ", - "AAABHbBGWuQA_ArKWeHLrg", - "AAABDBYs7Z8AVk2xTZPPSg", - "AAABGixOs5kA2KG7aom9Pw", - "AAABFjQ_MYIBEQV7BF3j7Q", - "AAABDBYs9AcAVk2xTOjhPQ", - "AAABDBYr7KcAVk2xDNCqew", - "AAABHHEPXpYBzfAhPukxiQ", - "AAABDBYsYBMAVk2xN5jSVA", - "AAABDBYsS3IAVk2xSRpaS="}; - for (String guid : validGuids) { - Assert.assertTrue(GUID.isValid(guid)); - } - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HashCollectionTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HashCollectionTest.java deleted file mode 100644 index 9827f9ef484..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HashCollectionTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import org.junit.Assert; -import org.eclipse.osee.framework.jdk.core.type.HashCollection; -import org.junit.Test; - -/** - * @author Donald G. Dunne - */ -public class HashCollectionTest { - - /** - * Test method for - * {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#put(java.lang.Object, java.lang.Object)}. - */ - @Test - public void testPutKV() { - HashCollection collection = new HashCollection(); - - Assert.assertEquals(0, collection.size()); - Assert.assertEquals(0, collection.getValues().size()); - Assert.assertNull(collection.getValues("this")); - - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - - Assert.assertEquals(5, collection.size()); - Assert.assertEquals(5, collection.getValues().size()); - Assert.assertNull(collection.getValues("this")); - Assert.assertEquals(5, collection.getValues("key").size()); - } - - /** - * Test method for - * {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#put(java.lang.Object, java.util.Collection)} . - */ - @Test - public void testPutKCollectionOfV() { - HashCollection collection = new HashCollection(); - List values = new ArrayList(); - - for (int x = 1; x <= 5; x++) { - values.add("value " + x); - } - collection.put("key", values); - - Assert.assertEquals(5, collection.size()); - Assert.assertEquals(5, collection.getValues().size()); - Assert.assertNull(collection.getValues("this")); - Assert.assertEquals(5, collection.getValues("key").size()); - } - - /** - * Test method for - * {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#removeValue(java.lang.Object, java.lang.Object)} . - */ - @Test - public void testRemoveValue() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - - Assert.assertEquals(5, collection.getValues("key").size()); - collection.removeValue("key", "value 3"); - Assert.assertEquals(4, collection.getValues("key").size()); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#removeValues(java.lang.Object)} . - */ - @Test - public void testRemoveValues() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - Assert.assertEquals(5, collection.getValues("key").size()); - Collection removedValues = collection.removeValues("key"); - Assert.assertNull(collection.getValues("key")); - Assert.assertEquals(5, removedValues.size()); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#keySet()}. - */ - @Test - public void testKeySet() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - for (int x = 1; x <= 3; x++) { - collection.put("key2", "value " + x); - } - Assert.assertEquals(2, collection.keySet().size()); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#clear()}. - */ - @Test - public void testClear() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - Assert.assertEquals(5, collection.getValues().size()); - collection.clear(); - Assert.assertEquals(0, collection.getValues().size()); - Assert.assertEquals(0, collection.keySet().size()); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#containsKey(java.lang.Object)}. - */ - @Test - public void testContainsKey() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - Assert.assertTrue(collection.containsKey("key")); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#isEmpty()}. - */ - @Test - public void testIsEmpty() { - HashCollection collection = new HashCollection(); - Assert.assertTrue(collection.isEmpty()); - collection.put("key", "value 1"); - Assert.assertFalse(collection.isEmpty()); - collection.clear(); - Assert.assertTrue(collection.isEmpty()); - } - - /** - * Test method for {@link org.eclipse.osee.framework.jdk.core.type.HashCollection#containsValue(java.lang.Object)}. - */ - @Test - public void testContainsValue() { - HashCollection collection = new HashCollection(); - for (int x = 1; x <= 5; x++) { - collection.put("key", "value " + x); - } - Assert.assertTrue(collection.containsValue("value 3")); - - } - - @Test - public void testHashCollectionObject() { - HashCollection collection = new HashCollection(); - - Assert.assertEquals(0, collection.size()); - Assert.assertEquals(0, collection.getValues().size()); - Assert.assertNull(collection.getValues(new Object())); - - Object keyObject = new Object(); - for (int x = 1; x <= 5; x++) { - collection.put(keyObject, "value " + x); - } - - Assert.assertEquals(5, collection.size()); - Assert.assertEquals(5, collection.getValues().size()); - Assert.assertNull(collection.getValues(new Object())); - Assert.assertEquals(5, collection.getValues(keyObject).size()); - } - -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HumanReadableIdTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HumanReadableIdTest.java deleted file mode 100644 index 229377c80fb..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/HumanReadableIdTest.java +++ /dev/null @@ -1,319 +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.jdk.core.test.util; - -import org.eclipse.osee.framework.jdk.core.util.HumanReadableId; -import org.junit.Assert; - -/** - * @author Ryan Schmitt - */ -public class HumanReadableIdTest { - - @org.junit.Test - public void testInvalidHrids() { - final String[] invalidHrids = {"", // short - "QRZH", // short - "QRZHMT", // long - "QRZHm", // small caps - "QRZH_", // invalid char - "CACCX", - "CCCAX", - "CCACX", // A in middle - "CECCX", - "CCECX", - "CCCEX", // E in middle - "CCCIX", - "CICCX", - "CCICX", // I in middle - "TOCCX", - "CCOCC", - "CCCOC", // O in middle - "CTUTX", - "CUTTX", - "CTTUX", // U in middle - "IZZZZ", // starts with I - "OZZZZ", // starts with O - "ZZZZI", // ends with I - "ZZZZO" // ends with O - }; - - for (String invalid : invalidHrids) { - Assert.assertFalse("Invalid HRID " + invalid + " passes validity test", HumanReadableId.isValid(invalid)); - } - } - - @org.junit.Test - public void testValidGeneration() { - for (int i = 0; i < 500000; i++) { - String hrid = HumanReadableId.generate(); - Assert.assertTrue("Generated HRID " + hrid + " fails validity test", HumanReadableId.isValid(hrid)); - } - } - - @org.junit.Test - public void testValidHrids() { - final String[] validHrids = - { - "F8Z5J", - "6V3PH", - "UCMXG", - "GDWVT", - "GJ0Y0", - "WV1FV", - "E1HT8", - "JP6VK", - "S36PK", - "B7WBP", - "H2ML7", - "9ZD0A", - "1J037", - "X30J9", - "02T23", - "MMV3A", - "YRNT0", - "ZKBY2", - "LYC1M", - "RW3N9", - "JTRCU", - "MCVGX", - "KTJ5P", - "FBNC4", - "57M55", - "WY1VG", - "UX49X", - "E7YF2", - "7BWL4", - "QQ138", - "8Y2GH", - "4VYMJ", - "5VQTG", - "VXT3S", - "4WRRX", - "41PNL", - "VK7FC", - "YXHRR", - "NFJFJ", - "1KDMX", - "DK8HZ", - "Q946P", - "6MM16", - "YCTCL", - "6J3JG", - "ZF29S", - "W6RVV", - "NQRZ9", - "CKD87", - "9WCHJ", - "SBM27", - "09XY9", - "2P1S4", - "3N0M2", - "WR173", - "HY1JD", - "UH473", - "BSQGA", - "RH3PS", - "DBD0P", - "P68WZ", - "KGQ25", - "YB4WT", - "7G8ZC", - "44NK5", - "3LZ3H", - "BDHQJ", - "NTZNS", - "18WZR", - "ZFVV2", - "UHXMN", - "XMBKG", - "9VDXB", - "82LVV", - "0SVHQ", - "MGF89", - "JDGYQ", - "YKN2W", - "9TXV0", - "NP04F", - "3CLWW", - "5KP30", - "2TS48", - "NM9RH", - "DC664", - "Q95LE", - "A8WP8", - "PF7TA", - "6TLL3", - "G7075", - "A4SM5", - "Q6H4V", - "PDH1R", - "BDZ89", - "5PVSS", - "MGDYZ", - "MTH2P", - "DB7X5", - "K90YY", - "7NL4Z", - "M4XZR", - "2YL1L", - "M12SJ", - "7SRVE", - "4FZ5A", - "L9G8J", - "AZ556", - "23VCK", - "SRXVM", - "YGBLG", - "31WJ4", - "0PW2Y", - "NTZQA", - "X8N3R", - "LM74P", - "5SMQ9", - "H5SQY", - "M6H8U", - "9F0XB", - "Y3NP7", - "L98FJ", - "S9MHW", - "D3WG3", - "KXPFY", - "H0CYR", - "VJYXP", - "XTV4R", - "BBLQY", - "EG57N", - "SD2YL", - "W8HHM", - "H76XQ", - "WRMYV", - "WKR27", - "Y9VJ9", - "PZMDJ", - "GJ9JS", - "QXR3W", - "J0MY4", - "EPLW6", - "4QLXX", - "SF781", - "NM80A", - "ZM37Z", - "K8X27", - "XGWWC", - "RCP1B", - "56GN6", - "B74LE", - "JY3LE", - "5XSJK", - "8NH89", - "F2340", - "PKCWT", - "1N2VU", - "XH7KP", - "BV9FC", - "8SKWB", - "Y9VGS", - "BDW01", - "YT4FZ", - "H7RKJ", - "D7F9P", - "4NVPW", - "BV4BL", - "E60S6", - "VDVRK", - "RMW41", - "713CG", - "9XXXV", - "Z75DZ", - "EDP9D", - "72WRU", - "TZWPG", - "X5MZE", - "TRKHW", - "40HPE", - "VDZ8C", - "VYN04", - "U2060", - "C4CPB", - "35W70", - "XCGMJ", - "KS51K", - "EXY3R", - "D1YRL", - "LQP89", - "L8KTH", - "X11WU", - "GDL4S", - "RZP8G", - "C9WXJ", - "J5RSF", - "6H4S4", - "S1442", - "3VV89", - "MPKSG", - "LLHKX", - "CMQGV", - "L0J5Q", - "JJ72D", - "QLVJW", - "CM5WB", - "TGQ2B", - "BZJMV", - "X1R89", - "PMQ8K", - "7CFJV", - "NY4MM", - "9HT3R", - "Q1Q92", - "9L098", - "YJ5FU", - "0L53S", - "403K2", - "FS009", - "DMD3U", - "KZ7Y6", - "CGYPF", - "YB0NF", - "LCSQ4", - "K3V89", - "WK0GP", - "ZDY3K", - "L3KR4", - "26GDN", - "NK0LA", - "2WVG3", - "4H08D", - "CY08E", - "S9D2S", - "T38JK", - "UB7L7", - "Q264P", - "BQGZU", - "R0V8A" - - }; - for (String hrid : validHrids) { - Assert.assertTrue(HumanReadableId.isValid(hrid)); - } - } -} - -/* - * Mutating org.eclipse.osee.framework.jdk.core.util.HumanReadableId Tests: - * org.eclipse.osee.framework.jdk.core.util.HumanReadableIdTest Mutation points = 160, unit test time limit 12.0s M - * FAIL: org.eclipse.osee.framework.jdk.core.util.HumanReadableId:40: CP[12] 34438396 -> 34438397 ..M FAIL: - * org.eclipse.osee.framework.jdk.core.util.HumanReadableId:27: 2 -> 3 .M FAIL: - * org.eclipse.osee.framework.jdk.core.util.HumanReadableId:28: 34 (") -> 35 (#) - * .................................................. ...................M FAIL: - * org.eclipse.osee.framework.jdk.core.util.HumanReadableId:30: 31 -> 32 ( ) - * .................................................. .................................. Score: 97% - */ \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/JdkCoreUtilTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/JdkCoreUtilTestSuite.java deleted file mode 100644 index 95a84923128..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/JdkCoreUtilTestSuite.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jdk.core.test.util; - -import org.eclipse.osee.framework.jdk.core.test.util.io.IoTestSuite; -import org.eclipse.osee.framework.jdk.core.test.util.xml.XmlTestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - IoTestSuite.class, - XmlTestSuite.class, - CollectionsTest.class, - CompareTest.class, - GUIDTest.class, - HashCollectionTest.class, - HumanReadableIdTest.class, - ReservedCharactersTest.class, - StringsTest.class,}) -public class JdkCoreUtilTestSuite { - // Test Suite Class -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ProcessesTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ProcessesTest.java deleted file mode 100644 index 1b9f26c92c8..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ProcessesTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jdk.core.test.util; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import org.eclipse.osee.framework.jdk.core.util.Processes; -import org.eclipse.osee.framework.jdk.core.util.io.OutputRedirector; -import org.junit.Assert; -import org.junit.Test; - -/** - * @author Ryan D. Brooks - */ -public class ProcessesTest { - - public static final ExecutorService executor = Executors.newCachedThreadPool(); - private static final String argument = "progress"; - - @Test - public void testProcessCancel() throws IOException, InterruptedException, ExecutionException { - ProcessBuilder builder = - new ProcessBuilder("java", "-cp", ".\\bin", "org.eclipse.osee.framework.jdk.core.test.util.ProcessesTest", - argument, "bye"); - builder.redirectErrorStream(true); - Process process = builder.start(); - - StringWriter stringWriter = new StringWriter(); - BufferedReader stdOutputIn = new BufferedReader(new InputStreamReader(process.getInputStream())); - Future outFuture = Processes.executor.submit(new OutputRedirector(stringWriter, stdOutputIn)); - Thread.sleep(500); - process.destroy(); - Assert.assertEquals(argument, stringWriter.toString()); - Assert.assertEquals(new Long(argument.length()), outFuture.get()); - } - - @Test - public void testExecuteCommandToString() { - commandToStringHelper("java version ", "java", "-version"); - commandToStringHelper("java.io.IOException: Cannot run program", "bogus command"); - commandToStringHelper("Could not create the Java virtual machine", "java", "-alsdfk"); - } - - private void commandToStringHelper(String startsWith, String... callAndArgs) { - String actual = Processes.executeCommandToString(callAndArgs); - int pos = Math.min(actual.length(), startsWith.length()); - Assert.assertEquals(startsWith, actual.substring(0, pos)); - } - - /** - * this method is invoked from testProcessCancel in a separate process - * - * @param args - * @throws IOException - * @throws InterruptedException - */ - public static final void main(String[] args) throws IOException, InterruptedException { - System.out.print(args[0]); - Thread.sleep(3000); - System.in.read(); - System.out.println(args[1]); - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ReservedCharactersTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ReservedCharactersTest.java deleted file mode 100644 index 8255af48240..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/ReservedCharactersTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jdk.core.test.util; - -import java.util.Collection; -import org.eclipse.osee.framework.jdk.core.util.ReservedCharacters; -import org.junit.Assert; -import org.junit.Test; - -/** - * $link:{ReservedCharacters} Tests for static class ReservedCharacters. - * - * @author Karol M. Wilk - */ -public class ReservedCharactersTest { - - private static final int RESERVED_CHAR_COUNT = 105; - private static final int XML_ENTITIES_COUNT = 5; - - private static final String ampCase = "Apples & Oranges"; - private static final String ampAnswer = "Apples & Oranges"; - - private static final String lessThanGreaterThanCase = "Apples > Oranges, sometimes nice Apples < Oranges."; - private static final String lessThanGreaterThanAnswer = "Apples > Oranges, sometimes nice Apples < Oranges."; - - private static final String apostropheCase = "French orange is 'orange'"; - private static final String apostropheAnswer = "French orange is 'orange'"; - - private static final String quoteCase = "Some fruit are not really \"fruit\" per say"; - private static final String quoteAnswer = "Some fruit are not really "fruit" per say"; - - @Test - public final void testTextCharsToXmlChars() { - Assert.assertEquals(ampAnswer, ReservedCharacters.encodeXmlEntities(ampCase)); - Assert.assertEquals(lessThanGreaterThanAnswer, ReservedCharacters.encodeXmlEntities(lessThanGreaterThanCase)); - Assert.assertEquals(apostropheAnswer, ReservedCharacters.encodeXmlEntities(apostropheCase)); - Assert.assertEquals(quoteAnswer, ReservedCharacters.encodeXmlEntities(quoteCase)); - } - - @Test - public void testToCharater() { - String data = "´"; - char expected = 180; - char actual = ReservedCharacters.toCharacter(data); - Assert.assertEquals(expected, actual); - } - - @Test - public void testGetChars() { - int expectedTotal = RESERVED_CHAR_COUNT + XML_ENTITIES_COUNT; - Collection characters = ReservedCharacters.getChars(); - Assert.assertEquals(expectedTotal, characters.size()); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/StringsTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/StringsTest.java deleted file mode 100644 index ac4741d19c7..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/StringsTest.java +++ /dev/null @@ -1,70 +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 - *******************************************************************************/ -/******************************************************************************* - * 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.jdk.core.test.util; - -import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.junit.Assert; -import org.junit.Test; - -/** - * @author Donald G. Dunne - */ -public class StringsTest { - - @org.junit.Test - public void testTruncate() { - String name = "Now is the time forall good men"; - Assert.assertEquals(31, name.length()); - - Assert.assertEquals(20, Strings.truncate(name, 20).length()); - String withDots = Strings.truncate(name, 20, true); - - Assert.assertEquals(20, Strings.truncate(withDots, 20).length()); - Assert.assertEquals(withDots, "Now is the time f..."); - } - - @Test - public void testUnQuote() { - String actual = Strings.unquote(null); - Assert.assertNull(actual); - - actual = Strings.unquote(""); - Assert.assertEquals("", actual); - - actual = Strings.unquote("hello"); - Assert.assertEquals("hello", actual); - - actual = Strings.unquote("\"hello\""); - Assert.assertEquals("hello", actual); - } - - @Test - public void testQuote() { - String actual = Strings.quote(null); - Assert.assertNull(actual); - - actual = Strings.quote(""); - Assert.assertEquals("", actual); - - actual = Strings.quote("hello"); - Assert.assertEquals("\"hello\"", actual); - } -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/FileWatcherTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/FileWatcherTest.java deleted file mode 100644 index 364a8f6c664..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/FileWatcherTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.util.io; - -import java.io.File; -import java.util.Collection; -import java.util.concurrent.TimeUnit; -import org.junit.Assert; -import org.eclipse.osee.framework.jdk.core.test.mock.MockFileWatcherListener; -import org.eclipse.osee.framework.jdk.core.util.io.FileChangeEvent; -import org.eclipse.osee.framework.jdk.core.util.io.FileChangeType; -import org.eclipse.osee.framework.jdk.core.util.io.FileWatcher; -import org.junit.Test; - -/** - * @author Roberto E. Escobar - */ -public class FileWatcherTest { - - @Test - public void testWatcher() throws InterruptedException { - MockFileWatcherListener listener = new MockFileWatcherListener(); - - FileWatcher watcher = new FileWatcher(320, TimeUnit.MILLISECONDS); - - MockFile file = new MockFile("abcde", true); - - Assert.assertTrue(file.exists()); - - watcher.addListener(listener); - watcher.addFile(file); - watcher.start(); - - file.setLastModified(10000); - synchronized (listener) { - listener.wait(1000); - } - checkEvent(listener, file, FileChangeType.CREATED); - - listener.clear(); - file.setLastModified(15000); - synchronized (listener) { - listener.wait(1000); - } - checkEvent(listener, file, FileChangeType.MODIFIED); - - listener.clear(); - file.setExists(false); - file.setLastModified(0); - synchronized (listener) { - listener.wait(1000); - } - checkEvent(listener, file, FileChangeType.DELETED); - - watcher.stop(); - watcher.removeFile(file); - watcher.removeListener(listener); - } - - private static void checkEvent(MockFileWatcherListener listener, File expectedFile, FileChangeType expectedType) { - Assert.assertEquals("File modified event was not received", 1, listener.getFileModifiedCallCount()); - Collection items = listener.getFileChangeEvents(); - Assert.assertEquals(1, items.size()); - FileChangeEvent event = items.iterator().next(); - Assert.assertNotNull(event); - Assert.assertEquals(expectedType, event.getChangeType()); - Assert.assertEquals(expectedFile, event.getFile()); - } - - private final class MockFile extends File { - - private static final long serialVersionUID = 8677714040873925615L; - private long lastModified; - private boolean exists; - - public MockFile(String pathname, boolean exists) { - super(pathname); - this.exists = exists; - } - - @Override - public long lastModified() { - return lastModified; - } - - @Override - public boolean setLastModified(long time) { - boolean change = lastModified() != time; - if (change) { - this.lastModified = time; - } - return change; - } - - @Override - public boolean exists() { - return exists; - } - - public void setExists(boolean exists) { - this.exists = exists; - } - - } -} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/IoTestSuite.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/IoTestSuite.java deleted file mode 100644 index 70eb4e041b6..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/IoTestSuite.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jdk.core.test.util.io; - -import org.eclipse.osee.framework.jdk.core.test.util.io.xml.IoXmlTestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ -//@formatter:off - IoXmlTestSuite.class, - FileWatcherTest.class -//@formatter:on -}) -public class IoTestSuite { - // Test Suite Class -} diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/xml/ExcelXmlWriterTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/xml/ExcelXmlWriterTest.java deleted file mode 100644 index 11bb1508d3d..00000000000 --- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/test/util/io/xml/ExcelXmlWriterTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jdk.core.test.util.io.xml; - -import java.io.IOException; -import java.io.StringWriter; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.junit.Assert; -import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter; -import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter; -import org.junit.Test; - -/** - * @link: ExcelXmlWriter - * @author Karol M. Wilk - */ -public final class ExcelXmlWriterTest { - - private static final String SAMPLE_STYLE = // - "\n" + // - "\n" + // - "\n"; - private static final String BROKEN_TAGS_STYLE = // - "\n"; - private ISheetWriter excelWriter = null; - - private static final Pattern INDIVIDUAL_STYLE_REGEX = Pattern.compile("\n" + // + "\n"; + private static final String BROKEN_TAGS_STYLE = // + "\n"; + private ISheetWriter excelWriter = null; + + private static final Pattern INDIVIDUAL_STYLE_REGEX = Pattern.compile("