diff --git a/java/ivy.xml b/java/ivy.xml index 3e526063073e10c8e2a20991ffe50be62f7e835e..fd0007f6e8809662be9819b3bf4212834649c97f 100644 --- a/java/ivy.xml +++ b/java/ivy.xml @@ -6,5 +6,7 @@ <dependencies> <dependency org="slf4j" name="slf4j-api" rev="latest.release" /> <dependency org="google" name="guava" rev="latest.release" /> + <dependency org="google" name="protobuf-java" rev="latest.release" /> + <dependency org="rsb" name="rsb" rev="latest.release" /> </dependencies> </ivy-module> diff --git a/java/lib.local/protobuf-java-2.4.1.jar b/java/lib.local/protobuf-java-2.4.1.jar deleted file mode 100644 index 910b225a49bc6883b3b6c20deaf9afa1dd83772c..0000000000000000000000000000000000000000 Binary files a/java/lib.local/protobuf-java-2.4.1.jar and /dev/null differ diff --git a/java/lib.local/rsb-0.5.0.jar b/java/lib.local/rsb-0.5.0.jar deleted file mode 100644 index 0a9e6aaf6a895b483940e4dd5930f766be721e14..0000000000000000000000000000000000000000 Binary files a/java/lib.local/rsb-0.5.0.jar and /dev/null differ diff --git a/java/lib.local/rsb-0.6.0.jar b/java/lib.local/rsb-0.6.0.jar deleted file mode 100644 index b652d2d6434fd2fb361c21672b9cb5bbc5c3b05d..0000000000000000000000000000000000000000 Binary files a/java/lib.local/rsb-0.6.0.jar and /dev/null differ diff --git a/java/src/ipaaca/IUConverter.java b/java/src/ipaaca/IUConverter.java index 5d0508fe112141c572081d5477909867d4354f3e..c45a81c8fb74430406b731bd8ec32e278537b610 100644 --- a/java/src/ipaaca/IUConverter.java +++ b/java/src/ipaaca/IUConverter.java @@ -70,7 +70,7 @@ public class IUConverter implements Converter<ByteBuffer> .addAllPayload(payloadItems) .addAllLinks(links) .build(); - return new WireContents<ByteBuffer>(ByteBuffer.wrap(iu.toByteArray()),"ipaaca-remotepushiu"); + return new WireContents<ByteBuffer>(ByteBuffer.wrap(iu.toByteArray()),"ipaaca-iu"); } @Override diff --git a/java/src/ipaaca/Initializer.java b/java/src/ipaaca/Initializer.java index 82832435f8660cb8b63486781fe3fc98bf840284..fd010e1b6d63af75eefe6a140edceefe4bd533eb 100644 --- a/java/src/ipaaca/Initializer.java +++ b/java/src/ipaaca/Initializer.java @@ -32,9 +32,9 @@ public final class Initializer { DefaultConverterRepository.getDefaultConverterRepository() .addConverter(new ProtocolBufferConverter<IULinkUpdate>(IULinkUpdate.getDefaultInstance())); DefaultConverterRepository.getDefaultConverterRepository().addConverter( - new IUConverter(new ConverterSignature("ipaaca-remotepushiu", RemotePushIU.class))); - DefaultConverterRepository.getDefaultConverterRepository().addConverter( - new IUConverter(new ConverterSignature("ipaaca-localiu", LocalIU.class))); + new IUConverter(new ConverterSignature("ipaaca-iu", RemotePushIU.class))); + //DefaultConverterRepository.getDefaultConverterRepository().addConverter( + // new IUConverter(new ConverterSignature("ipaaca-localiu", LocalIU.class))); } } diff --git a/java/src/ipaaca/RemotePushIU.java b/java/src/ipaaca/RemotePushIU.java index b80eba87d2049678c444d3b36946ae79add0a197..a0b5392c55eb9885f1b48cc36da02e199e27fe77 100644 --- a/java/src/ipaaca/RemotePushIU.java +++ b/java/src/ipaaca/RemotePushIU.java @@ -367,7 +367,7 @@ public class RemotePushIU extends AbstractIU // else: // self._revision = new_revision @Override - public void modifyLinks(boolean isDelta, SetMultimap<String, String> linksToAdd, SetMultimap<String, String> linksToRemove, String writerName) + void modifyLinks(boolean isDelta, SetMultimap<String, String> linksToAdd, SetMultimap<String, String> linksToRemove, String writerName) { if (isCommitted()) { diff --git a/java/test/src/ipaaca/JavaPythonTest.java b/java/test/src/ipaaca/JavaPythonTest.java index 5fe85390861b7888c82c0426b0d74faa7ee7a4fb..ae7ea2c9d0097f6316629b4214c4c19d5b5686b8 100644 --- a/java/test/src/ipaaca/JavaPythonTest.java +++ b/java/test/src/ipaaca/JavaPythonTest.java @@ -2,6 +2,8 @@ package ipaaca; import static org.junit.Assert.assertEquals; +import ipaaca.Ipaaca.IU; + import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; @@ -30,21 +32,10 @@ public class JavaPythonTest { inBuffer = new InputBuffer("javaside", categories); } - @Ignore - @Test - public void test() throws IOException, InterruptedException { - - String pypr = - "import sys\n" + - "sys.path.append('../python/build/')\n" + - "import ipaaca, time\n" + - "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)"; - Process p = Runtime.getRuntime().exec(new String[]{"python","-c", pypr}); - InputStream in = p.getInputStream(); + private void printRuntimeErrors(Process p) throws IOException + { + + InputStream in = p.getInputStream(); BufferedInputStream buf = new BufferedInputStream(in); InputStreamReader inread = new InputStreamReader(buf); BufferedReader bufferedreader = new BufferedReader(inread); @@ -76,9 +67,27 @@ public class JavaPythonTest { { System.out.println(line); } + } + + @Test + public void test() throws IOException, InterruptedException { + + String pypr = + "import sys\n" + + "sys.path.append('/homes/hvanwelbergen/git_pool/ipaaca/python/build/')\n" + + "import ipaaca, time\n" + + "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)"; + Process p = Runtime.getRuntime().exec(new String[]{"python","-c", pypr}); + printRuntimeErrors(p); Thread.sleep(200); assertEquals(1, inBuffer.getIUs().size()); + AbstractIU iu = inBuffer.getIUs().iterator().next(); + assertEquals("Hello from Python!",iu.getPayload().get("data")); } diff --git a/python/src/ipaaca.py b/python/src/ipaaca.py index 9f639ccb270164241210c330f2eb8f17ee6d0f03..05431e8dd9a9e8a9f75195983f03fb8250539f5c 100755 --- a/python/src/ipaaca.py +++ b/python/src/ipaaca.py @@ -320,6 +320,7 @@ class IU(IUInterface):#{{{ raise IUCommittedError(self) with self.revision_lock: # set item locally + # FIXME: Is it actually set locally? self._increase_revision_number() if self.is_published: # send update to remote holders diff --git a/python/test/src/testipaaca.py b/python/test/src/testipaaca.py index 9aa93132be0963e8a9c8c0a2a9809bcb613398b3..1e411299737a35d9cecf4f9f1741ed1af53614d5 100755 --- a/python/test/src/testipaaca.py +++ b/python/test/src/testipaaca.py @@ -28,6 +28,20 @@ class IpaacaIUStoreTestCase(unittest.TestCase): self.assertIn(self.sensor_iu.uid, self.ob.iu_store) self.assertEqual(len(self.ob.iu_store), 1) +class IpaacaPayloadTestCase(unittest.TestCase): + def setUp(self): + self.ib = ipaaca.InputBuffer('TestIn', ['sensorcategory', 'decisioncategory']) + self.ob = ipaaca.OutputBuffer('TestOut') + self.sensor_iu = ipaaca.IU('sensorcategory') + self.sensor_iu.payload = {'data': 'sensordata'} + self.ob.add(self.sensor_iu) + + def testPayloadContent(self): + time.sleep(0.1)ipaac +nimp[ + iu_received = self.ib.iu_store.get(self.sensor_iu.uid) + self.assertEqual(iu_received.payload["data"], 'sensordata') + class IpaacaLinksTestCase(unittest.TestCase): def setUp(self): self.ib = ipaaca.InputBuffer('TestIn', ['sensorcategory', 'decisioncategory'])