Author: degenaro
Date: Thu Nov 6 15:06:48 2014
New Revision: 1637131
URL: http://svn.apache.org/r1637131
Log:
UIMA-4069 Redesign of JD toward the main goal of classpath separation for
container (system) code.
Add Exception to JdUserMetaCas.
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserMetaCas.java
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserMetaCas.java
URL:
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserMetaCas.java?rev=1637131&r1=1637130&r2=1637131&view=diff
==============================================================================
---
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserMetaCas.java
(original)
+++
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserMetaCas.java
Thu Nov 6 15:06:48 2014
@@ -23,6 +23,7 @@ public class JdUserMetaCas {
private int seqNo = -1;
private String serializedCas = null;
private String documentText = null;
+ private Exception exception = null;
public JdUserMetaCas(int seqNo, String serializedCas, String
documentText) {
setSeqNo(seqNo);
@@ -30,6 +31,13 @@ public class JdUserMetaCas {
setDocumentText(documentText);
}
+ public JdUserMetaCas(int seqNo, String serializedCas, String
documentText, Exception exception) {
+ setSeqNo(seqNo);
+ setSerializedCas(serializedCas);
+ setDocumentText(documentText);
+ setException(exception);
+ }
+
private void setSeqNo(int value) {
seqNo = value;
}
@@ -54,7 +62,22 @@ public class JdUserMetaCas {
return documentText;
}
+ private void setException(Exception value) {
+ exception = value;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
public void printMe() {
- System.out.println("seq:"+getSeqNo()+"
"+"id:"+getDocumentText()+" "+"cas:"+getSerializedCas());
+ StringBuffer sb = new StringBuffer();
+ sb.append("seq:"+getSeqNo()+" ");
+ sb.append("id:"+getDocumentText()+" ");
+ sb.append("cas:"+getSerializedCas()+" ");
+ if(exception != null) {
+ sb.append("exception:"+getException());
+ }
+ System.out.println(sb);
}
}
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
URL:
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java?rev=1637131&r1=1637130&r2=1637131&view=diff
==============================================================================
---
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
(original)
+++
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
Thu Nov 6 15:06:48 2014
@@ -281,4 +281,24 @@ public class TestSuite {
fail("Exception");
}
}
+
+ @Test
+ public void test09() {
+ try {
+ int seqNo = 1;
+ String serializedCas = "ABC";
+ String documentText = "123";
+ Exception exception = new RuntimeException("exception
text");
+ JdUserMetaCas jdUserMetaCas = new JdUserMetaCas(seqNo,
serializedCas, documentText, exception);
+ assertTrue(seqNo == jdUserMetaCas.getSeqNo());
+
assertTrue(serializedCas.equals(jdUserMetaCas.getSerializedCas()));
+
assertTrue(documentText.equals(jdUserMetaCas.getDocumentText()));
+
assertTrue(exception.equals(jdUserMetaCas.getException()));
+ jdUserMetaCas.printMe();
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ fail("Exception");
+ }
+ }
}