You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2008/08/29 19:03:36 UTC

svn commit: r690339 - in /incubator/qpid/trunk/qpid/java/common: Composite.tpl src/test/java/org/apache/qpid/transport/GenTest.java

Author: rhs
Date: Fri Aug 29 10:03:36 2008
New Revision: 690339

URL: http://svn.apache.org/viewvc?rev=690339&view=rev
Log:
QPID-1263: fixed codegen to not ignore passed in boolean values

Added:
    incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java   (with props)
Modified:
    incubator/qpid/trunk/qpid/java/common/Composite.tpl

Modified: incubator/qpid/trunk/qpid/java/common/Composite.tpl
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/Composite.tpl?rev=690339&r1=690338&r2=690339&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/Composite.tpl (original)
+++ incubator/qpid/trunk/qpid/java/common/Composite.tpl Fri Aug 29 10:03:36 2008
@@ -170,7 +170,13 @@
 }
 ${
 if pack > 0:
-  out("        packing_flags |= $(f.flag_mask(pack));")
+  if f.empty:
+    out("        if (value)\\n")
+    out("            packing_flags |= $(f.flag_mask(pack));\\n")
+    out("        else\\n")
+    out("            packing_flags &= ~$(f.flag_mask(pack));")
+  else:
+    out("        packing_flags |= $(f.flag_mask(pack));")
 }
         this.dirty = true;
         return this;

Added: incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java?rev=690339&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java Fri Aug 29 10:03:36 2008
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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.qpid.transport;
+
+import junit.framework.TestCase;
+
+/**
+ * GenTest
+ *
+ */
+
+public class GenTest extends TestCase
+{
+
+    public void testBooleans()
+    {
+        QueueDeclare qd = new QueueDeclare().queue("test-queue").durable(false);
+        assertEquals(qd.getQueue(), "test-queue");
+        assertFalse("durable should be false", qd.getDurable());
+        qd.setDurable(true);
+        assertTrue("durable should be true", qd.getDurable());
+        qd.setDurable(false);
+        assertFalse("durable should be false again", qd.getDurable());
+    }
+
+}

Propchange: incubator/qpid/trunk/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java
------------------------------------------------------------------------------
    svn:eol-style = native