Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-05-12 15:28:31 +0000
committerRyan D. Brooks2011-05-12 15:28:31 +0000
commit9f1cfdb6a8bc361ebd6f6ce48dd50daea1fb473c (patch)
tree6a217db3ee11799ece13ac7b26378dad160f8e4d
parent3ba1e25f8586cb7ad79b61d9dbd0bf55a8100e08 (diff)
downloadorg.eclipse.osee-9f1cfdb6a8bc361ebd6f6ce48dd50daea1fb473c.tar.gz
org.eclipse.osee-9f1cfdb6a8bc361ebd6f6ce48dd50daea1fb473c.tar.xz
org.eclipse.osee-9f1cfdb6a8bc361ebd6f6ce48dd50daea1fb473c.zip
refactor: Utilize utility method Lib.fileToString instead of in-place code
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtilTest.java16
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/rules/WordMLNewLineMakerRuleTest.java13
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java14
-rw-r--r--plugins/org.eclipse.osee.framework.search.engine.test/src/org/eclipse/osee/framework/search/engine/test/utility/TagProcessorTest.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java25
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMlResolutionGuiTest.java19
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineTest.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordArtifactElementExtractorTest.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordEditTest.java15
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordTrackedChangesTest.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java16
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/imageDetection/WordImageCompareTest.java19
13 files changed, 40 insertions, 172 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtilTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtilTest.java
index 831aab383cf..eed98024bef 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtilTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/ModelUtilTest.java
@@ -10,10 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.dsl.integration.util;
-import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
import org.eclipse.osee.framework.core.dsl.integration.mocks.DslAsserts;
@@ -48,19 +46,9 @@ public class ModelUtilTest {
private static final String TYPE_TEST_INPUT = "testTypeModel.osee";
private static final String ACCESS_TEST_INPUT = "testAccessModel.osee";
- private String getRawXTextData(String testInputFile) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(this.getClass().getResourceAsStream(testInputFile));
- return Lib.inputStreamToString(inputStream);
- } finally {
- Lib.close(inputStream);
- }
- }
-
@Test
public void testModelUtilLoadType() throws OseeCoreException, IOException {
- String rawXTextData = getRawXTextData(TYPE_TEST_INPUT);
+ String rawXTextData = Lib.fileToString(getClass(), TYPE_TEST_INPUT);
OseeDsl model1 = ModelUtil.loadModel("osee:/text.osee", rawXTextData);
@@ -105,7 +93,7 @@ public class ModelUtilTest {
@Test
public void testModelUtilLoadAccess() throws OseeCoreException, IOException {
- String rawXTextData = getRawXTextData(ACCESS_TEST_INPUT);
+ String rawXTextData = Lib.fileToString(getClass(), ACCESS_TEST_INPUT);
OseeDsl model1 = ModelUtil.loadModel("osee:/text.osee", rawXTextData);
Assert.assertEquals(2, model1.getArtifactTypes().size());
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
index 92d3120e738..297f3ee583f 100644
--- 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
@@ -11,7 +11,6 @@
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;
@@ -72,14 +71,8 @@ public final class WordMLNewLineMakerRuleTest {
}
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);
- }
+ String data = Lib.fileToString(WordMLNewLineMakerRuleTest.class, name);
+ Assert.assertTrue(Strings.isValid(data));
+ return data;
}
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java
index 4a6c991d1f4..e505684e945 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core.test/src/org/eclipse/osee/framework/jdk/core/text/UtfReadingRuleTest.java
@@ -18,7 +18,6 @@ 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;
@@ -93,8 +92,7 @@ public final class UtfReadingRuleTest {
Assert.fail("unexpected/wrong exception thrown testCharset()");
}
- //trim off extra data
- String expectedUtf8String = Lib.fileToString(getInputFile());
+ String expectedUtf8String = Lib.fileToString(getClass(), FILE_INPUT);
String actual = rule.getLastOutput().toString().trim();
Assert.assertEquals(expectedUtf8String, actual);
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
index 3bb91d51098..3df6da2426c 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
@@ -491,7 +491,17 @@ public final class Lib {
}
public static String fileToString(File file) throws IOException {
- return new String(fileToChars(file, "UTF8"));
+ return new String(fileToChars(file, "UTF-8"));
+ }
+
+ public static String fileToString(Class<?> clazz, String relativePath) throws IOException {
+ InputStream stream = null;
+ try {
+ stream = clazz.getResourceAsStream(relativePath);
+ return inputStreamToString(stream);
+ } finally {
+ Lib.close(stream);
+ }
}
public static byte[] fileToBytes(File file) throws IOException {
@@ -529,7 +539,7 @@ public final class Lib {
}
public static CharBuffer fileToCharBuffer(File file) throws IOException {
- return fileToCharBuffer(file, "UTF8");
+ return fileToCharBuffer(file, "UTF-8");
}
public static CharBuffer fileToCharBuffer(File file, String charset) throws IOException {
diff --git a/plugins/org.eclipse.osee.framework.search.engine.test/src/org/eclipse/osee/framework/search/engine/test/utility/TagProcessorTest.java b/plugins/org.eclipse.osee.framework.search.engine.test/src/org/eclipse/osee/framework/search/engine/test/utility/TagProcessorTest.java
index 13ec721c0fa..a7d661f011b 100644
--- a/plugins/org.eclipse.osee.framework.search.engine.test/src/org/eclipse/osee/framework/search/engine/test/utility/TagProcessorTest.java
+++ b/plugins/org.eclipse.osee.framework.search.engine.test/src/org/eclipse/osee/framework/search/engine/test/utility/TagProcessorTest.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.search.engine.test.utility;
-import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
@@ -117,12 +116,6 @@ public class TagProcessorTest {
}
private static String getResource(String resourceName) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(TagProcessorTest.class.getResourceAsStream("data/" + resourceName));
- return Lib.inputStreamToString(inputStream);
- } finally {
- Lib.close(inputStream);
- }
+ return Lib.fileToString(TagProcessorTest.class, "data/" + resourceName);
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
index edd94cba1ce..66064abb432 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
@@ -10,11 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.importing.parsers;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.eclipse.osee.framework.core.operation.StringOperationLogger;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.junit.Assert;
@@ -39,7 +36,7 @@ public final class WordMLExtractorDelegateTableOfContentsTest {
StringOperationLogger logger = new StringOperationLogger();
- Matcher matcher = PARAGRAPHREGEX.matcher(getFileAsString(TABLE_OF_CONTENTS_FILE));
+ Matcher matcher = PARAGRAPHREGEX.matcher(Lib.fileToString(getClass(), TABLE_OF_CONTENTS_FILE));
boolean foundSomething = false;
while (matcher.find()) {
foundSomething = true;
@@ -50,22 +47,4 @@ public final class WordMLExtractorDelegateTableOfContentsTest {
logger.toString().isEmpty());
Assert.assertTrue(foundSomething);
}
-
- private static String getFileAsString(String nameOfFile) {
- StringBuilder buffer = new StringBuilder();
- InputStream inputStream = null;
- try {
- inputStream = WordMLExtractorDelegateTableOfContentsTest.class.getResourceAsStream(TABLE_OF_CONTENTS_FILE);
- buffer.append(Lib.inputStreamToString(inputStream));
- Assert.assertTrue(buffer.length() != 0);
- } catch (IOException ex) {
- Assert.assertTrue(String.format("%s something when wrong while reading a file...",
- WordMLExtractorDelegateTableOfContentsTest.class.getName()), true);
- } finally {
- Lib.close(inputStream);
- }
-
- return buffer.toString();
- }
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMlResolutionGuiTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMlResolutionGuiTest.java
index b5d95fbbba7..39d4349559d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMlResolutionGuiTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordMlResolutionGuiTest.java
@@ -10,13 +10,9 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.importing.parsers;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
@@ -65,7 +61,7 @@ public class WordMlResolutionGuiTest {
resolvingGui.setMockUserAnswer(ContentType.CONTENT);
//pre load with some real data
- String rawData = getResourceData(FILE_INPUT);
+ String rawData = Lib.fileToString(getClass(), FILE_INPUT);
Matcher matcher = PARAGRAPH_REGEX.matcher(rawData);
boolean foundSomething = false;
matcher.find();//skip 1.0
@@ -93,17 +89,4 @@ public class WordMlResolutionGuiTest {
Assert.assertNull(delegate.getLastHeaderName());
Assert.assertNull(delegate.getLastContent());
}
-
- private static String getResourceData(String name) throws IOException {
-
- InputStream inputStream = null;
- try {
- inputStream = WordMlResolutionGuiTest.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.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineTest.java
index baa5aa9822e..6545e22ef70 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineTest.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.importing.parsers;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -56,7 +54,7 @@ public final class WordOutlineTest {
/**
* Note: some of the data objects need to repeat data from previous test because they are considered to be
* lastHeaderNumber or lastHeaderName or lastContent
- *
+ *
* @return collection of data sets used as input for parameterized unit test
*/
@Parameters
@@ -81,7 +79,7 @@ public final class WordOutlineTest {
public void testDelegate() throws Exception {
delegate.initialize();
- String rawData = getResourceData(dataFileName);
+ String rawData = Lib.fileToString(getClass(), dataFileName);
Matcher matcher = PARAGRAPH_REGEX.matcher(rawData);
boolean foundSomething = false;
@@ -131,19 +129,6 @@ public final class WordOutlineTest {
return new DelegateData(headerNumber, headerName, content);
}
- private static String getResourceData(String name) throws IOException {
- InputStream inputStream = null;
- String data;
- try {
- inputStream = WordOutlineTest.class.getResourceAsStream(name);
- data = Lib.inputStreamToString(inputStream);
- Assert.assertTrue(Strings.isValid(data));
- } finally {
- Lib.close(inputStream);
- }
- return data;
- }
-
private static final class DelegateData {
private final String headerNumber;
private final String headerName;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordArtifactElementExtractorTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordArtifactElementExtractorTest.java
index 4bd77cd13aa..457f6fbc072 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordArtifactElementExtractorTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordArtifactElementExtractorTest.java
@@ -10,10 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.test.cases;
-import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -57,17 +55,6 @@ public class WordArtifactElementExtractorTest {
private final static String MULIT_2007_EDIT =
"<w:body><wx:sub-section><wx:sub-section><wx:sub-section><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00DB6B9D\"><w:pPr><w:pStyle w:val=\"Heading3\"/><w:listPr><wx:t wx:val=\"3.2.3 \"/><wx:font wx:val=\"Times New Roman\"/></w:listPr></w:pPr><w:r><w:t>Aircraft Systems Management Subsystem Crew Interface</w:t></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:r><w:pict><v:shapetype id=\"_x0000_t75\" coordsize=\"21600,21600\" o:spt=\"75\" o:preferrelative=\"t\" path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\"><v:stroke joinstyle=\"miter\"/><v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/><v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/><v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/><v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/><v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/><v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/><v:f eqn=\"sum @10 21600 0\"/></v:formulas><v:path o:extrusionok=\"f\" gradientshapeok=\"t\" o:connecttype=\"rect\"/><o:lock v:ext=\"edit\" aspectratio=\"t\"/></v:shapetype><w:binData w:name=\"wordml://02000001.jpg\" xml:space=\"preserve\">/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLD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xBHMgcJIodRIhRgCM8qwBB9iARXAa98P9Q1l/G4W7tok11bI2pO4lWgAyHGOASAMjOAc44wen/4S/wAPwfub/XtGtryP5Z4P7QjPlyDhlycHg5HIB9hXHiKNGdOH1dXlpe3+GHS383N+vQpN31ObtPGOsap4k1fSrW40azvrG+8iHS7+OVJbqEYPmLKG/iUOwxG2BtzkHJ2bfxxp0/iHW9KeG5hGkrF5k0kD4kdyRtUbckk7Ao6yFjtBAycbxb4O1jxRJIj2+jRTx3Mb2OswySxXdrErBsbAp3sMvj94qkkHCkVY1Hwjrp1Xxbd6RqcNpJrltbiG4ywkt5Yl2bcAH5WXPzghlJ4U4zXTKGCqRV2otpddneN3dJ3VuZ6rmVnvoT7yNh/G3h+LTdQv5r14YdOZEu1mtpY5YS+Nm6NlD4bcMHGDz6GoLTxvY33i+Hw9BZ6gsslm90ZZ7OWELhgoG10Bwfm+Y4XIABJOBx0vww1N9D8WWNpBpOnJqy2KWlvDcSSRwiAjducxgktjOcEkk59a7WXw/dj4jW/iSGSF7ZtMbT54nYq6fvPMV1wCGyeCDtx1yelZ1KGAgpcsm3Z21W/LFrZd3Jb20GnNnR0UUV45oFFFFABRRRQAUUUUAFFFFABRRRQB/9k=</w:binData><v:shape id=\"_x0000_i1025\" type=\"#_x0000_t75\" style=\"width:53.25pt;height:15pt\"><v:imagedata src=\"wordml://02000001.jpg\" o:title=\"AAABDIyk7NQAjIItIqz3cQ\"/></v:shape></w:pict></w:r></w:p><w:p wsp:rsidR=\"00193380\" wsp:rsidRDefault=\"00236054\" wsp:rsidP=\"007117E2\"><w:pPr><w:pStyle w:val=\"paranormal\"/></w:pPr><w:r><w:t>One</w:t></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:r><w:pict><w:binData w:name=\"wordml://02000002.jpg\" xml:space=\"preserve\">/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0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edB5FyhVwWzweR8pXPzKMlR8w9H8MWc+neE9GsbqPy7m2sYIZUyDtdY1BGRweQelY4rD4elh04TUpX79PS44tt6mUnifVb3xVrWiaZpFlL/ZXkeZNc37Rb/NTeMKsT9MEdfSp/GHi+08J6Je3mIbq8tokm+w/aAkjRtKse/oSFy3XGMjFc3J4cdPH/iXU9T8Hf21Z332X7HJttZNuyLa/EsilcnHbnb9KyvG/gnXtSuvGH2HSYb4av8AYJrSUzovktCNjgbuQ+CfQbWb5s/KeylhcFOvTUpJRtBvXdvk5k3zabyb0VrNIlykkzstT8c2OhTa62rrDBaaZ5IieO6SWW5eRC2zyh8yNxxu6jLcAEjpoJ4rmCOeCVJYZVDxyRsGV1IyCCOCCO9eZeJfBeuas/xCW2tkA1ZbBrFnlUCYwgF165U5GBuwMkc45r02CRpYI5HheF3UM0UhBZCR907SRkdOCR7muHF0sPClCVJ+87X1/uQe3q5J+a6bFRbvqSUUUV55YUUUUAFZV54Y8P6jdPdX2h6Zc3MmN809pG7tgYGSRk8AD8KKKuFScHeDt6Ba5owQRW0EcEESRQxKEjjjUKqKBgAAcAAdqkooqG76sAooooAKKKKAP//Z</w:binData><v:shape id=\"_x0000_i1026\" type=\"#_x0000_t75\" style=\"width:53.25pt;height:15pt\"><v:imagedata src=\"wordml://02000002.jpg\" o:title=\"AAABDIyk7NQAjIItIqz3cQ\"/></v:shape></w:pict></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"/><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:pPr><w:rPr><w:vanish/></w:rPr></w:pPr><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r wsp:rsidR=\"00DB6B9D\"><w:rPr><w:vanish/></w:rPr><w:instrText>LISTNUM\"listreset\"\\l1\\s0</w:instrText></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"end\"/><wx:t wx:val=\" .\"/></w:r></w:p></wx:sub-section><wx:sub-section><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00DB6B9D\"><w:pPr><w:pStyle w:val=\"Heading3\"/><w:listPr><wx:t wx:val=\"3.2.4 \"/><wx:font wx:val=\"Times New Roman\"/></w:listPr></w:pPr><w:r><w:t>Controls and Display Subsystem Crew Interface</w:t></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:r><w:pict><v:shape id=\"_x0000_i1027\" type=\"#_x0000_t75\" style=\"width:53.25pt;height:15pt\"><v:imagedata src=\"wordml://02000001.jpg\" o:title=\"AAABDIpXNGsAlFP5ZetuAg\"/></v:shape></w:pict></w:r></w:p><w:p wsp:rsidR=\"00494E1B\" wsp:rsidRDefault=\"00236054\" wsp:rsidP=\"00494E1B\"><w:pPr><w:pStyle w:val=\"paranormal\"/></w:pPr><w:r><w:t>Two</w:t></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:r><w:pict><v:shape id=\"_x0000_i1028\" type=\"#_x0000_t75\" style=\"width:53.25pt;height:15pt\"><v:imagedata src=\"wordml://02000002.jpg\" o:title=\"AAABDIpXNGsAlFP5ZetuAg\"/></v:shape></w:pict></w:r></w:p><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"/><w:p wsp:rsidR=\"00964C23\" wsp:rsidRDefault=\"00964C23\"><w:pPr><w:rPr><w:vanish/></w:rPr></w:pPr><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r wsp:rsidR=\"00DB6B9D\"><w:rPr><w:vanish/></w:rPr><w:instrText>LISTNUM\"listreset\"\\l1\\s0</w:instrText></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"end\"/><wx:t wx:val=\" .\"/></w:r></w:p></wx:sub-section></wx:sub-section></wx:sub-section><w:sectPr wsp:rsidR=\"00964C23\" wsp:rsidSect=\"00FC06D7\"><w:pgSz w:w=\"12240\" w:h=\"15840\" w:code=\"1\"/><w:pgMar w:top=\"1440\" w:right=\"1080\" w:bottom=\"1440\" w:left=\"1440\" w:header=\"432\" w:footer=\"432\" w:gutter=\"0\"/><w:pgNumType w:start=\"1\"/><w:cols w:space=\"475\"/><w:noEndnote/></w:sectPr></w:body>";
- private static final String getExpectedContent(String filePath) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(WordArtifactElementExtractorTest.class.getResourceAsStream(filePath));
- String data = Lib.inputStreamToString(inputStream);
- return data.replaceAll("\r?\n", "\r\n");
- } finally {
- Lib.close(inputStream);
- }
- }
-
@org.junit.Test(expected = OseeCoreException.class)
public void testEmptyChange() throws Exception {
WordImageArtifactElementExtractor artifactElementExtractor =
@@ -77,8 +64,9 @@ public class WordArtifactElementExtractorTest {
@org.junit.Test
public void testOLEObject() throws Exception {
+ String content = Lib.fileToString(getClass(), EQUATION_TEST);
WordImageArtifactElementExtractor artifactElementExtractor =
- new WordImageArtifactElementExtractor(getDocument(getExpectedContent(EQUATION_TEST)));
+ new WordImageArtifactElementExtractor(getDocument(content));
artifactElementExtractor.extractElements();
Assert.assertTrue(artifactElementExtractor.getOleDataElement() != null);
}
@@ -179,8 +167,9 @@ public class WordArtifactElementExtractorTest {
*/
@org.junit.Test(timeout = 10000)
public void testPerformance() throws Exception {
+ String content = Lib.fileToString(getClass(), PERFORMANCE_TEST);
WordImageArtifactElementExtractor artifactElementExtractor =
- new WordImageArtifactElementExtractor(getDocument(getExpectedContent(PERFORMANCE_TEST)));
+ new WordImageArtifactElementExtractor(getDocument(content));
artifactElementExtractor.extractElements();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordEditTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordEditTest.java
index ea0f94f2cf6..c1360579c4a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordEditTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordEditTest.java
@@ -12,8 +12,6 @@
package org.eclipse.osee.framework.ui.skynet.test.cases;
import static org.junit.Assert.assertFalse;
-
-import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -21,7 +19,6 @@ import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -84,7 +81,7 @@ public class WordEditTest {
Artifact artifact = createArtifact(branch, ARTIFACT_NAME_1);
artifact.persist();
- String testData = getExpectedContent();
+ String testData = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
Assert.assertNotNull(testData);
String expected = replaceGuidMarkers(testData, artifact.getGuid());
@@ -154,16 +151,6 @@ public class WordEditTest {
return artifact;
}
- private static final String getExpectedContent() throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(WordEditTest.class.getResourceAsStream(TEST_WORD_EDIT_FILE_NAME));
- return Lib.inputStreamToString(inputStream);
- } finally {
- Lib.close(inputStream);
- }
- }
-
private static final class UpdateArtifactListener implements IArtifactEventListener {
private final EventBasicGuidArtifact artToLookFor;
private volatile boolean wasUpdateReceived;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordTrackedChangesTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordTrackedChangesTest.java
index 2c7bb540bb2..238022e3265 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordTrackedChangesTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/WordTrackedChangesTest.java
@@ -12,10 +12,6 @@ package org.eclipse.osee.framework.ui.skynet.test.cases;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -48,19 +44,20 @@ public class WordTrackedChangesTest {
@org.junit.Test
public void testFindTrackChanges() throws Exception {
- assertTrue(WordUtil.containsWordAnnotations(getFileContent(TEST_WORD_EDIT_FILE_NAME)));
+ String content = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
+ assertTrue(WordUtil.containsWordAnnotations(content));
}
@org.junit.Test
public void testRemoveTrackChanges() throws Exception {
- String content = getFileContent(TEST_WORD_EDIT_FILE_NAME);
+ String content = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
content = WordUtil.removeAnnotations(content);
assertFalse(WordUtil.containsWordAnnotations(content));
}
@org.junit.Test
public void testWholeWordSaveWithTrackChanges() throws Exception {
- String content = getFileContent(TEST_WORD_EDIT_FILE_NAME);
+ String content = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
LinkType linkType = LinkType.OSEE_SERVER_LINK;
Branch branch = BranchManager.getBranch(DemoSawBuilds.SAW_Bld_1);
Artifact newArt =
@@ -71,21 +68,10 @@ public class WordTrackedChangesTest {
assertTrue(WordUtil.containsWordAnnotations(unlinkedContent));
}
- private String getFileContent(String fileName) throws IOException {
- InputStream stream = null;
- try {
- stream = this.getClass().getResourceAsStream(fileName);
- String returnString = Lib.inputStreamToString(stream);
- return returnString;
- } finally {
- Lib.close(stream);
- }
- }
-
@After
public void tearDown() throws Exception {
FrameworkTestUtil.cleanupSimpleTest(BranchManager.getBranchByGuid(DemoSawBuilds.SAW_Bld_1.getGuid()),
WordTrackedChangesTest.class.getSimpleName());
FrameworkTestUtil.cleanupSimpleTest(BranchManager.getCommonBranch(), WordTrackedChangesTest.class.getSimpleName());
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java
index db85a925859..04f9138a91c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java
@@ -15,13 +15,11 @@ import static org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer.PREV
import static org.eclipse.osee.support.test.util.DemoSawBuilds.SAW_Bld_1;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Collections;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
@@ -160,15 +158,7 @@ public class WordTemplateProcessorTest {
new PurgeArtifacts(Collections.singletonList(myRootArtifact)).execute();
}
- private static String getResourceData(String name) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = WordTemplateProcessorTest.class.getResourceAsStream(name);
- String data = Lib.inputStreamToString(inputStream);
- Assert.assertTrue(Strings.isValid(data));
- return data;
- } finally {
- Lib.close(inputStream);
- }
+ private static String getResourceData(String relativePath) throws IOException {
+ return Lib.fileToString(WordTemplateProcessorTest.class, relativePath);
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/imageDetection/WordImageCompareTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/imageDetection/WordImageCompareTest.java
index 6865b4e09b3..ebbf7c8f2d4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/imageDetection/WordImageCompareTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/imageDetection/WordImageCompareTest.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.test.renderer.imageDetection;
-import java.io.BufferedInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
@@ -58,8 +56,8 @@ public class WordImageCompareTest {
private boolean compareFile(String firstFileName, String secondFileName) throws IOException {
boolean isEqual = false;
- String firstFile = getContent(firstFileName);
- String secondFile = getContent(secondFileName);
+ String firstFile = Lib.fileToString(getClass(), firstFileName);
+ String secondFile = Lib.fileToString(getClass(), secondFileName);
List<WordmlPicture> firstFileImages = createPictureList(firstFile);
List<WordmlPicture> secondFileImages = createPictureList(secondFile);
@@ -93,15 +91,4 @@ public class WordImageCompareTest {
}
return pictures;
}
-
- private static final String getContent(String filePath) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(WordImageCompareTest.class.getResourceAsStream(filePath));
- String data = Lib.inputStreamToString(inputStream);
- return data.replaceAll("\r?\n", "\r\n");
- } finally {
- Lib.close(inputStream);
- }
- }
-}
+} \ No newline at end of file

Back to the top