Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • scs/ipaaca
  • ramin.yaghoubzadeh/ipaaca
2 results
Show changes
Showing
with 2197 additions and 103 deletions
/*
* This file is part of IPAACA, the
* "Incremental Processing Architecture
* for Artificial Conversational Agents".
*
* Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University
*
* http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca
*
* This file may be licensed under the terms of of the
* GNU Lesser General Public License Version 3 (the ``LGPL''),
* or (at your option) any later version.
*
* Software distributed under the License is distributed
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the LGPL for the specific language
* governing rights and limitations.
*
* You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology.
* The Excellence Cluster EXC 277 is a grant of the Deutsche
* Forschungsgemeinschaft (DFG) in the context of the German
* Excellence Initiative.
*/
package ipaacademo;
import ipaaca.AbstractIU;
import ipaaca.HandlerFunctor;
import ipaaca.IUEventHandler;
import ipaaca.IUEventType;
import ipaaca.Initializer;
import ipaaca.InputBuffer;
import ipaaca.OutputBuffer;
import ipaaca.RemotePushIU;
import java.util.EnumSet;
import java.util.Set;
import javax.swing.JFrame;
import javax.swing.JLabel;
import com.google.common.collect.ImmutableSet;
public class TestListener
{
private static final class MyEventHandler implements HandlerFunctor
{
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
switch(type)
{
case ADDED: System.out.println("IU added "+iu.getPayload().get("CONTENT")); break;
case COMMITTED: System.out.println("IU committed"); break;
case UPDATED: System.out.println("IU updated "+iu.getPayload()); break;
case LINKSUPDATED: System.out.println("IU links updated"); break;
case RETRACTED: break;
case DELETED: break;
}
}
}
static
{
Initializer.initializeIpaacaRsb();
}
private static final String CATEGORY = "spam";
private static final double RATE = 0.5;
private UpdateThread updateThread;
public TestListener()
{
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
JLabel label = new JLabel("");
updateThread = new UpdateThread(new InputBuffer("TestListener", categories),label);
}
public void start()
{
updateThread.start();
}
private static class UpdateThread extends Thread
{
private InputBuffer inBuffer;
private JLabel label;
public UpdateThread(InputBuffer inBuffer, JLabel label)
{
this.inBuffer = inBuffer;
this.label = label;
EnumSet<IUEventType> types = EnumSet.of(IUEventType.ADDED,IUEventType.COMMITTED,IUEventType.UPDATED,IUEventType.LINKSUPDATED);
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
MyEventHandler printingEventHandler;
printingEventHandler = new MyEventHandler();
this.inBuffer.registerHandler(new IUEventHandler(printingEventHandler,types,categories));
}
@Override
public void run()
{
System.out.println("Starting!");
}
}
public static void main(String args[])
{
TestListener tl = new TestListener();
tl.start();
}
}
/*
* This file is part of IPAACA, the
* "Incremental Processing Architecture
* for Artificial Conversational Agents".
*
* Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University
*
* http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca
*
* This file may be licensed under the terms of of the
* GNU Lesser General Public License Version 3 (the ``LGPL''),
* or (at your option) any later version.
*
* Software distributed under the License is distributed
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the LGPL for the specific language
* governing rights and limitations.
*
* You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology.
* The Excellence Cluster EXC 277 is a grant of the Deutsche
* Forschungsgemeinschaft (DFG) in the context of the German
* Excellence Initiative.
*/
package ipaacademo;
import ipaaca.AbstractIU;
import ipaaca.HandlerFunctor;
import ipaaca.IUEventHandler;
import ipaaca.IUEventType;
import ipaaca.Initializer;
import ipaaca.InputBuffer;
import ipaaca.OutputBuffer;
import ipaaca.RemotePushIU;
import java.util.EnumSet;
import java.util.Set;
import javax.swing.JFrame;
import javax.swing.JLabel;
import com.google.common.collect.ImmutableSet;
public class TextPrinter
{
private static final class MyEventHandler implements HandlerFunctor
{
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
switch(type)
{
case ADDED: System.out.println("IU added "+iu.getPayload().get("CONTENT")); break;
case COMMITTED: System.out.println("IU committed"); break;
case UPDATED: System.out.println("IU updated "+iu.getPayload()); break;
case LINKSUPDATED: System.out.println("IU links updated"); break;
case RETRACTED: break;
case DELETED: break;
}
}
}
static
{
Initializer.initializeIpaacaRsb();
}
private static final String CATEGORY = "TEXT";
private static final double RATE = 0.5;
private UpdateThread updateThread;
public TextPrinter()
{
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
JLabel label = new JLabel("");
updateThread = new UpdateThread(new InputBuffer("TextPrinter", categories),label);
JFrame frame = new JFrame("IPAACA TextPrinter Demo");
frame.add(label);
frame.setSize(1000,300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void start()
{
updateThread.start();
}
private static class UpdateThread extends Thread
{
private InputBuffer inBuffer;
private JLabel label;
public UpdateThread(InputBuffer inBuffer, JLabel label)
{
this.inBuffer = inBuffer;
this.label = label;
EnumSet<IUEventType> types = EnumSet.of(IUEventType.ADDED,IUEventType.COMMITTED,IUEventType.UPDATED,IUEventType.LINKSUPDATED);
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
MyEventHandler printingEventHandler;
printingEventHandler = new MyEventHandler();
this.inBuffer.registerHandler(new IUEventHandler(printingEventHandler,types,categories));
}
@Override
public void run()
{
long startTime = System.currentTimeMillis();
long nextTime = System.currentTimeMillis();
//long lastNewLetterTime = System.currentTimeMillis();
while(true)
{
//double duration = (System.currentTimeMillis()-startTime)/1000d;
long currentTime = System.currentTimeMillis();
RemotePushIU iuFirst = null;
for (RemotePushIU iu : inBuffer.getIUs())
{
if(iu.getLinks("PREDECESSOR").isEmpty())
{
iuFirst = iu;
break;
}
}
if (iuFirst==null) {
startTime = System.currentTimeMillis();
continue;
}
//int numChars = (int)(duration/RATE);
boolean first_new_element = true;
if (currentTime >= nextTime) {
AbstractIU iu = iuFirst;
String str = "";
do {
//System.out.println(iu.getPayload().get("CONTENT"));
String st = iu.getPayload().get("STATE");
System.out.println("State "+st);
if ((st != null) || first_new_element) {
str += "<font color=\"#000000\">";
str += iu.getPayload().get("CONTENT");
str += "</font>";
if (st == null) {
System.out.println("Setting state to REALIZED");
iu.getPayload().put("STATE", "REALIZED");
first_new_element = false;
}
} else {
str += "<font color=\"#909090\">";
str += iu.getPayload().get("CONTENT");
str += "</font>";
//lastNewLetterTime = System.currentTimeMillis();
}
Set<String> successor = iu.getLinks("SUCCESSOR");
if(successor!=null && !successor.isEmpty())
{
iu = inBuffer.getIU(successor.iterator().next());
} else {
}
} while(! iu.getLinks("SUCCESSOR").isEmpty());
String st = iu.getPayload().get("STATE");
System.out.println("State "+st);
if ((st != null) || first_new_element) {
str += "<font color=\"#000000\">";
str += iu.getPayload().get("CONTENT");
str += "</font>";
//if (iu.getPayload().get("STATE") == null) {
// iu.getPayload().put("STATE", "REALIZED");
// new_elements = true;
//}
if (st == null) {
System.out.println("Setting state to REALIZED");
iu.getPayload().put("STATE", "REALIZED");
first_new_element = false;
}
} else {
str += "<font color=\"#909090\">";
str += iu.getPayload().get("CONTENT");
str += "</font>";
//lastNewLetterTime = System.currentTimeMillis();
}
if (! first_new_element) {
nextTime = currentTime + (int)(RATE*1000.0);
System.out.println("New target time: "+nextTime+" (current "+currentTime+")");
}
str = "<html>"+str+"</html>";
//System.out.println(str);
label.setText(str);
} else {
// just wait until we can print some more
System.out.println("wait");
}
try
{
Thread.sleep(200);
}
catch (InterruptedException e)
{
Thread.interrupted();
}
}
}
}
public static void main(String args[])
{
TextPrinter tp = new TextPrinter();
//OutputBuffer outBuffer = new OutputBuffer("componentX");
/*String[] inputString = {"h","e","l","l","o"," ","w","o","r","l","d","!"};
LocalIU predIU = null;
for(String str:inputString)
{
LocalIU localIU = new LocalIU();
localIU.setCategory(CATEGORY);
outBuffer.add(localIU);
localIU.getPayload().put("CONTENT", str);
if(predIU!=null)
{
localIU.setLinks("PREDECESSOR", ImmutableSet.of(predIU.getUid()));
predIU.setLinks("SUCCESSOR",ImmutableSet.of(localIU.getUid()));
}
predIU = localIU;
}*/
tp.start();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<BugCollection version="1.3.9" sequence="0" timestamp="1331224756097" analysisTimestamp="1331224757021" release="">
<Project projectName="">
<Jar>/homes/hvanwelbergen/git_pool/ipaaca/java/build</Jar>
<SrcDir>/homes/hvanwelbergen/git_pool/ipaaca/java/src</SrcDir>
<SrcDir>/homes/hvanwelbergen/git_pool/ipaaca/java/test/src</SrcDir>
</Project>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IU$Builder">
<SourceLine classname="ipaaca.Ipaaca$IU$Builder" start="1" end="3024" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IU$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IU$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IUCommission$Builder">
<SourceLine classname="ipaaca.Ipaaca$IUCommission$Builder" start="1" end="5034" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IUCommission$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IUCommission$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IULinkUpdate$Builder">
<SourceLine classname="ipaaca.Ipaaca$IULinkUpdate$Builder" start="1" end="6219" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IULinkUpdate$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IULinkUpdate$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IUPayloadUpdate$Builder">
<SourceLine classname="ipaaca.Ipaaca$IUPayloadUpdate$Builder" start="1" end="4036" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IUPayloadUpdate$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IUPayloadUpdate$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IURetraction$Builder">
<SourceLine classname="ipaaca.Ipaaca$IURetraction$Builder" start="1" end="4483" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IURetraction$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IURetraction$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$IntMessage$Builder">
<SourceLine classname="ipaaca.Ipaaca$IntMessage$Builder" start="1" end="343" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$IntMessage$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$IntMessage$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$LinkSet$Builder">
<SourceLine classname="ipaaca.Ipaaca$LinkSet$Builder" start="1" end="838" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$LinkSet$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$LinkSet$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" priority="1" abbrev="CN" category="BAD_PRACTICE">
<Class classname="ipaaca.Ipaaca$PayloadItem$Builder">
<SourceLine classname="ipaaca.Ipaaca$PayloadItem$Builder" start="1" end="1425" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Class>
<Method classname="ipaaca.Ipaaca$PayloadItem$Builder" name="clone" signature="()Lcom/google/protobuf/GeneratedMessage$Builder;" isStatic="false">
<SourceLine classname="ipaaca.Ipaaca$PayloadItem$Builder" start="1" end="1" startBytecode="0" endBytecode="36" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
</BugInstance>
<BugInstance type="OS_OPEN_STREAM" priority="2" abbrev="OS" category="BAD_PRACTICE">
<Class classname="ipaaca.JavaPythonTest">
<SourceLine classname="ipaaca.JavaPythonTest" start="18" end="186" sourcefile="JavaPythonTest.java" sourcepath="ipaaca/JavaPythonTest.java"/>
</Class>
<Method classname="ipaaca.JavaPythonTest" name="printRuntimeErrors" signature="(Ljava/lang/Process;)V" isStatic="false">
<SourceLine classname="ipaaca.JavaPythonTest" start="43" end="75" startBytecode="0" endBytecode="72" sourcefile="JavaPythonTest.java" sourcepath="ipaaca/JavaPythonTest.java"/>
</Method>
<Type descriptor="Ljava/io/Reader;" role="TYPE_CLOSEIT">
<SourceLine classname="java.io.Reader" start="49" end="232" sourcefile="Reader.java" sourcepath="java/io/Reader.java"/>
</Type>
<SourceLine classname="ipaaca.JavaPythonTest" start="46" end="46" startBytecode="24" endBytecode="24" sourcefile="JavaPythonTest.java" sourcepath="ipaaca/JavaPythonTest.java"/>
<SourceLine classname="ipaaca.JavaPythonTest" start="69" end="69" startBytecode="126" endBytecode="126" sourcefile="JavaPythonTest.java" sourcepath="ipaaca/JavaPythonTest.java" role="SOURCE_LINE_ANOTHER_INSTANCE"/>
</BugInstance>
<BugInstance type="NP_NULL_PARAM_DEREF" priority="2" abbrev="NP" category="CORRECTNESS">
<Class classname="ipaaca.LocalIU">
<SourceLine classname="ipaaca.LocalIU" start="23" end="250" sourcefile="LocalIU.java" sourcepath="ipaaca/LocalIU.java"/>
</Class>
<Method classname="ipaaca.LocalIU" name="modifyLinks" signature="(ZLcom/google/common/collect/SetMultimap;Lcom/google/common/collect/SetMultimap;Ljava/lang/String;)V" isStatic="false">
<SourceLine classname="ipaaca.LocalIU" start="112" end="154" startBytecode="0" endBytecode="771" sourcefile="LocalIU.java" sourcepath="ipaaca/LocalIU.java"/>
</Method>
<Method classname="ipaaca.Ipaaca$IULinkUpdate$Builder" name="setWriterName" signature="(Ljava/lang/String;)Lipaaca/Ipaaca$IULinkUpdate$Builder;" isStatic="false" role="METHOD_CALLED">
<SourceLine classname="ipaaca.Ipaaca$IULinkUpdate$Builder" start="6201" end="6207" startBytecode="0" endBytecode="114" sourcefile="Ipaaca.java" sourcepath="ipaaca/Ipaaca.java"/>
</Method>
<Int value="1" role="INT_MAYBE_NULL_ARG"/>
<LocalVariable name="?" register="-1" pc="281" role="LOCAL_VARIABLE_UNKNOWN"/>
<SourceLine classname="ipaaca.LocalIU" start="147" end="147" startBytecode="281" endBytecode="281" sourcefile="LocalIU.java" sourcepath="ipaaca/LocalIU.java" role="SOURCE_LINE_INVOKED"/>
<SourceLine classname="ipaaca.LocalIU" start="132" end="132" startBytecode="71" endBytecode="71" sourcefile="LocalIU.java" sourcepath="ipaaca/LocalIU.java" role="SOURCE_LINE_KNOWN_NULL"/>
<Property name="edu.umd.cs.findbugs.detect.NullDerefProperty.LONG_RANGE_NULL_SOURCE" value="true"/>
</BugInstance>
<BugInstance type="SBSC_USE_STRINGBUFFER_CONCATENATION" priority="2" abbrev="SBSC" category="PERFORMANCE">
<Class classname="ipaacademo.TextPrinter$UpdateThread">
<SourceLine classname="ipaacademo.TextPrinter$UpdateThread" start="52" end="101" sourcefile="TextPrinter.java" sourcepath="ipaacademo/TextPrinter.java"/>
</Class>
<Method classname="ipaacademo.TextPrinter$UpdateThread" name="run" signature="()V" isStatic="false">
<SourceLine classname="ipaacademo.TextPrinter$UpdateThread" start="61" end="62" startBytecode="0" endBytecode="559" sourcefile="TextPrinter.java" sourcepath="ipaacademo/TextPrinter.java"/>
</Method>
<SourceLine classname="ipaacademo.TextPrinter$UpdateThread" start="82" end="82" startBytecode="101" endBytecode="101" sourcefile="TextPrinter.java" sourcepath="ipaacademo/TextPrinter.java"/>
</BugInstance>
<Errors errors="0" missingClasses="72">
<MissingClass>com.google.common.collect.HashMultimap</MissingClass>
<MissingClass>com.google.common.collect.ImmutableMap</MissingClass>
<MissingClass>com.google.common.collect.ImmutableSet</MissingClass>
<MissingClass>com.google.common.collect.ImmutableSet$Builder</MissingClass>
<MissingClass>com.google.common.collect.Multimap</MissingClass>
<MissingClass>com.google.common.collect.SetMultimap</MissingClass>
<MissingClass>com.google.protobuf.AbstractMessage</MissingClass>
<MissingClass>com.google.protobuf.AbstractMessage$Builder</MissingClass>
<MissingClass>com.google.protobuf.ByteString</MissingClass>
<MissingClass>com.google.protobuf.CodedInputStream</MissingClass>
<MissingClass>com.google.protobuf.CodedOutputStream</MissingClass>
<MissingClass>com.google.protobuf.Descriptors</MissingClass>
<MissingClass>com.google.protobuf.Descriptors$Descriptor</MissingClass>
<MissingClass>com.google.protobuf.Descriptors$EnumDescriptor</MissingClass>
<MissingClass>com.google.protobuf.Descriptors$EnumValueDescriptor</MissingClass>
<MissingClass>com.google.protobuf.Descriptors$FileDescriptor</MissingClass>
<MissingClass>com.google.protobuf.Descriptors$FileDescriptor$InternalDescriptorAssigner</MissingClass>
<MissingClass>com.google.protobuf.ExtensionRegistryLite</MissingClass>
<MissingClass>com.google.protobuf.GeneratedMessage</MissingClass>
<MissingClass>com.google.protobuf.GeneratedMessage$Builder</MissingClass>
<MissingClass>com.google.protobuf.GeneratedMessage$BuilderParent</MissingClass>
<MissingClass>com.google.protobuf.GeneratedMessage$FieldAccessorTable</MissingClass>
<MissingClass>com.google.protobuf.Internal</MissingClass>
<MissingClass>com.google.protobuf.Internal$EnumLite</MissingClass>
<MissingClass>com.google.protobuf.Internal$EnumLiteMap</MissingClass>
<MissingClass>com.google.protobuf.InvalidProtocolBufferException</MissingClass>
<MissingClass>com.google.protobuf.LazyStringArrayList</MissingClass>
<MissingClass>com.google.protobuf.LazyStringList</MissingClass>
<MissingClass>com.google.protobuf.Message</MissingClass>
<MissingClass>com.google.protobuf.Message$Builder</MissingClass>
<MissingClass>com.google.protobuf.MessageLite</MissingClass>
<MissingClass>com.google.protobuf.MessageLite$Builder</MissingClass>
<MissingClass>com.google.protobuf.MessageOrBuilder</MissingClass>
<MissingClass>com.google.protobuf.ProtocolMessageEnum</MissingClass>
<MissingClass>com.google.protobuf.RepeatedFieldBuilder</MissingClass>
<MissingClass>com.google.protobuf.UninitializedMessageException</MissingClass>
<MissingClass>com.google.protobuf.UnknownFieldSet</MissingClass>
<MissingClass>com.google.protobuf.UnknownFieldSet$Builder</MissingClass>
<MissingClass>com.google.protobuf.UnmodifiableLazyStringList</MissingClass>
<MissingClass>org.hamcrest.Matcher</MissingClass>
<MissingClass>org.hamcrest.MatcherAssert</MissingClass>
<MissingClass>org.hamcrest.Matchers</MissingClass>
<MissingClass>org.hamcrest.collection.IsIterableContainingInAnyOrder</MissingClass>
<MissingClass>org.junit.After</MissingClass>
<MissingClass>org.junit.Assert</MissingClass>
<MissingClass>org.junit.Before</MissingClass>
<MissingClass>org.junit.Test</MissingClass>
<MissingClass>org.mockito.Matchers</MissingClass>
<MissingClass>org.mockito.Mockito</MissingClass>
<MissingClass>org.mockito.stubbing.OngoingStubbing</MissingClass>
<MissingClass>org.mockito.verification.VerificationMode</MissingClass>
<MissingClass>org.slf4j.Logger</MissingClass>
<MissingClass>org.slf4j.LoggerFactory</MissingClass>
<MissingClass>rsb.Event</MissingClass>
<MissingClass>rsb.Factory</MissingClass>
<MissingClass>rsb.Handler</MissingClass>
<MissingClass>rsb.Informer</MissingClass>
<MissingClass>rsb.InitializeException</MissingClass>
<MissingClass>rsb.Listener</MissingClass>
<MissingClass>rsb.RSBException</MissingClass>
<MissingClass>rsb.Scope</MissingClass>
<MissingClass>rsb.converter.ConversionException</MissingClass>
<MissingClass>rsb.converter.Converter</MissingClass>
<MissingClass>rsb.converter.ConverterRepository</MissingClass>
<MissingClass>rsb.converter.ConverterSignature</MissingClass>
<MissingClass>rsb.converter.DefaultConverterRepository</MissingClass>
<MissingClass>rsb.converter.ProtocolBufferConverter</MissingClass>
<MissingClass>rsb.converter.UserData</MissingClass>
<MissingClass>rsb.converter.WireContents</MissingClass>
<MissingClass>rsb.patterns.DataCallback</MissingClass>
<MissingClass>rsb.patterns.LocalServer</MissingClass>
<MissingClass>rsb.patterns.RemoteServer</MissingClass>
</Errors>
<FindBugsSummary timestamp="Thu, 8 Mar 2012 17:39:16 +0100" total_classes="64" referenced_classes="159" total_bugs="11" total_size="6091" num_packages="2" vm_version="19.1-b02" cpu_seconds="25.20" clock_seconds="8.59" peak_mbytes="216.40" alloc_mbytes="455.12" gc_seconds="0.50" priority_2="3" priority_1="8">
<PackageStats package="ipaaca" total_bugs="10" total_types="61" total_size="6002" priority_2="2" priority_1="8">
<ClassStats class="ipaaca.AbstractIU" sourceFile="AbstractIU.java" interface="false" size="115" bugs="0"/>
<ClassStats class="ipaaca.Buffer" sourceFile="Buffer.java" interface="false" size="24" bugs="0"/>
<ClassStats class="ipaaca.ComponentCommunicationIntegrationTest" sourceFile="ComponentCommunicationIntegrationTest.java" interface="false" size="205" bugs="0"/>
<ClassStats class="ipaaca.ComponentCommunicationIntegrationTest$MyEventHandler" sourceFile="ComponentCommunicationIntegrationTest.java" interface="false" size="37" bugs="0"/>
<ClassStats class="ipaaca.HandlerFunctor" sourceFile="HandlerFunctor.java" interface="true" size="2" bugs="0"/>
<ClassStats class="ipaaca.IUAccessMode" sourceFile="IUAccessMode.java" interface="false" size="12" bugs="0"/>
<ClassStats class="ipaaca.IUCommittedException" sourceFile="IUCommittedException.java" interface="false" size="9" bugs="0"/>
<ClassStats class="ipaaca.IUConverter" sourceFile="IUConverter.java" interface="false" size="53" bugs="0"/>
<ClassStats class="ipaaca.IUEventHandler" sourceFile="IUEventHandler.java" interface="false" size="17" bugs="0"/>
<ClassStats class="ipaaca.IUEventType" sourceFile="IUEventType.java" interface="false" size="15" bugs="0"/>
<ClassStats class="ipaaca.IUPublishedException" sourceFile="IUPublishedException.java" interface="false" size="9" bugs="0"/>
<ClassStats class="ipaaca.IUReadOnlyException" sourceFile="IUReadOnlyException.java" interface="false" size="9" bugs="0"/>
<ClassStats class="ipaaca.IUStore" sourceFile="IUStore.java" interface="false" size="4" bugs="0"/>
<ClassStats class="ipaaca.IUTestUtil" sourceFile="IUTestUtil.java" interface="false" size="48" bugs="0"/>
<ClassStats class="ipaaca.IUUpdateFailedException" sourceFile="IUUpdateFailedException.java" interface="false" size="9" bugs="0"/>
<ClassStats class="ipaaca.Info" sourceFile="Info.java" interface="false" size="58" bugs="0"/>
<ClassStats class="ipaaca.Initializer" sourceFile="Initializer.java" interface="false" size="16" bugs="0"/>
<ClassStats class="ipaaca.InputBuffer" sourceFile="InputBuffer.java" interface="false" size="99" bugs="0"/>
<ClassStats class="ipaaca.InputBuffer$InputHandler" sourceFile="InputBuffer.java" interface="false" size="7" bugs="0"/>
<ClassStats class="ipaaca.InputBufferTest" sourceFile="InputBufferTest.java" interface="false" size="29" bugs="0"/>
<ClassStats class="ipaaca.IntConverter" sourceFile="IntConverter.java" interface="false" size="18" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca" sourceFile="Ipaaca.java" interface="false" size="85" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$1" sourceFile="Ipaaca.java" interface="false" size="71" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IU" sourceFile="Ipaaca.java" interface="false" size="349" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IU$AccessMode" sourceFile="Ipaaca.java" interface="false" size="50" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IU$AccessMode$1" sourceFile="Ipaaca.java" interface="false" size="7" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IU$Builder" sourceFile="Ipaaca.java" interface="false" size="676" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IUCommission" sourceFile="Ipaaca.java" interface="false" size="182" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IUCommission$Builder" sourceFile="Ipaaca.java" interface="false" size="202" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IUCommissionOrBuilder" sourceFile="Ipaaca.java" interface="true" size="7" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IULinkUpdate" sourceFile="Ipaaca.java" interface="false" size="249" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IULinkUpdate$Builder" sourceFile="Ipaaca.java" interface="false" size="535" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IULinkUpdateOrBuilder" sourceFile="Ipaaca.java" interface="true" size="19" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IUOrBuilder" sourceFile="Ipaaca.java" interface="true" size="27" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IUPayloadUpdate" sourceFile="Ipaaca.java" interface="false" size="244" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IUPayloadUpdate$Builder" sourceFile="Ipaaca.java" interface="false" size="441" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IUPayloadUpdateOrBuilder" sourceFile="Ipaaca.java" interface="true" size="17" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IURetraction" sourceFile="Ipaaca.java" interface="false" size="149" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IURetraction$Builder" sourceFile="Ipaaca.java" interface="false" size="162" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IURetractionOrBuilder" sourceFile="Ipaaca.java" interface="true" size="5" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IntMessage" sourceFile="Ipaaca.java" interface="false" size="116" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$IntMessage$Builder" sourceFile="Ipaaca.java" interface="false" size="122" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$IntMessageOrBuilder" sourceFile="Ipaaca.java" interface="true" size="3" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$LinkSet" sourceFile="Ipaaca.java" interface="false" size="152" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$LinkSet$Builder" sourceFile="Ipaaca.java" interface="false" size="194" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$LinkSetOrBuilder" sourceFile="Ipaaca.java" interface="true" size="6" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$PayloadItem" sourceFile="Ipaaca.java" interface="false" size="198" bugs="0"/>
<ClassStats class="ipaaca.Ipaaca$PayloadItem$Builder" sourceFile="Ipaaca.java" interface="false" size="215" bugs="1" priority_1="1"/>
<ClassStats class="ipaaca.Ipaaca$PayloadItemOrBuilder" sourceFile="Ipaaca.java" interface="true" size="7" bugs="0"/>
<ClassStats class="ipaaca.IuConverterTest" sourceFile="IuConverterTest.java" interface="false" size="69" bugs="0"/>
<ClassStats class="ipaaca.JavaPythonTest" sourceFile="JavaPythonTest.java" interface="false" size="81" bugs="1" priority_2="1"/>
<ClassStats class="ipaaca.LinkUpdateConverter" sourceFile="LinkUpdateConverter.java" interface="false" size="16" bugs="0"/>
<ClassStats class="ipaaca.LocalIU" sourceFile="LocalIU.java" interface="false" size="113" bugs="1" priority_2="1"/>
<ClassStats class="ipaaca.LocalIUTest" sourceFile="LocalIUTest.java" interface="false" size="29" bugs="0"/>
<ClassStats class="ipaaca.OutputBuffer" sourceFile="OutputBuffer.java" interface="false" size="140" bugs="0"/>
<ClassStats class="ipaaca.OutputBuffer$RemoteCommit" sourceFile="OutputBuffer.java" interface="false" size="10" bugs="0"/>
<ClassStats class="ipaaca.OutputBuffer$RemoteUpdateLinks" sourceFile="OutputBuffer.java" interface="false" size="10" bugs="0"/>
<ClassStats class="ipaaca.OutputBuffer$RemoteUpdatePayload" sourceFile="OutputBuffer.java" interface="false" size="10" bugs="0"/>
<ClassStats class="ipaaca.Payload" sourceFile="Payload.java" interface="false" size="79" bugs="0"/>
<ClassStats class="ipaaca.PayloadConverter" sourceFile="PayloadConverter.java" interface="false" size="16" bugs="0"/>
<ClassStats class="ipaaca.RemotePushIU" sourceFile="RemotePushIU.java" interface="false" size="144" bugs="0"/>
</PackageStats>
<PackageStats package="ipaacademo" total_bugs="1" total_types="3" total_size="89" priority_2="1">
<ClassStats class="ipaacademo.PythonCall" sourceFile="PythonCall.java" interface="false" size="23" bugs="0"/>
<ClassStats class="ipaacademo.TextPrinter" sourceFile="TextPrinter.java" interface="false" size="37" bugs="0"/>
<ClassStats class="ipaacademo.TextPrinter$UpdateThread" sourceFile="TextPrinter.java" interface="false" size="29" bugs="1" priority_2="1"/>
</PackageStats>
<FindBugsProfile>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindUncalledPrivateMethods" totalMilliseconds="11" invocations="64" avgMicrosecondsPerInvocation="175" maxMicrosecondsPerInvocation="1115" standardDeviationMircosecondsPerInvocation="219"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ConstantPoolGenFactory" totalMilliseconds="12" invocations="64" avgMicrosecondsPerInvocation="187" maxMicrosecondsPerInvocation="3262" standardDeviationMircosecondsPerInvocation="403"/>
<ClassProfile name="edu.umd.cs.findbugs.util.TopologicalSort" totalMilliseconds="12" invocations="65" avgMicrosecondsPerInvocation="190" maxMicrosecondsPerInvocation="2175" standardDeviationMircosecondsPerInvocation="315"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.SerializableIdiom" totalMilliseconds="12" invocations="64" avgMicrosecondsPerInvocation="193" maxMicrosecondsPerInvocation="1797" standardDeviationMircosecondsPerInvocation="249"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.LoadedFieldSetFactory" totalMilliseconds="13" invocations="1268" avgMicrosecondsPerInvocation="10" maxMicrosecondsPerInvocation="431" standardDeviationMircosecondsPerInvocation="18"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindUnsatisfiedObligation" totalMilliseconds="13" invocations="64" avgMicrosecondsPerInvocation="211" maxMicrosecondsPerInvocation="2332" standardDeviationMircosecondsPerInvocation="428"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindSelfComparison2" totalMilliseconds="13" invocations="64" avgMicrosecondsPerInvocation="217" maxMicrosecondsPerInvocation="1786" standardDeviationMircosecondsPerInvocation="321"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindReturnRef" totalMilliseconds="15" invocations="64" avgMicrosecondsPerInvocation="247" maxMicrosecondsPerInvocation="1829" standardDeviationMircosecondsPerInvocation="350"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.AppendingToAnObjectOutputStream" totalMilliseconds="16" invocations="64" avgMicrosecondsPerInvocation="251" maxMicrosecondsPerInvocation="1707" standardDeviationMircosecondsPerInvocation="326"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.NumberConstructor" totalMilliseconds="16" invocations="64" avgMicrosecondsPerInvocation="252" maxMicrosecondsPerInvocation="1655" standardDeviationMircosecondsPerInvocation="317"/>
<ClassProfile name="edu.umd.cs.findbugs.NonReportingDetectorToDetector2Adapter" totalMilliseconds="16" invocations="2195" avgMicrosecondsPerInvocation="7" maxMicrosecondsPerInvocation="56" standardDeviationMircosecondsPerInvocation="2"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindFloatEquality" totalMilliseconds="16" invocations="64" avgMicrosecondsPerInvocation="256" maxMicrosecondsPerInvocation="1695" standardDeviationMircosecondsPerInvocation="322"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindFieldSelfAssignment" totalMilliseconds="16" invocations="64" avgMicrosecondsPerInvocation="259" maxMicrosecondsPerInvocation="1684" standardDeviationMircosecondsPerInvocation="330"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ReverseDepthFirstSearchFactory" totalMilliseconds="16" invocations="1123" avgMicrosecondsPerInvocation="14" maxMicrosecondsPerInvocation="536" standardDeviationMircosecondsPerInvocation="26"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.SynchronizingOnContentsOfFieldToProtectField" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="269" maxMicrosecondsPerInvocation="1713" standardDeviationMircosecondsPerInvocation="341"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.BadResultSetAccess" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="271" maxMicrosecondsPerInvocation="1683" standardDeviationMircosecondsPerInvocation="330"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.SynchronizationOnSharedBuiltinConstant" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="275" maxMicrosecondsPerInvocation="1738" standardDeviationMircosecondsPerInvocation="336"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FormatStringChecker" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="278" maxMicrosecondsPerInvocation="1765" standardDeviationMircosecondsPerInvocation="355"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="278" maxMicrosecondsPerInvocation="1929" standardDeviationMircosecondsPerInvocation="409"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.BadSyntaxForRegularExpression" totalMilliseconds="17" invocations="64" avgMicrosecondsPerInvocation="280" maxMicrosecondsPerInvocation="1826" standardDeviationMircosecondsPerInvocation="358"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.CrossSiteScripting" totalMilliseconds="18" invocations="64" avgMicrosecondsPerInvocation="284" maxMicrosecondsPerInvocation="1873" standardDeviationMircosecondsPerInvocation="361"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ObligationDataflowFactory" totalMilliseconds="18" invocations="447" avgMicrosecondsPerInvocation="41" maxMicrosecondsPerInvocation="3665" standardDeviationMircosecondsPerInvocation="173"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindBadForLoop" totalMilliseconds="18" invocations="64" avgMicrosecondsPerInvocation="293" maxMicrosecondsPerInvocation="1830" standardDeviationMircosecondsPerInvocation="371"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.DumbMethodInvocations" totalMilliseconds="18" invocations="64" avgMicrosecondsPerInvocation="294" maxMicrosecondsPerInvocation="2837" standardDeviationMircosecondsPerInvocation="500"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.InfiniteRecursiveLoop" totalMilliseconds="19" invocations="64" avgMicrosecondsPerInvocation="298" maxMicrosecondsPerInvocation="1836" standardDeviationMircosecondsPerInvocation="390"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.LostLoggerDueToWeakReference" totalMilliseconds="19" invocations="64" avgMicrosecondsPerInvocation="309" maxMicrosecondsPerInvocation="1930" standardDeviationMircosecondsPerInvocation="394"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.DepthFirstSearchFactory" totalMilliseconds="20" invocations="1520" avgMicrosecondsPerInvocation="13" maxMicrosecondsPerInvocation="553" standardDeviationMircosecondsPerInvocation="23"/>
<ClassProfile name="edu.umd.cs.findbugs.DetectorToDetector2Adapter" totalMilliseconds="20" invocations="7135" avgMicrosecondsPerInvocation="2" maxMicrosecondsPerInvocation="64" standardDeviationMircosecondsPerInvocation="2"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindUnrelatedTypesInGenericContainer" totalMilliseconds="20" invocations="64" avgMicrosecondsPerInvocation="326" maxMicrosecondsPerInvocation="2813" standardDeviationMircosecondsPerInvocation="505"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindNonShortCircuit" totalMilliseconds="21" invocations="64" avgMicrosecondsPerInvocation="328" maxMicrosecondsPerInvocation="2172" standardDeviationMircosecondsPerInvocation="430"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.StreamResourceTracker" totalMilliseconds="21" invocations="21" avgMicrosecondsPerInvocation="1008" maxMicrosecondsPerInvocation="1622" standardDeviationMircosecondsPerInvocation="187"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindHEmismatch" totalMilliseconds="23" invocations="64" avgMicrosecondsPerInvocation="362" maxMicrosecondsPerInvocation="3891" standardDeviationMircosecondsPerInvocation="557"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.MethodReturnCheck" totalMilliseconds="23" invocations="64" avgMicrosecondsPerInvocation="368" maxMicrosecondsPerInvocation="2568" standardDeviationMircosecondsPerInvocation="482"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.InfiniteLoop" totalMilliseconds="23" invocations="64" avgMicrosecondsPerInvocation="371" maxMicrosecondsPerInvocation="2247" standardDeviationMircosecondsPerInvocation="481"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.RepeatedConditionals" totalMilliseconds="24" invocations="64" avgMicrosecondsPerInvocation="378" maxMicrosecondsPerInvocation="2526" standardDeviationMircosecondsPerInvocation="501"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindBadCast2" totalMilliseconds="25" invocations="64" avgMicrosecondsPerInvocation="393" maxMicrosecondsPerInvocation="2348" standardDeviationMircosecondsPerInvocation="542"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.impl.ZipCodeBaseFactory" totalMilliseconds="25" invocations="14" avgMicrosecondsPerInvocation="1806" maxMicrosecondsPerInvocation="23482" standardDeviationMircosecondsPerInvocation="6013"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.RuntimeExceptionCapture" totalMilliseconds="27" invocations="64" avgMicrosecondsPerInvocation="424" maxMicrosecondsPerInvocation="2570" standardDeviationMircosecondsPerInvocation="532"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindSelfComparison" totalMilliseconds="27" invocations="64" avgMicrosecondsPerInvocation="431" maxMicrosecondsPerInvocation="2891" standardDeviationMircosecondsPerInvocation="585"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.DuplicateBranches" totalMilliseconds="28" invocations="64" avgMicrosecondsPerInvocation="444" maxMicrosecondsPerInvocation="5597" standardDeviationMircosecondsPerInvocation="1014"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindSqlInjection" totalMilliseconds="28" invocations="64" avgMicrosecondsPerInvocation="444" maxMicrosecondsPerInvocation="3234" standardDeviationMircosecondsPerInvocation="600"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindPuzzlers" totalMilliseconds="32" invocations="64" avgMicrosecondsPerInvocation="503" maxMicrosecondsPerInvocation="3050" standardDeviationMircosecondsPerInvocation="647"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindDeadLocalStores" totalMilliseconds="35" invocations="64" avgMicrosecondsPerInvocation="551" maxMicrosecondsPerInvocation="3275" standardDeviationMircosecondsPerInvocation="698"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindNullDeref" totalMilliseconds="36" invocations="64" avgMicrosecondsPerInvocation="566" maxMicrosecondsPerInvocation="4243" standardDeviationMircosecondsPerInvocation="876"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.ReflectiveClasses" totalMilliseconds="36" invocations="159" avgMicrosecondsPerInvocation="229" maxMicrosecondsPerInvocation="5220" standardDeviationMircosecondsPerInvocation="583"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.UnreadFields" totalMilliseconds="43" invocations="64" avgMicrosecondsPerInvocation="676" maxMicrosecondsPerInvocation="4082" standardDeviationMircosecondsPerInvocation="868"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.DumbMethods" totalMilliseconds="47" invocations="64" avgMicrosecondsPerInvocation="734" maxMicrosecondsPerInvocation="4420" standardDeviationMircosecondsPerInvocation="944"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindNullDeref$CheckCallSitesAndReturnInstructions" totalMilliseconds="50" invocations="1065" avgMicrosecondsPerInvocation="46" maxMicrosecondsPerInvocation="1213" standardDeviationMircosecondsPerInvocation="84"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindRefComparison" totalMilliseconds="50" invocations="64" avgMicrosecondsPerInvocation="787" maxMicrosecondsPerInvocation="6427" standardDeviationMircosecondsPerInvocation="1137"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.SwitchFallthrough" totalMilliseconds="54" invocations="64" avgMicrosecondsPerInvocation="854" maxMicrosecondsPerInvocation="20855" standardDeviationMircosecondsPerInvocation="2625"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.NoteNonnullReturnValues" totalMilliseconds="55" invocations="64" avgMicrosecondsPerInvocation="870" maxMicrosecondsPerInvocation="5691" standardDeviationMircosecondsPerInvocation="1289"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.LoadOfKnownNullValue" totalMilliseconds="59" invocations="64" avgMicrosecondsPerInvocation="923" maxMicrosecondsPerInvocation="9619" standardDeviationMircosecondsPerInvocation="1598"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.EqualsOperandShouldHaveClassCompatibleWithThis" totalMilliseconds="64" invocations="159" avgMicrosecondsPerInvocation="407" maxMicrosecondsPerInvocation="3116" standardDeviationMircosecondsPerInvocation="582"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine" totalMilliseconds="65" invocations="821" avgMicrosecondsPerInvocation="79" maxMicrosecondsPerInvocation="679" standardDeviationMircosecondsPerInvocation="70"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindInconsistentSync2" totalMilliseconds="71" invocations="64" avgMicrosecondsPerInvocation="1109" maxMicrosecondsPerInvocation="10523" standardDeviationMircosecondsPerInvocation="1891"/>
<ClassProfile name="edu.umd.cs.findbugs.ba.npe.TypeQualifierNullnessAnnotationDatabase" totalMilliseconds="81" invocations="15796" avgMicrosecondsPerInvocation="5" maxMicrosecondsPerInvocation="2014" standardDeviationMircosecondsPerInvocation="20"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.CalledMethods" totalMilliseconds="82" invocations="159" avgMicrosecondsPerInvocation="521" maxMicrosecondsPerInvocation="7484" standardDeviationMircosecondsPerInvocation="1035"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngine" totalMilliseconds="84" invocations="217" avgMicrosecondsPerInvocation="391" maxMicrosecondsPerInvocation="13488" standardDeviationMircosecondsPerInvocation="1185"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.BuildObligationPolicyDatabase" totalMilliseconds="87" invocations="159" avgMicrosecondsPerInvocation="549" maxMicrosecondsPerInvocation="7707" standardDeviationMircosecondsPerInvocation="891"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.LiveLocalStoreDataflowFactory" totalMilliseconds="118" invocations="937" avgMicrosecondsPerInvocation="126" maxMicrosecondsPerInvocation="1817" standardDeviationMircosecondsPerInvocation="195"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.OverridingEqualsNotSymmetrical" totalMilliseconds="123" invocations="159" avgMicrosecondsPerInvocation="778" maxMicrosecondsPerInvocation="8332" standardDeviationMircosecondsPerInvocation="1247"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindOpenStream" totalMilliseconds="149" invocations="64" avgMicrosecondsPerInvocation="2330" maxMicrosecondsPerInvocation="20396" standardDeviationMircosecondsPerInvocation="4456"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.NoteDirectlyRelevantTypeQualifiers" totalMilliseconds="160" invocations="159" avgMicrosecondsPerInvocation="1010" maxMicrosecondsPerInvocation="15855" standardDeviationMircosecondsPerInvocation="2000"/>
<ClassProfile name="edu.umd.cs.findbugs.ba.obl.ObligationAnalysis" totalMilliseconds="164" invocations="447" avgMicrosecondsPerInvocation="369" maxMicrosecondsPerInvocation="6575" standardDeviationMircosecondsPerInvocation="639"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ConstantDataflowFactory" totalMilliseconds="185" invocations="1268" avgMicrosecondsPerInvocation="146" maxMicrosecondsPerInvocation="2776" standardDeviationMircosecondsPerInvocation="244"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.MethodGenFactory" totalMilliseconds="189" invocations="1360" avgMicrosecondsPerInvocation="139" maxMicrosecondsPerInvocation="30907" standardDeviationMircosecondsPerInvocation="856"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindNullDerefsInvolvingNonShortCircuitEvaluation" totalMilliseconds="193" invocations="64" avgMicrosecondsPerInvocation="3028" maxMicrosecondsPerInvocation="178315" standardDeviationMircosecondsPerInvocation="22086"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.URLProblems" totalMilliseconds="224" invocations="64" avgMicrosecondsPerInvocation="3503" maxMicrosecondsPerInvocation="174969" standardDeviationMircosecondsPerInvocation="21632"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory" totalMilliseconds="255" invocations="1268" avgMicrosecondsPerInvocation="201" maxMicrosecondsPerInvocation="9257" standardDeviationMircosecondsPerInvocation="369"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine" totalMilliseconds="258" invocations="819" avgMicrosecondsPerInvocation="315" maxMicrosecondsPerInvocation="11229" standardDeviationMircosecondsPerInvocation="840"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FieldItemSummary" totalMilliseconds="293" invocations="159" avgMicrosecondsPerInvocation="1844" maxMicrosecondsPerInvocation="23120" standardDeviationMircosecondsPerInvocation="3301"/>
<ClassProfile name="edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory" totalMilliseconds="324" invocations="4560" avgMicrosecondsPerInvocation="71" maxMicrosecondsPerInvocation="2589" standardDeviationMircosecondsPerInvocation="131"/>
<ClassProfile name="edu.umd.cs.findbugs.detect.FindRefComparison$SpecialTypeAnalysis" totalMilliseconds="345" invocations="916" avgMicrosecondsPerInvocation="377" maxMicrosecondsPerInvocation="6276" standardDeviationMircosecondsPerInvocation="568"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory" totalMilliseconds="488" invocations="1271" avgMicrosecondsPerInvocation="384" maxMicrosecondsPerInvocation="16954" standardDeviationMircosecondsPerInvocation="759"/>
<ClassProfile name="edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder" totalMilliseconds="496" invocations="1065" avgMicrosecondsPerInvocation="466" maxMicrosecondsPerInvocation="37192" standardDeviationMircosecondsPerInvocation="1442"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory" totalMilliseconds="562" invocations="1523" avgMicrosecondsPerInvocation="369" maxMicrosecondsPerInvocation="10377" standardDeviationMircosecondsPerInvocation="684"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.IsNullValueDataflowFactory" totalMilliseconds="573" invocations="1268" avgMicrosecondsPerInvocation="452" maxMicrosecondsPerInvocation="10290" standardDeviationMircosecondsPerInvocation="809"/>
<ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.UnconditionalValueDerefDataflowFactory" totalMilliseconds="659" invocations="1123" avgMicrosecondsPerInvocation="586" maxMicrosecondsPerInvocation="40507" standardDeviationMircosecondsPerInvocation="1915"/>
</FindBugsProfile>
</FindBugsSummary>
<ClassFeatures></ClassFeatures>
<History></History>
</BugCollection>
<ivy-module version="2.0">
<info organisation="HMI" module="HmiAnimationDemoTest"/>
<info organisation="ipaaca" module="IpaacaTest"/>
<dependencies >
<dependency org="junit" name="junit" rev="latest.release" />
<dependency org="hamcrest" name="hamcrest-all" rev="latest.release" />
<dependency org="mockito" name="mockito-all" rev="latest.release" />
<dependency org="jboss" name="javassist" rev="latest.release" />
<dependency org="powermock" name="powermock-mockito" rev="latest.release" />
<dependency org="logback" name="logback-classic" rev="latest.release" />
<dependency org="logback" name="logback-core" rev="latest.release" />
</dependencies>
</ivy-module>
package ipaaca;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.EnumSet;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test communication of the 'MESSAGE' type between IUs
* @author hvanwelbergen
*
*/
public class ComponentMessageCommunicationIntegrationTest
{
@BeforeClass
public static void setupStatic()
{
Initializer.initializeIpaacaRsb();
}
private OutputBuffer outBuffer;
private InputBuffer inBuffer;
private LocalMessageIU localIU;
private CountingEventHandler component1EventHandler;
private CountingEventHandler component2EventHandler;
private StoringEventHandler component1StoreHandler = new StoringEventHandler();
private StoringEventHandler component2StoreHandler = new StoringEventHandler();
private static final String CATEGORY = "category1";
@Before
public void setup()
{
outBuffer = new OutputBuffer("component1");
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
inBuffer = new InputBuffer("component2", categories);
EnumSet<IUEventType> types = EnumSet.of(IUEventType.ADDED, IUEventType.COMMITTED, IUEventType.UPDATED, IUEventType.MESSAGE);
component2EventHandler = new CountingEventHandler();
component1EventHandler = new CountingEventHandler();
inBuffer.registerHandler(new IUEventHandler(component2EventHandler, types, categories));
outBuffer.registerHandler(new IUEventHandler(component1EventHandler, types, categories));
inBuffer.registerHandler(new IUEventHandler(component2StoreHandler, types, categories));
outBuffer.registerHandler(new IUEventHandler(component1StoreHandler, types, categories));
localIU = new LocalMessageIU();
localIU.setCategory(CATEGORY);
localIU.getPayload().put("key1", "item1");
localIU.addLinks("INIT", ImmutableSet.of("init1", "init2"));
}
@After
public void tearDown()
{
inBuffer.close();
outBuffer.close();
}
@Test
public void testAddedIU() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertNull(iuIn);
assertThat(localIU.getLinks("INIT"), containsInAnyOrder("init1", "init2"));
assertEquals(1, component2EventHandler.getNumberOfMessageEvents(localIU.getUid()));
assertEquals(0, component1EventHandler.getNumberOfMessageEvents(localIU.getUid()));
assertEquals(1, component2EventHandler.getNumberOfMessageEvents(localIU.getUid()));
assertEquals(0, component1EventHandler.getNumberOfMessageEvents(localIU.getUid()));
assertEquals(localIU.getUid(), component2StoreHandler.getMessageIUs().get(0).getUid());
}
@Test
public void testIUCommit() throws InterruptedException
{
outBuffer.add(localIU);
localIU.commit();
Thread.sleep(200);
assertEquals(0, component1EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertEquals(0, component2EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertFalse(component2StoreHandler.getMessageIUs().get(0).isCommitted());
}
@Test
public void testIUCommitBeforePublish() throws InterruptedException
{
localIU.commit();
outBuffer.add(localIU);
Thread.sleep(200);
assertEquals(0, component1EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertEquals(0, component2EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertTrue(component2StoreHandler.getMessageIUs().get(0).isCommitted());
}
@Test
public void testIUCommitFromInputBuffer() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = component2StoreHandler.getMessageIUs().get(0);
iuIn.commit();
Thread.sleep(200);
assertFalse(localIU.isCommitted());
assertEquals(0, component1EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertEquals(0, component2EventHandler.getNumberOfCommitEvents(localIU.getUid()));
}
@Test
public void testIUUpdate() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = component2StoreHandler.getMessageIUs().get(0);
assertNull(iuIn.getPayload().get("key2"));
localIU.getPayload().put("key2", "value2");
Thread.sleep(200);
assertEquals(null, iuIn.getPayload().get("key2"));
assertEquals(0, component2EventHandler.getNumberOfUpdateEvents(localIU.getUid()));
assertEquals(0, component1EventHandler.getNumberOfUpdateEvents(localIU.getUid()));
}
@Test
public void testIUUpdateBeforePublish() throws InterruptedException
{
localIU.getPayload().put("key2", "value2");
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = component2StoreHandler.getMessageIUs().get(0);
assertEquals("value2", iuIn.getPayload().get("key2"));
}
private void fillBuffer(int val)
{
LocalMessageIU iu = new LocalMessageIU();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < 1000000; i++)
{
buffer.append(val);
}
iu.setCategory("");
iu.getPayload().put("x", buffer.toString());
outBuffer.add(iu);
}
@Test
public void testManyMessages()
{
for (int i = 0; i < 1000; i++)
{
fillBuffer(i);
}
}
}
package ipaaca;
import static org.junit.Assert.*;
import static ipaaca.IUTestUtil.assertEqualIU;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.EnumSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.*;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import static ipaaca.IUTestUtil.*;
/**
* Integration test cases for IPAACA.
* Requires a running spread daemon.
* @author hvanwelbergen
*
*/
public class ComponentCommunicationIntegrationTest
public class ComponentPushCommunicationIntegrationTest
{
static
@BeforeClass
public static void setupStatic()
{
Initializer.initializeIpaacaRsb();
}
......@@ -33,66 +38,10 @@ public class ComponentCommunicationIntegrationTest
private OutputBuffer outBuffer;
private InputBuffer inBuffer;
private LocalIU localIU;
private MyEventHandler component1EventHandler;
private MyEventHandler component2EventHandler;
private CountingEventHandler component1EventHandler;
private CountingEventHandler component2EventHandler;
private static final String CATEGORY = "category1";
private static final class MyEventHandler implements HandlerFunctor
{
private Map<String,Integer> commitEvents = new HashMap<String,Integer>();
private Map<String,Integer> addEvents = new HashMap<String,Integer>();
private Map<String,Integer> updateEvents = new HashMap<String,Integer>();
private void updateEventMap(String key, Map<String,Integer> map)
{
int value = 0;
if(map.containsKey(key))
{
value = map.get(key);
}
value++;
map.put(key, value);
}
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
switch(type)
{
case ADDED: updateEventMap(iu.getUid(),addEvents); break;
case COMMITTED: updateEventMap(iu.getUid(),commitEvents); break;
case UPDATED: updateEventMap(iu.getUid(),updateEvents); break;
}
}
public int getNumberOfCommitEvents(String iu)
{
if(!commitEvents.containsKey(iu))
{
return 0;
}
return commitEvents.get(iu);
}
public int getNumberOfAddEvents(String iu)
{
if(!addEvents.containsKey(iu))
{
return 0;
}
return addEvents.get(iu);
}
public int getNumberOfUpdateEvents(String iu)
{
if(!updateEvents.containsKey(iu))
{
return 0;
}
return updateEvents.get(iu);
}
}
@Before
public void setup()
{
......@@ -101,16 +50,15 @@ public class ComponentCommunicationIntegrationTest
Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build();
inBuffer = new InputBuffer("component2", categories);
EnumSet<IUEventType> types = EnumSet.of(IUEventType.ADDED,IUEventType.COMMITTED,IUEventType.UPDATED);
component2EventHandler = new MyEventHandler();
component1EventHandler = new MyEventHandler();
component2EventHandler = new CountingEventHandler();
component1EventHandler = new CountingEventHandler();
inBuffer.registerHandler(new IUEventHandler(component2EventHandler,types,categories));
outBuffer.registerHandler(new IUEventHandler(component1EventHandler,types,categories));
localIU = new LocalIU();
localIU.setCategory(CATEGORY);
localIU.getPayload().put("key1", "item1");
localIU.addLinks("INIT", ImmutableSet.of("init1","init2"));
outBuffer.add(localIU);
localIU.addLinks("INIT", ImmutableSet.of("init1","init2"));
}
@After
......@@ -123,6 +71,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testAddedIU() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertNotNull(iuIn);
......@@ -130,11 +79,12 @@ public class ComponentCommunicationIntegrationTest
assertThat(localIU.getLinks("INIT"),containsInAnyOrder("init1","init2"));
assertEquals(1,component2EventHandler.getNumberOfAddEvents(iuIn.getUid()));
assertEquals(0,component1EventHandler.getNumberOfAddEvents(localIU.getUid()));
}
}
@Test
public void testIUCommit() throws InterruptedException
{
outBuffer.add(localIU);
localIU.commit();
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
......@@ -143,9 +93,22 @@ public class ComponentCommunicationIntegrationTest
assertEquals(1,component2EventHandler.getNumberOfCommitEvents(iuIn.getUid()));
}
@Test
public void testIUCommitBeforePublish() throws InterruptedException
{
localIU.commit();
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertTrue(iuIn.isCommitted());
assertEquals(0,component1EventHandler.getNumberOfCommitEvents(localIU.getUid()));
assertEquals(0,component2EventHandler.getNumberOfCommitEvents(iuIn.getUid()));
}
@Test
public void testIUCommitFromInputBuffer() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
......@@ -160,6 +123,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testIUUpdate() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertNull(iuIn.getPayload().get("key2"));
......@@ -174,6 +138,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testSetPayload() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
......@@ -191,6 +156,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testSetPayloadRemote() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
......@@ -205,9 +171,46 @@ public class ComponentCommunicationIntegrationTest
assertEquals(1,component1EventHandler.getNumberOfUpdateEvents(localIU.getUid()));
}
@Test
public void testSetAllPayload() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
HashMap<String, String> payloadUpdate = new HashMap<String, String>();
payloadUpdate.put("chunk11", "item1");
payloadUpdate.put("chunk12", "item2");
payloadUpdate.put("chunk13", "item3");
payloadUpdate.put("chunk14", "item4");
long oldRev = iuIn.getRevision();
localIU.getPayload().merge(payloadUpdate);
Thread.sleep(200);
assertEquals(oldRev + 1, iuIn.getRevision());
assertTrue(iuIn.getPayload().containsKey("chunk11"));
assertTrue(iuIn.getPayload().containsKey("chunk12"));
assertTrue(iuIn.getPayload().containsKey("chunk13"));
assertTrue(iuIn.getPayload().containsKey("chunk14"));
HashMap<String, String> payloadUpdate2 = new HashMap<String, String>();
payloadUpdate2.put("chunk21", "item5");
payloadUpdate2.put("chunk22", "item6");
payloadUpdate2.put("chunk13", "item3-changed");
payloadUpdate2.put("chunk14", "item4-changed");
long oldRev2 = iuIn.getRevision();
iuIn.getPayload().merge(payloadUpdate2);
Thread.sleep(200);
assertEquals(oldRev2 + 1, localIU.getRevision());
assertTrue(localIU.getPayload().containsKey("chunk21"));
assertTrue(localIU.getPayload().containsKey("chunk22"));
assertEquals("item3-changed", localIU.getPayload().get("chunk13"));
assertEquals("item4-changed", localIU.getPayload().get("chunk14"));
}
@Test
public void testIUUpdateFromInputBuffer() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
......@@ -222,6 +225,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testIUpdateRemove() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertEquals("item1",iuIn.getPayload().get("key1"));
......@@ -236,6 +240,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testIUpdateRemoveFromInputBuffer() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertEquals("item1",iuIn.getPayload().get("key1"));
......@@ -250,6 +255,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testSetLinksLocal() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
localIU.setLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6"));
......@@ -261,6 +267,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testSetLinksRemote() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
iuIn.setLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6"));
......@@ -272,6 +279,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testSetLinksRemoteOverwrite() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
localIU.setLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6"));
......@@ -288,6 +296,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testAddLinksLocal() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
localIU.setLinks("SAME_LEVEL",ImmutableSet.of("iu4"));
......@@ -300,6 +309,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testAddLinksRemote() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
iuIn.addLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6"));
......@@ -311,6 +321,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testRemoveLinksLocal() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
localIU.setLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6","iu7"));
......@@ -323,6 +334,7 @@ public class ComponentCommunicationIntegrationTest
@Test
public void testRemoveLinksRemote() throws InterruptedException
{
outBuffer.add(localIU);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
iuIn.setLinks("SAME_LEVEL",ImmutableSet.of("iu5","iu6","iu7"));
......@@ -331,4 +343,31 @@ public class ComponentCommunicationIntegrationTest
assertThat(localIU.getLinks("SAME_LEVEL"),containsInAnyOrder("iu7"));
assertThat(iuIn.getLinks("SAME_LEVEL"),containsInAnyOrder("iu7"));
}
@Test
public void testPublishLinks() throws InterruptedException
{
LocalIU localIU2 = new LocalIU();
localIU2.setCategory(CATEGORY);
localIU2.getPayload().put("key1", "item2");
localIU.addLinks("SAME_LEVEL", ImmutableSet.of(localIU2.getUid()));
outBuffer.add(localIU);
outBuffer.add(localIU2);
Thread.sleep(200);
assertThat(localIU.getLinks("SAME_LEVEL"),containsInAnyOrder(localIU2.getUid()));
}
@Test
public void testPublishLinksRemote() throws InterruptedException
{
LocalIU localIU2 = new LocalIU();
localIU2.setCategory(CATEGORY);
localIU2.getPayload().put("key1", "item2");
localIU.addLinks("SAME_LEVEL", ImmutableSet.of(localIU2.getUid()));
outBuffer.add(localIU);
outBuffer.add(localIU2);
Thread.sleep(200);
AbstractIU iuIn = inBuffer.getIU(localIU.getUid());
assertThat(iuIn.getLinks("SAME_LEVEL"),containsInAnyOrder(localIU2.getUid()));
}
}
package ipaaca;
import java.util.HashMap;
import java.util.Map;
/**
* Counts how often and in what order certain events occur
* @author hvanwelbergen
*
*/
final class CountingEventHandler implements HandlerFunctor
{
private Map<String,Integer> messageEvents = new HashMap<String,Integer>();
private Map<String,Integer> commitEvents = new HashMap<String,Integer>();
private Map<String,Integer> addEvents = new HashMap<String,Integer>();
private Map<String,Integer> updateEvents = new HashMap<String,Integer>();
private void updateEventMap(String key, Map<String,Integer> map)
{
int value = 0;
if(map.containsKey(key))
{
value = map.get(key);
}
value++;
map.put(key, value);
}
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
switch(type)
{
case ADDED: updateEventMap(iu.getUid(),addEvents); break;
case COMMITTED: updateEventMap(iu.getUid(),commitEvents); break;
case UPDATED: updateEventMap(iu.getUid(),updateEvents); break;
case MESSAGE: updateEventMap(iu.getUid(),messageEvents);break;
case DELETED:
break;
case LINKSUPDATED:
break;
case RETRACTED:
break;
default:
break;
}
}
public int getNumberOfCommitEvents(String iu)
{
if(!commitEvents.containsKey(iu))
{
return 0;
}
return commitEvents.get(iu);
}
public int getNumberOfAddEvents(String iu)
{
if(!addEvents.containsKey(iu))
{
return 0;
}
return addEvents.get(iu);
}
public int getNumberOfUpdateEvents(String iu)
{
if(!updateEvents.containsKey(iu))
{
return 0;
}
return updateEvents.get(iu);
}
public int getNumberOfMessageEvents(String iu)
{
if(!messageEvents.containsKey(iu))
{
return 0;
}
return messageEvents.get(iu);
}
}
\ No newline at end of file
package ipaaca;
import static org.junit.Assert.*;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import ipaaca.Ipaaca.IU;
import ipaaca.Ipaaca.LinkSet;
import ipaaca.Ipaaca.PayloadItem;
import ipaaca.protobuf.Ipaaca.IU;
import ipaaca.protobuf.Ipaaca.LinkSet;
import ipaaca.protobuf.Ipaaca.PayloadItem;
import java.util.Collection;
import java.util.List;
......
package ipaaca;
import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import java.util.Set;
......@@ -14,10 +14,15 @@ import rsb.RSBException;
import com.google.common.collect.ImmutableSet;
/**
* Unit testcases for the input buffer
* @author hvanwelbergen
*
*/
public class InputBufferTest
{
private static final String COMPID = "Comp1";
private static final String CATEGORY = "category1";
private static final String CATEGORY = "testcat";
private InputBuffer inBuffer;
......@@ -42,14 +47,14 @@ public class InputBufferTest
@Test
public void testHandleRemotePushEvent() throws RSBException, InterruptedException
{
Informer<Object> informer = Factory.getInstance().createInformer("/ipaaca/category/"+CATEGORY);
Informer<Object> informer = Factory.getInstance().createInformer("/ipaaca/channel/default/category/"+CATEGORY);
informer.activate();
RemotePushIU iu = new RemotePushIU("uid1");
iu.setCategory("/ipaaca/category/"+CATEGORY);
iu.setCategory("/ipaaca/channel/default/category/"+CATEGORY);
iu.setOwnerName("owner");
iu.setReadOnly(false);
iu.setRevision(1);
informer.send(iu);
informer.publish(iu);
Thread.sleep(1000);
AbstractIU iuIn = inBuffer.getIU("uid1");
......
package ipaaca;
import static ipaaca.IUTestUtil.assertEqualIU;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import ipaaca.protobuf.Ipaaca;
import ipaaca.protobuf.Ipaaca.IU;
import ipaaca.protobuf.Ipaaca.IU.AccessMode;
import ipaaca.protobuf.Ipaaca.LinkSet;
import ipaaca.protobuf.Ipaaca.PayloadItem;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import ipaaca.Ipaaca;
import ipaaca.Ipaaca.IU;
import ipaaca.Ipaaca.IU.AccessMode;
import ipaaca.Ipaaca.LinkSet;
import ipaaca.Ipaaca.PayloadItem;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.mockito.Mockito.*;
import org.junit.Before;
import org.junit.Test;
import com.google.common.collect.ImmutableSet;
import com.google.protobuf.InvalidProtocolBufferException;
import rsb.converter.ConversionException;
import rsb.converter.ConverterSignature;
import rsb.converter.UserData;
import rsb.converter.WireContents;
import rsb.patterns.RemoteServer;
import static ipaaca.IUTestUtil.*;
import com.google.common.collect.ImmutableSet;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* Unit test cases for the IUConverter
* @author hvanwelbergen
*
*/
public class IuConverterTest
{
private static final String CATEGORY = "category1";
......@@ -44,7 +52,7 @@ public class IuConverterTest
@Test
public void testSerialize() throws ConversionException, InvalidProtocolBufferException
public void testSerializePushIU() throws ConversionException, InvalidProtocolBufferException
{
RemotePushIU rpIU = new RemotePushIU("iu1");
rpIU.setRevision(1);
......@@ -59,7 +67,28 @@ public class IuConverterTest
WireContents<ByteBuffer> wiu = converter.serialize(RemotePushIU.class,rpIU);
IU iu = IU.newBuilder().mergeFrom(wiu.getSerialization().array()).build();
assertEqualIU(iu, rpIU);
assertEqualIU(iu, rpIU);
assertEquals(IU.AccessMode.PUSH,iu.getAccessMode());
}
@Test
public void testSerializeMessageIU() throws ConversionException, InvalidProtocolBufferException
{
RemoteMessageIU rmIU = new RemoteMessageIU("iu1");
rmIU.setRevision(1);
rmIU.setOwnerName("owner");
rmIU.setCategory(CATEGORY);
rmIU.setBuffer(mockInputBuffer);
rmIU.getPayload().enforcedSetItem("key1", "value1");
rmIU.getPayload().enforcedSetItem("key2", "value2");
rmIU.getPayload().enforcedSetItem("key3", "value3");
rmIU.setLinksLocally("SAME_LEVEL",ImmutableSet.of("sibling1","sibling2"));
rmIU.setLinksLocally("GROUNDED_IN",ImmutableSet.of("parent1","parent2"));
WireContents<ByteBuffer> wiu = converter.serialize(RemoteMessageIU.class,rmIU);
IU iu = IU.newBuilder().mergeFrom(wiu.getSerialization().array()).build();
assertEqualIU(iu, rmIU);
assertEquals(IU.AccessMode.MESSAGE,iu.getAccessMode());
}
public PayloadItem createPayloadItem(String key, String value)
......@@ -71,8 +100,9 @@ public class IuConverterTest
.build();
}
@Test
public void testDeSerialize() throws ConversionException
public void testDeSerializePushIU() throws ConversionException
{
List<PayloadItem> payload = new ArrayList<PayloadItem>();
payload.add(createPayloadItem("key1","value1"));
......@@ -108,6 +138,47 @@ public class IuConverterTest
assertThat(data.getData(), instanceOf(RemotePushIU.class));
RemotePushIU rpIU = (RemotePushIU) data.getData();
assertEqualIU(iu, rpIU);
assertEqualIU(iu, rpIU);
}
@Test
public void testDeSerializeMessageIU() throws ConversionException
{
List<PayloadItem> payload = new ArrayList<PayloadItem>();
payload.add(createPayloadItem("key1","value1"));
payload.add(createPayloadItem("key2","value2"));
payload.add(createPayloadItem("key3","value3"));
List<LinkSet> links = new ArrayList<LinkSet>();
links.add(
LinkSet.newBuilder()
.addAllTargets(ImmutableSet.of("sibling1","sibling2"))
.setType("SAME_LEVEL")
.build()
);
links.add(
LinkSet.newBuilder()
.addAllTargets(ImmutableSet.of("parent1","parent2"))
.setType("GROUNDED_IN")
.build()
);
Ipaaca.IU iu = Ipaaca.IU.newBuilder()
.setUid("uid1")
.setRevision(1)
.setCommitted(false)
.setOwnerName("owner")
.setAccessMode(AccessMode.MESSAGE)
.setReadOnly(false)
.setCategory(CATEGORY)
.addAllPayload(payload)
.addAllLinks(links)
.setPayloadType("")
.build();
UserData<?> data = converter.deserialize("", ByteBuffer.wrap(iu.toByteArray()));
assertThat(data.getData(), instanceOf(RemoteMessageIU.class));
RemoteMessageIU rpIU = (RemoteMessageIU) data.getData();
assertEqualIU(iu, rpIU);
}
}
package ipaaca;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.EnumSet;
import java.util.Set;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.collect.ImmutableSet;
/**
* Integration tests to test the connection between Python and Java Ipaaca modules.
* Requires a running spread daemon.
* @author hvanwelbergen
*
*/
public class JavaPythonTest
{
private StoringEventHandler storeHandler = new StoringEventHandler();
@BeforeClass
public static void setupStatic()
{
Initializer.initializeIpaacaRsb();
}
private InputBuffer inBuffer;
private static final String PYTHON_PREAMBLE = "import sys\n"
+ "sys.path.insert(0, '../python/build/')\n"
+ "sys.path.insert(0, '../python/lib/')\n"
+ "sys.path.insert(0, '../../deps/python/')\n"
+ "import ipaaca, time\n";
@Before
public void setup()
{
Set<String> categories = new ImmutableSet.Builder<String>().add("JavaPythonTest").build();
inBuffer = new InputBuffer("javaside", categories);
}
private String getRuntimeErrors(Process p) throws IOException
{
StringBuffer errors = new StringBuffer();
InputStream in = p.getInputStream();
BufferedInputStream buf = new BufferedInputStream(in);
InputStreamReader inread = new InputStreamReader(buf);
BufferedReader bufferedreader = new BufferedReader(inread);
// Read the ls output
String line;
while ((line = bufferedreader.readLine()) != null)
{
System.out.println(line);
}
try
{
if (p.waitFor() != 0)
{
errors.append("exit value = " + p.exitValue()+"\n");
}
}
catch (InterruptedException e)
{
errors.append(e);
}
in = p.getErrorStream();
buf = new BufferedInputStream(in);
inread = new InputStreamReader(buf);
bufferedreader = new BufferedReader(inread);
// Read the ls output
while ((line = bufferedreader.readLine()) != null)
{
errors.append(line);
}
return errors.toString();
}
private void runPythonProgram(String pypr) throws IOException
{
Process p = Runtime.getRuntime().exec(new String[] { "python", "-c", pypr });
assertTrue(getRuntimeErrors(p), p.exitValue()==0);
}
@Test
public void testSetPayloadInPythonOutputBuffer() throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+ "ob = ipaaca.OutputBuffer('pythonside')\n"
+ "iu = ipaaca.IU('JavaPythonTest')\n"
+ "iu.payload = {'data':'Hello from Python!'}\n"
+ "time.sleep(0.1)\n"
+ "ob.add(iu)\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertEquals("Hello from Python!", iu.getPayload().get("data"));
}
@Test
public void testSetPayloadInPythonOutputBufferAfterPublishing() throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+ "ob = ipaaca.OutputBuffer('pythonside')\n"
+ "iu = ipaaca.IU('JavaPythonTest')\n"
+ "ob.add(iu)\n"
+ "time.sleep(0.1)\n"
+ "iu.payload = {'data':'Hello from Python!'}\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertEquals("Hello from Python!", iu.getPayload().get("data"));
}
@Test
public void testAddLinkThenPublishInPython() throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+"ob = ipaaca.OutputBuffer('pythonside')\n"
+"iu = ipaaca.IU('JavaPythonTest')\n"
+"iu.add_links('testtype',['dummy1','dummy2'])\n"
+ "time.sleep(0.1)\n"
+ "ob.add(iu)\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertThat(iu.getLinks("testtype"),containsInAnyOrder("dummy1","dummy2"));
}
@Test
public void testPublishThenAddLinkInPython() throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+"ob = ipaaca.OutputBuffer('pythonside')\n"
+"iu = ipaaca.IU('JavaPythonTest')\n"
+ "ob.add(iu)\n"
+ "time.sleep(0.1)\n"
+"iu.add_links('testtype',['dummy1','dummy2'])\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertThat(iu.getLinks("testtype"),containsInAnyOrder("dummy1","dummy2"));
}
@Test
public void testCommitPublishedIUFromPython()throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+"ob = ipaaca.OutputBuffer('pythonside')\n"
+"iu = ipaaca.IU('JavaPythonTest')\n"
+ "ob.add(iu)\n"
+ "time.sleep(0.1)\n"
+ "iu.commit()\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertTrue(iu.isCommitted());
}
@Test
public void testCommitThenPublishIUFromPython()throws IOException, InterruptedException
{
String pypr = PYTHON_PREAMBLE
+"ob = ipaaca.OutputBuffer('pythonside')\n"
+"iu = ipaaca.IU('JavaPythonTest')\n"
+"iu.commit()\n"
+"time.sleep(0.1)\n"
+"ob.add(iu)\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1, inBuffer.getIUs().size());
AbstractIU iu = inBuffer.getIUs().iterator().next();
assertTrue(iu.isCommitted());
}
@Test
public void testMessageFromPython()throws IOException, InterruptedException
{
inBuffer.registerHandler(new IUEventHandler(storeHandler,EnumSet.of(IUEventType.ADDED, IUEventType.MESSAGE),ImmutableSet.of("JavaPythonTest")));
String pypr = PYTHON_PREAMBLE
+"ob = ipaaca.OutputBuffer('pythonside')\n"
+"iu = ipaaca.Message('JavaPythonTest')\n"
+"iu.payload = {'data':'Hello from Python!'}\n"
+"time.sleep(0.1)\n"
+"ob.add(iu)\n";
runPythonProgram(pypr);
Thread.sleep(200);
assertEquals(1,storeHandler.getMessageIUs().size());
assertEquals("Hello from Python!", storeHandler.getMessageIUs().get(0).getPayload().get("data"));
}
}
package ipaaca;
import static org.junit.Assert.*;
import ipaaca.Ipaaca.IUPayloadUpdate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import ipaaca.protobuf.Ipaaca.IUPayloadUpdate;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;
/**
* Unit testcases for the LocalIU
* @author hvanwelbergen
*/
public class LocalIUTest
{
OutputBuffer mockBuffer = mock(OutputBuffer.class);
......@@ -21,7 +30,7 @@ public class LocalIUTest
@Test
public void testCommit()
{
LocalIU liu = new LocalIU("iu1");
LocalIU liu = new LocalIU();
liu.getPayload().put("key1", "item1");
liu.setBuffer(mockBuffer);
liu.commit("commitWriter");
......@@ -33,7 +42,7 @@ public class LocalIUTest
@Test
public void testSetPayloadOnUnpublishedIU()
{
LocalIU liu = new LocalIU("iu1");
LocalIU liu = new LocalIU();
liu.getPayload().put("key1", "item1");
assertEquals("item1", liu.getPayload().get("key1"));
}
......@@ -41,7 +50,7 @@ public class LocalIUTest
@Test
public void testSetPayloadOnPublishedIU()
{
LocalIU liu = new LocalIU("iu1");
LocalIU liu = new LocalIU();
liu.setBuffer(mockBuffer);
liu.getPayload().put("key1", "item1");
assertEquals("item1", liu.getPayload().get("key1"));
......
package ipaaca;
import java.util.ArrayList;
import java.util.List;
/**
* Stores ius for which add messages occured.
* @author hvanwelbergen
*
*/
public class StoringEventHandler implements HandlerFunctor
{
private List<AbstractIU> addedIUs = new ArrayList<AbstractIU>();
private List<AbstractIU> messageIUs = new ArrayList<AbstractIU>();
public List<AbstractIU> getAddedIUs()
{
return addedIUs;
}
public List<AbstractIU> getMessageIUs()
{
return messageIUs;
}
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
switch (type)
{
case ADDED:
addedIUs.add(iu);
break;
case MESSAGE:
messageIUs.add(iu);
break;
case COMMITTED:
break;
case UPDATED:
break;
case DELETED:
break;
case LINKSUPDATED:
break;
case RETRACTED:
break;
default:
break;
}
}
}
package ipaaca.util;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import ipaaca.Initializer;
import org.junit.After;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
/**
* Integration tests for the blackboard
* @author hvanwelbergen
*/
public class BlackboardIntegrationTest
{
static
{
Initializer.initializeIpaacaRsb();
}
private Blackboard bb = new Blackboard("myblackboard","blackboardx");
private BlackboardClient bbc;
@After
public void after()
{
bb.close();
if(bbc!=null)
{
bbc.close();
}
}
@Test
public void testGetValueFromBlackboardBeforeConnection()
{
bb.put("key1","value1");
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
assertEquals("value1", bbc.get("key1"));
}
@Test
public void testGetValueFromBlackboardAfterConnection() throws InterruptedException
{
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bb.put("key1","value1");
Thread.sleep(200);
assertEquals("value1", bbc.get("key1"));
}
@Test
public void testSetValueOnBlackboard() throws InterruptedException
{
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bbc.put("key2","value2");
Thread.sleep(300);
assertEquals("value2", bb.get("key2"));
}
@Test
public void testBlackboardUpdateHandler()throws InterruptedException
{
BlackboardUpdateListener mockListener = mock(BlackboardUpdateListener.class);
bb.addUpdateListener(mockListener);
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bbc.put("key2","value2");
Thread.sleep(200);
bb.put("key2","value3");
verify(mockListener,times(1)).update();
}
@Test
public void testBlackboardClientUpdateHandler() throws InterruptedException
{
BlackboardUpdateListener mockListener = mock(BlackboardUpdateListener.class);
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bbc.addUpdateListener(mockListener);
bb.put("key3","value3");
Thread.sleep(200);
bbc.put("key3","value4");
verify(mockListener,times(2)).update();
}
@Test
public void testSetManyValuesOnBlackboard() throws InterruptedException
{
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
for(int i=0;i<100;i++)
{
bbc.put("key"+i,"value"+i);
bb.put("key"+i,"value"+i);
}
Thread.sleep(300);
assertEquals("value2", bb.get("key2"));
assertEquals("value3", bb.get("key3"));
}
@Test
public void testSetValuesOnClient() throws InterruptedException
{
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bbc.putAll(ImmutableMap.of("key1","value1","key2","value2"));
Thread.sleep(200);
assertEquals("value1", bb.get("key1"));
assertEquals("value2", bb.get("key2"));
}
@Test
public void testSetValuesOnBlackBoard() throws InterruptedException
{
bbc = new BlackboardClient("myblackboardclient","blackboardx");
bbc.waitForBlackboardConnection();
bb.putAll(ImmutableMap.of("key1","value1","key2","value2"));
Thread.sleep(200);
assertEquals("value1", bbc.get("key1"));
assertEquals("value2", bbc.get("key2"));
}
}
package ipaaca.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import ipaaca.AbstractIU;
import ipaaca.HandlerFunctor;
import ipaaca.IUEventType;
import ipaaca.Initializer;
import ipaaca.InputBuffer;
import ipaaca.LocalIU;
import ipaaca.OutputBuffer;
import java.util.Set;
import lombok.Getter;
import org.junit.After;
import org.junit.Test;
import com.google.common.collect.ImmutableSet;
/**
* Integration test for the ComponentNotifier, connects two of them. Requires a running spread daemon.
* @author hvanwelbergen
*
*/
public class ComponentNotifierIntegrationTest
{
private ComponentNotifier notifier1;
private ComponentNotifier notifier2;
private InputBuffer inBuffer;
private OutputBuffer outBuffer;
private static final String OTHER_CATEGORY="OTHER";
static
{
Initializer.initializeIpaacaRsb();
}
private class MyHandlerFunctor implements HandlerFunctor
{
@Getter
private volatile int numCalled = 0;
@Override
public void handle(AbstractIU iu, IUEventType type, boolean local)
{
numCalled++;
}
}
@After
public void after()
{
if (inBuffer != null)
{
inBuffer.close();
}
if (outBuffer != null)
{
outBuffer.close();
}
}
private ComponentNotifier setupCompNotifier(String id, Set<String> sendList, Set<String> recvList)
{
inBuffer = new InputBuffer(id + "in", ImmutableSet.of(ComponentNotifier.NOTIFY_CATEGORY));
outBuffer = new OutputBuffer(id + "out");
return new ComponentNotifier(id, "test", ImmutableSet.copyOf(sendList), ImmutableSet.copyOf(recvList), outBuffer, inBuffer);
}
private ComponentNotifier setupCompNotifierWithOtherCategoryInputBuffer(String id, Set<String> sendList, Set<String> recvList)
{
inBuffer = new InputBuffer(id + "in", ImmutableSet.of(ComponentNotifier.NOTIFY_CATEGORY, OTHER_CATEGORY));
outBuffer = new OutputBuffer(id + "out");
return new ComponentNotifier(id, "test", ImmutableSet.copyOf(sendList), ImmutableSet.copyOf(recvList), outBuffer, inBuffer);
}
@Test
public void testSelf() throws InterruptedException
{
notifier1 = setupCompNotifier("not1", ImmutableSet.of("a1", "b1"), ImmutableSet.of("a3", "b1"));
MyHandlerFunctor h1 = new MyHandlerFunctor();
notifier1.addNotificationHandler(h1);
notifier1.initialize();
Thread.sleep(500);
assertEquals(0, h1.getNumCalled());
}
@Test
public void testTwo() throws InterruptedException
{
notifier1 = setupCompNotifier("not1", ImmutableSet.of("a1", "b1"), ImmutableSet.of("a3", "b2"));
notifier2 = setupCompNotifier("not2", ImmutableSet.of("a2", "b2"), ImmutableSet.of("a3", "b1"));
MyHandlerFunctor h1 = new MyHandlerFunctor();
MyHandlerFunctor h2 = new MyHandlerFunctor();
notifier1.addNotificationHandler(h1);
notifier2.addNotificationHandler(h2);
notifier1.initialize();
Thread.sleep(500);
notifier2.initialize();
Thread.sleep(500);
assertEquals(1, h1.getNumCalled());
assertEquals(1, h2.getNumCalled());
}
@Test
public void testOtherCategoryInInputBuffer() throws InterruptedException
{
notifier1 = setupCompNotifierWithOtherCategoryInputBuffer("not1", ImmutableSet.of("a1", "b1"), ImmutableSet.of("a3", "b1"));
MyHandlerFunctor h1 = new MyHandlerFunctor();
notifier1.addNotificationHandler(h1);
OutputBuffer out = new OutputBuffer("out");
LocalIU iu = new LocalIU(OTHER_CATEGORY);
out.add(iu);
Thread.sleep(500);
assertEquals(0, h1.getNumCalled());
assertNotNull(inBuffer.getIU(iu.getUid()));
}
}
package ipaaca.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.doAnswer;
import ipaaca.AbstractIU;
import ipaaca.IUEventHandler;
import ipaaca.IUEventType;
import ipaaca.InputBuffer;
import ipaaca.LocalIU;
import ipaaca.OutputBuffer;
import ipaaca.Payload;
import java.util.Set;
import org.hamcrest.collection.IsIterableContainingInAnyOrder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableSet;
/**
* Unit tests for the ComponentNotifier
* @author hvanwelbergen
*/
public class ComponentNotifierTest
{
private static final ImmutableSet<String> RECV_CAT = ImmutableSet.of("testrec1", "testrc2");
private static final ImmutableSet<String> SEND_CAT = ImmutableSet.of("testsnd1", "testsnd2", "testsnd3");
private OutputBuffer mockOutBuffer = mock(OutputBuffer.class);
private InputBuffer mockInBuffer = mock(InputBuffer.class);
private IUEventHandler inputHandler;
private ComponentNotifier notifier = new ComponentNotifier("testcomp", "testfunc", SEND_CAT, RECV_CAT, mockOutBuffer, mockInBuffer);
@Before
public void setup()
{
doAnswer(new Answer<Void>()
{
@Override
public Void answer(InvocationOnMock invocation) throws Throwable
{
IUEventHandler handler = (IUEventHandler) (invocation.getArguments()[0]);
inputHandler = handler;
return null;
}
}).when(mockInBuffer).registerHandler(any(IUEventHandler.class));
notifier.initialize();
}
@Test
public void testNotifyAtInit()
{
ArgumentCaptor<LocalIU> argument = ArgumentCaptor.forClass(LocalIU.class);
verify(mockOutBuffer).add(argument.capture());
LocalIU iu = argument.getValue();
assertEquals(ComponentNotifier.NOTIFY_CATEGORY, iu.getCategory());
assertEquals("new", iu.getPayload().get(ComponentNotifier.STATE));
assertThat(ImmutableSet.copyOf(iu.getPayload().get(ComponentNotifier.RECEIVE_CATEGORIES).split(",")),
IsIterableContainingInAnyOrder.containsInAnyOrder(RECV_CAT.toArray(new String[0])));
assertThat(ImmutableSet.copyOf(iu.getPayload().get(ComponentNotifier.SEND_CATEGORIES).split(",")),
IsIterableContainingInAnyOrder.containsInAnyOrder(SEND_CAT.toArray(new String[0])));
}
private void sendNotify(String state, Set<String> receiveCats)
{
AbstractIU mockIUNotify = mock(AbstractIU.class);
Payload mockNotifyPayload = mock(Payload.class);
when(mockIUNotify.getCategory()).thenReturn(ComponentNotifier.NOTIFY_CATEGORY);
when(mockIUNotify.getPayload()).thenReturn(mockNotifyPayload);
when(mockInBuffer.getIU("iuNotify")).thenReturn(mockIUNotify);
when(mockNotifyPayload.get(ComponentNotifier.STATE)).thenReturn(state);
when(mockNotifyPayload.get(ComponentNotifier.NAME)).thenReturn("namex");
when(mockNotifyPayload.get(ComponentNotifier.SEND_CATEGORIES)).thenReturn("");
when(mockNotifyPayload.get(ComponentNotifier.RECEIVE_CATEGORIES)).thenReturn(Joiner.on(",").join(receiveCats));
inputHandler.call(mockInBuffer, "iuNotify", false, IUEventType.ADDED, ComponentNotifier.NOTIFY_CATEGORY);
}
@Test
public void testNotifyAtNotifyNew() throws Exception
{
sendNotify("new", ImmutableSet.of("testsnd1"));
ArgumentCaptor<LocalIU> argument = ArgumentCaptor.forClass(LocalIU.class);
verify(mockOutBuffer, times(2)).add(argument.capture());
LocalIU iu = argument.getAllValues().get(1);
assertEquals("componentNotify", iu.getCategory());
assertEquals("old", iu.getPayload().get("state"));
}
@Test
public void testNoNotifyAtNotifyOld() throws Exception
{
sendNotify("old", ImmutableSet.of("testsnd1"));
ArgumentCaptor<LocalIU> argument = ArgumentCaptor.forClass(LocalIU.class);
verify(mockOutBuffer, times(1)).add(argument.capture());
}
private class WaitForFinish extends Thread
{
public volatile boolean waitFinish = false;
public void run()
{
notifier.waitForReceivers();
waitFinish = true;
}
}
@Test
public void testWait() throws InterruptedException
{
WaitForFinish wff = new WaitForFinish();
wff.start();
Thread.sleep(200);
assertFalse(wff.waitFinish);
sendNotify("new",SEND_CAT);
Thread.sleep(200);
assertTrue(wff.waitFinish);
}
@Test
public void testWaitWrongCats() throws InterruptedException
{
WaitForFinish wff = new WaitForFinish();
wff.start();
Thread.sleep(200);
assertFalse(wff.waitFinish);
sendNotify("new",RECV_CAT);
Thread.sleep(200);
assertFalse(wff.waitFinish);
}
@Test
public void testWaitIncremental()throws InterruptedException
{
WaitForFinish wff = new WaitForFinish();
wff.start();
Thread.sleep(200);
assertFalse(wff.waitFinish);
sendNotify("new",ImmutableSet.of("testsnd1", "testsnd2"));
Thread.sleep(200);
assertFalse(wff.waitFinish);
sendNotify("new",ImmutableSet.of("testsnd3"));
Thread.sleep(200);
assertTrue(wff.waitFinish);
}
}
package ipaaca.util.communication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import ipaaca.LocalMessageIU;
import ipaaca.OutputBuffer;
/**
* Unit tests for the FutureIU
* @author hvanwelbergen
*
*/
public class FutureIUTest
{
private final OutputBuffer outBuffer = new OutputBuffer("component1");
@Test(timeout = 2000)
public void testSendBeforeTake() throws InterruptedException
{
FutureIU fu = new FutureIU("cat1", "status", "started");
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("status", "started");
outBuffer.add(message);
assertEquals(message.getPayload(), fu.take().getPayload());
}
@Test(timeout = 2000)
public void testSendAfterTake() throws InterruptedException
{
FutureIU fu = new FutureIU("cat1", "status", "started");
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("status", "started");
Runnable send = () -> {
try
{
Thread.sleep(1000);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
outBuffer.add(message);
};
new Thread(send).start();
assertEquals(message.getPayload(), fu.take().getPayload());
}
@Test
public void testInvalidKeyValue() throws InterruptedException
{
FutureIU fu = new FutureIU("cat1", "status", "started");
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("status", "cancelled");
assertNull(fu.take(1,TimeUnit.SECONDS));
}
}
package ipaaca.util.communication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Test;
import ipaaca.LocalMessageIU;
import ipaaca.OutputBuffer;
/**
* Unit tests for FutureIUs
* @author hvanwelbergen
*
*/
public class FutureIUsTest
{
private FutureIUs fus = new FutureIUs("cat1","id");
private final OutputBuffer outBuffer = new OutputBuffer("component1");
@After
public void cleanup()
{
fus.close();
}
@Test(timeout = 2000)
public void testSendBeforeTake() throws InterruptedException
{
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("id", "id1");
outBuffer.add(message);
assertEquals(message.getPayload(), fus.take("id1").getPayload());
}
@Test(timeout = 2000)
public void testSendAfterTake() throws InterruptedException
{
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("id", "id1");
Runnable send = () -> {
try
{
Thread.sleep(1000);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
outBuffer.add(message);
};
new Thread(send).start();
assertEquals(message.getPayload(), fus.take("id1").getPayload());
}
@Test
public void testNonMatchingKeyValue() throws InterruptedException
{
LocalMessageIU message = new LocalMessageIU("cat1");
message.getPayload().put("id", "id2");
outBuffer.add(message);
assertNull(fus.take("id1", 1,TimeUnit.SECONDS));
}
@Test
public void testMultipleKeyValues() throws InterruptedException
{
LocalMessageIU message1 = new LocalMessageIU("cat1");
message1.getPayload().put("id", "id1");
LocalMessageIU message2 = new LocalMessageIU("cat1");
message2.getPayload().put("id", "id2");
outBuffer.add(message2);
outBuffer.add(message1);
assertEquals(message1.getPayload(), fus.take("id1").getPayload());
assertEquals(message2.getPayload(), fus.take("id2").getPayload());
}
}
// This file is part of IPAACA, the
// "Incremental Processing Architecture
// for Artificial Conversational Agents".
//
// Copyright (c) 2009-2022 Social Cognitive Systems Group
// CITEC, Bielefeld University
//
// http://opensource.cit-ec.de/projects/ipaaca/
// http://purl.org/net/ipaaca
//
// This file may be licensed under the terms of of the
// GNU Lesser General Public License Version 3 (the ``LGPL''),
// or (at your option) any later version.
//
// Software distributed under the License is distributed
// on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
// express or implied. See the LGPL for the specific language
// governing rights and limitations.
//
// You should have received a copy of the LGPL along with this
// program. If not, go to http://www.gnu.org/licenses/lgpl.html
// or write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// The development of this software was supported by the
// Excellence Cluster EXC 277 Cognitive Interaction Technology.
// The Excellence Cluster EXC 277 is a grant of the Deutsche
// Forschungsgemeinschaft (DFG) in the context of the German
// Excellence Initiative.
syntax = "proto2";
package ipaaca.protobuf;
enum TransportMessageType {
WireTypeRESERVED = 0;
WireTypeIntMessage = 1;
WireTypeRemoteRequestResult = 2;
WireTypeIU = 3;
WireTypeMessageIU = 4; // special case on the wire (use other converter)
WireTypeIUPayloadUpdate = 5;
WireTypeIULinkUpdate = 6;
WireTypeIURetraction = 7;
WireTypeIUCommission = 8;
WireTypeIUResendRequest = 9;
WireTypeIUPayloadUpdateRequest = 100;
WireTypeIUCommissionRequest = 101;
WireTypeIULinkUpdateRequest = 102;
}
message TransportLevelWrapper {
required TransportMessageType transport_message_type = 1;
required bytes raw_message = 2;
}
message IntMessage {
required sint32 value = 1;
}
message LinkSet {
required string type = 1;
repeated string targets = 2;
}
message PayloadItem {
required string key = 1;
required string value = 2;
required string type = 3 [default = "str"];
}
message IU {
enum AccessMode {
PUSH = 0;
REMOTE = 1;
MESSAGE = 2;
}
required string uid = 1;
required uint32 revision = 2;
required string category = 3 [default = "undef"];
required string payload_type = 4 [default = "MAP"];
required string owner_name = 5;
required bool committed = 6 [default = false];
required AccessMode access_mode = 7 [default = PUSH];
required bool read_only = 8 [default = false];
repeated PayloadItem payload = 9;
repeated LinkSet links = 10;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IUPayloadUpdate {
required string uid = 1;
required uint32 revision = 2;
repeated PayloadItem new_items = 3;
repeated string keys_to_remove = 4;
required bool is_delta = 5 [default = false];
required string writer_name = 6;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IURetraction {
required string uid = 1;
required uint32 revision = 2;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IUCommission {
required string uid = 1;
required uint32 revision = 2;
required string writer_name = 3;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IULinkUpdate {
required string uid = 1;
required uint32 revision = 2;
repeated LinkSet new_links = 3;
repeated LinkSet links_to_remove = 4;
required bool is_delta = 5 [default = false];
required string writer_name = 6;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IUResendRequest {
required string uid = 1;
required string hidden_scope_name = 2;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
// Result for remote operations (below).
// Used to send a raw int, which was problematic.
// Usually: 0 = Failed, >0 = new revision of successfully modified resource.
message RemoteRequestResult {
required uint32 result = 1;
optional string request_uid = 100 [default = ""];
//optional string request_endpoint = 101 [default = ""];
}
// Remote / request versions of buffer setters:
// they just go with a dedicated ID
message IUPayloadUpdateRequest {
required string uid = 1;
required uint32 revision = 2;
repeated PayloadItem new_items = 3;
repeated string keys_to_remove = 4;
required bool is_delta = 5 [default = false];
required string writer_name = 6;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IUCommissionRequest {
required string uid = 1;
required uint32 revision = 2;
required string writer_name = 3;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
message IULinkUpdateRequest {
required string uid = 1;
required uint32 revision = 2;
repeated LinkSet new_links = 3;
repeated LinkSet links_to_remove = 4;
required bool is_delta = 5 [default = false];
required string writer_name = 6;
optional string request_uid = 100 [default = ""];
optional string request_endpoint = 101 [default = ""];
}
File moved