Return-Path: X-Original-To: apmail-ode-commits-archive@www.apache.org Delivered-To: apmail-ode-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 848F510270 for ; Thu, 15 Aug 2013 22:52:48 +0000 (UTC) Received: (qmail 67653 invoked by uid 500); 15 Aug 2013 22:52:40 -0000 Delivered-To: apmail-ode-commits-archive@ode.apache.org Received: (qmail 67538 invoked by uid 500); 15 Aug 2013 22:52:40 -0000 Mailing-List: contact commits-help@ode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ode.apache.org Delivered-To: mailing list commits@ode.apache.org Received: (qmail 66825 invoked by uid 99); 15 Aug 2013 22:52:04 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 22:52:04 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0DC3E8378CD; Thu, 15 Aug 2013 22:52:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vanto@apache.org To: commits@ode.apache.org Date: Thu, 15 Aug 2013 22:52:04 -0000 Message-Id: In-Reply-To: <1a8c0e5cf8074c8e8ed38832573e1553@git.apache.org> References: <1a8c0e5cf8074c8e8ed38832573e1553@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/4] git commit: clean up clean up Project: http://git-wip-us.apache.org/repos/asf/ode-jacob/repo Commit: http://git-wip-us.apache.org/repos/asf/ode-jacob/commit/fdaf1f27 Tree: http://git-wip-us.apache.org/repos/asf/ode-jacob/tree/fdaf1f27 Diff: http://git-wip-us.apache.org/repos/asf/ode-jacob/diff/fdaf1f27 Branch: refs/heads/master Commit: fdaf1f278fee65e4766d83efd52ba3e016d91aab Parents: 561ab31 Author: Tammo van Lessen Authored: Fri Aug 16 00:33:42 2013 +0200 Committer: Tammo van Lessen Committed: Fri Aug 16 00:33:42 2013 +0200 ---------------------------------------------------------------------- .../apache/ode/jacob/vpu/ChannelRefTest.java | 71 ++++++++++++++++++++ .../org/apache/ode/jacob/vpu/ChannelTest.java | 71 -------------------- .../jacob/vpu/ProxyConstructorTimingTest.java | 1 - 3 files changed, 71 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/fdaf1f27/src/test/java/org/apache/ode/jacob/vpu/ChannelRefTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/vpu/ChannelRefTest.java b/src/test/java/org/apache/ode/jacob/vpu/ChannelRefTest.java new file mode 100644 index 0000000..756a34f --- /dev/null +++ b/src/test/java/org/apache/ode/jacob/vpu/ChannelRefTest.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ode.jacob.vpu; + +import static org.apache.ode.jacob.Jacob.newCommChannel; +import static org.junit.Assert.*; +import org.apache.ode.jacob.ChannelRef; +import org.apache.ode.jacob.oo.Synch; +import org.apache.ode.jacob.oo.Val; +import org.apache.ode.jacob.soup.CommChannel; + +import org.junit.Test; + +public class ChannelRefTest { + + @Test + public void testConnectWithInterface() { + JacobVPU vpu = new JacobVPU(); + vpu.setContext(new ExecutionQueueImpl()); + + vpu.inject(new Runnable() { + + @Override + public void run() { + ChannelRef cref = newCommChannel("unbound channel"); + CommChannel cchannel = cref.getEndpoint(CommChannel.class); + assertNotNull(cchannel); + assertNull(cchannel.getType()); + + // now connect it to Val.class + Val val = cref.getEndpoint(Val.class); + assertNotNull(val); + assertEquals(Val.class, cchannel.getType()); + + // now try to associate it with a different channel interface + try { + cref.getEndpoint(Synch.class); + fail("we should get an IllegalStateException"); + } catch (IllegalStateException e) { + assertEquals("ChannelRef is already associated with a channel of a different type", e.getMessage()); + } + + // now try to associate with the same channel + Val val2 = cref.getEndpoint(Val.class); + assertNotNull(val2); + assertSame(val, val2); + + } + }); + + assertEquals(true, vpu.getContext().hasReactions()); + vpu.execute(); + assertEquals(false, vpu.getContext().hasReactions()); + } +} http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/fdaf1f27/src/test/java/org/apache/ode/jacob/vpu/ChannelTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/vpu/ChannelTest.java b/src/test/java/org/apache/ode/jacob/vpu/ChannelTest.java deleted file mode 100644 index 3361dfe..0000000 --- a/src/test/java/org/apache/ode/jacob/vpu/ChannelTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ode.jacob.vpu; - -import static org.apache.ode.jacob.Jacob.newCommChannel; -import static org.junit.Assert.*; -import org.apache.ode.jacob.ChannelRef; -import org.apache.ode.jacob.oo.Synch; -import org.apache.ode.jacob.oo.Val; -import org.apache.ode.jacob.soup.CommChannel; - -import org.junit.Test; - -public class ChannelTest { - - @Test - public void testConnectWithInterface() { - JacobVPU vpu = new JacobVPU(); - vpu.setContext(new ExecutionQueueImpl()); - - vpu.inject(new Runnable() { - - @Override - public void run() { - ChannelRef cref = newCommChannel("unbound channel"); - CommChannel cchannel = cref.getEndpoint(CommChannel.class); - assertNotNull(cchannel); - assertNull(cchannel.getType()); - - // now connect it to Val.class - Val val = cref.getEndpoint(Val.class); - assertNotNull(val); - assertEquals(Val.class, cchannel.getType()); - - // now try to associate it with a different channel interface - try { - cref.getEndpoint(Synch.class); - fail("we should get an IllegalStateException"); - } catch (IllegalStateException e) { - assertEquals("ChannelRef is already associated with a channel of a different type", e.getMessage()); - } - - // now try to associate with the same channel - Val val2 = cref.getEndpoint(Val.class); - assertNotNull(val2); - assertSame(val, val2); - - } - }); - - assertEquals(true, vpu.getContext().hasReactions()); - vpu.execute(); - assertEquals(false, vpu.getContext().hasReactions()); - } -} http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/fdaf1f27/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java b/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java index 92bc9bb..4468699 100644 --- a/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java +++ b/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java @@ -26,7 +26,6 @@ import junit.framework.TestCase; import org.apache.ode.jacob.oo.Channel; import org.apache.ode.jacob.oo.ChannelProxy; -import org.apache.ode.jacob.oo.MessageHandler; public class ProxyConstructorTimingTest extends TestCase {