You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cc...@apache.org on 2008/10/03 17:35:25 UTC

svn commit: r701413 - /incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp

Author: cctrieloff
Date: Fri Oct  3 08:35:25 2008
New Revision: 701413

URL: http://svn.apache.org/viewvc?rev=701413&view=rev
Log:
QPID-1306

- missing file from last commit


Added:
    incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp

Added: incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp?rev=701413&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp Fri Oct  3 08:35:25 2008
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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.
+ *
+ */
+#include <iostream>
+#include "qpid/framing/Array.h"
+#include "qpid/client/QueueOptions.h"
+#include <alloca.h>
+
+#include "unit_test.h"
+
+using namespace qpid::client;
+
+
+QPID_AUTO_TEST_SUITE(QueueOptionsTestSuite)
+
+QPID_AUTO_TEST_CASE(testSizePolicy)
+{
+    QueueOptions ft;
+	
+	ft.setSizePolicy(REJECT,1,2);
+	
+    BOOST_CHECK(QueueOptions::strREJECT == ft.getString(QueueOptions::strTypeKey));
+    BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
+    BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+
+	ft.setSizePolicy(FLOW_TO_DISK,0,2);
+    BOOST_CHECK(QueueOptions::strFLOW_TO_DISK == ft.getString(QueueOptions::strTypeKey));
+    BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
+    BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+
+	ft.setSizePolicy(RING,1,0);
+    BOOST_CHECK(QueueOptions::strRING == ft.getString(QueueOptions::strTypeKey));
+
+	ft.setSizePolicy(RING_STRICT,1,0);
+    BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getString(QueueOptions::strTypeKey));
+	
+	ft.clearSizePolicy();
+	BOOST_CHECK(!ft.isSet(QueueOptions::strTypeKey));
+	BOOST_CHECK(!ft.isSet(QueueOptions::strMaxSizeKey));
+	BOOST_CHECK(!ft.isSet(QueueOptions::strMaxCountKey));
+}
+
+QPID_AUTO_TEST_CASE(testFlags)
+{
+    QueueOptions ft;
+	
+	ft.setOptimisticConsume();
+	ft.setPersistLastNode();
+	
+    BOOST_CHECK(1 == ft.getInt(QueueOptions::strOptimisticConsume));
+    BOOST_CHECK(1 == ft.getInt(QueueOptions::strPersistLastNode));
+	
+	ft.clearOptimisticConsume();
+	ft.clearPersistLastNode();
+
+	BOOST_CHECK(!ft.isSet(QueueOptions::strOptimisticConsume));
+	BOOST_CHECK(!ft.isSet(QueueOptions::strPersistLastNode));
+
+}
+
+
+QPID_AUTO_TEST_SUITE_END()