diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2008-10-03 15:35:25 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2008-10-03 15:35:25 +0000 |
commit | c8fcdb008af74a937599a9b94ae169762bbc437d (patch) | |
tree | ea94e4b8a66d288dc96554a5915ba5b76ca7247d /cpp/src/tests/QueueOptionsTest.cpp | |
parent | 426016b62c05856f6ef884e73fcaec88f43bd1a2 (diff) | |
download | qpid-python-c8fcdb008af74a937599a9b94ae169762bbc437d.tar.gz |
QPID-1306
- missing file from last commit
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@701413 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/QueueOptionsTest.cpp')
-rw-r--r-- | cpp/src/tests/QueueOptionsTest.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/cpp/src/tests/QueueOptionsTest.cpp b/cpp/src/tests/QueueOptionsTest.cpp new file mode 100644 index 0000000000..308ba994c4 --- /dev/null +++ b/cpp/src/tests/QueueOptionsTest.cpp @@ -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() |