Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Finkbeiner2011-06-02 01:04:39 +0000
committerRyan D. Brooks2011-06-02 01:04:39 +0000
commit8b7d51e5cabfc70416464b8cb894a6c8f9d24221 (patch)
tree3137411bbd3279a09ec188f8a90d0633a3f40601
parent34e3aafd959a50034ea8a8081f221868b4392abf (diff)
downloadorg.eclipse.osee-8b7d51e5cabfc70416464b8cb894a6c8f9d24221.tar.gz
org.eclipse.osee-8b7d51e5cabfc70416464b8cb894a6c8f9d24221.tar.xz
org.eclipse.osee-8b7d51e5cabfc70416464b8cb894a6c8f9d24221.zip
feature: Add propertyStoreRecord for ote outfiles
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/.project28
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecordTest.java72
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java35
6 files changed, 156 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ote.core.test/.classpath b/plugins/org.eclipse.osee.ote.core.test/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ote.core.test/.project b/plugins/org.eclipse.osee.ote.core.test/.project
new file mode 100644
index 00000000000..770c642ab6b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ote.core.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..cb6b081af4e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test
+Bundle-SymbolicName: org.eclipse.osee.ote.core.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Boeing
+Fragment-Host: org.eclipse.osee.ote.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit
+Export-Package: org.eclipse.osee.ote.core.framework
diff --git a/plugins/org.eclipse.osee.ote.core.test/build.properties b/plugins/org.eclipse.osee.ote.core.test/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecordTest.java b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecordTest.java
new file mode 100644
index 00000000000..bdc3b225862
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core.test/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecordTest.java
@@ -0,0 +1,72 @@
+package org.eclipse.osee.ote.core.log.record;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+
+public class PropertyStoreRecordTest extends TestCase{
+
+ public void testSimpleXmlWriting() throws XMLStreamException{
+ PropertyStore store = new PropertyStore();
+ store.put("test1", "data1");
+ store.put("test2", "data2");
+ store.put("test3", "data3");
+ store.put("test4", "data4");
+ PropertyStoreRecord record = new PropertyStoreRecord(store);
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ Writer stringStream = new StringWriter();
+ XMLStreamWriter writer = factory.createXMLStreamWriter(stringStream);
+ record.toXml(writer);
+
+ Pattern pattern = Pattern.compile("key=\"test1\"");
+ Matcher matcher = pattern.matcher(stringStream.toString());
+ assertTrue(matcher.find());
+
+ pattern = Pattern.compile("key=\"test2\"");
+ matcher = pattern.matcher(stringStream.toString());
+ assertTrue(matcher.find());
+
+ pattern = Pattern.compile("data2");
+ matcher = pattern.matcher(stringStream.toString());
+ assertTrue(matcher.find());
+
+ System.out.println(stringStream.toString());
+
+ pattern = Pattern.compile("data4");
+ matcher = pattern.matcher(stringStream.toString());
+ assertTrue(matcher.find());
+
+ pattern = Pattern.compile("key=\"test5\"");
+ matcher = pattern.matcher(stringStream.toString());
+ assertTrue(!matcher.find());
+ }
+
+ public void testNullPropertyStore() throws XMLStreamException{
+ PropertyStoreRecord record = new PropertyStoreRecord(null);
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ Writer stringStream = new StringWriter();
+ XMLStreamWriter writer = factory.createXMLStreamWriter(stringStream);
+ record.toXml(writer);
+ }
+
+ public void testEmptyPropertyStore() throws XMLStreamException{
+ PropertyStoreRecord record = new PropertyStoreRecord(new PropertyStore());
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ Writer stringStream = new StringWriter();
+ XMLStreamWriter writer = factory.createXMLStreamWriter(stringStream);
+ record.toXml(writer);
+
+ assertTrue(stringStream.toString().length() == 31);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java
new file mode 100644
index 00000000000..6561253fac5
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java
@@ -0,0 +1,35 @@
+package org.eclipse.osee.ote.core.log.record;
+
+import java.util.logging.Level;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.eclipse.osee.framework.jdk.core.type.IPropertyStore;
+
+public class PropertyStoreRecord extends TestRecord {
+
+ private static final long serialVersionUID = -6515147544821433102L;
+ private IPropertyStore store;
+
+ public PropertyStoreRecord(IPropertyStore store) {
+ super(null, Level.INFO, "PropertyStoreRecord", false);
+ this.store = store;
+ }
+
+ @Override
+ public void toXml(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeStartElement("PropertyStore");
+ if(store != null){
+ for(String key:store.keySet()){
+ String message = store.get(key);
+ writer.writeStartElement("Property");
+ writer.writeAttribute("key", key);
+ writer.writeCharacters(message);
+ writer.writeEndElement();
+ }
+ }
+ writer.writeEndElement();
+ }
+
+}

Back to the top