You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/10/16 18:51:30 UTC
svn commit: r1632383 - in
/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model:
AbstractConfiguredObjectTest.java testmodel/TestChildCategory.java
testmodel/TestRootCategory.java
Author: rgodfrey
Date: Thu Oct 16 16:51:30 2014
New Revision: 1632383
URL: http://svn.apache.org/r1632383
Log:
QPID-6159 : add test
Modified:
qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java
qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java?rev=1632383&r1=1632382&r2=1632383&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java Thu Oct 16 16:51:30 2014
@@ -24,16 +24,15 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.model.testmodel.TestChildCategory;
import org.apache.qpid.server.model.testmodel.TestConfiguredObject;
import org.apache.qpid.server.model.testmodel.TestModel;
import org.apache.qpid.server.model.testmodel.TestRootCategory;
import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import org.apache.qpid.test.utils.QpidTestCase;
-public class AbstractConfiguredObjectTest extends TestCase
+public class AbstractConfiguredObjectTest extends QpidTestCase
{
private final Model _model = TestModel.getInstance();
@@ -169,6 +168,27 @@ public class AbstractConfiguredObjectTes
System.clearProperty(sysPropertyName);
}
+
+ public void testDefaultContextIsInContextKeys()
+ {
+ final String objectName = "myName";
+
+ Map<String, Object> attributes = new HashMap<>();
+ attributes.put(ConfiguredObject.NAME, objectName);
+
+
+ TestRootCategory object = _model.getObjectFactory().create(TestRootCategory.class,
+ attributes);
+
+
+ assertTrue("context default not in contextKeys", object.getContextKeys(true).contains(TestRootCategory.TEST_CONTEXT_DEFAULT));
+ assertEquals(object.getContextValue(String.class, TestRootCategory.TEST_CONTEXT_DEFAULT), "default");
+
+ setTestSystemProperty(TestRootCategory.TEST_CONTEXT_DEFAULT, "notdefault");
+ assertTrue("context default not in contextKeys", object.getContextKeys(true).contains(TestRootCategory.TEST_CONTEXT_DEFAULT));
+ assertEquals(object.getContextValue(String.class, TestRootCategory.TEST_CONTEXT_DEFAULT), "notdefault");
+ }
+
public void testStringAttributeValueFromContextVariableProvidedObjectsContext()
{
String contextToken = "${myReplacement}";
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java?rev=1632383&r1=1632382&r2=1632383&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java Thu Oct 16 16:51:30 2014
@@ -24,12 +24,12 @@ import java.util.Set;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.ManagedContextDefault;
import org.apache.qpid.server.model.ManagedObject;
@ManagedObject
public interface TestChildCategory<X extends TestChildCategory<X>> extends ConfiguredObject<X>
{
-
String NON_INTERPOLATED_VALID_VALUE = "${file.separator}";
@ManagedAttribute(validValues = { NON_INTERPOLATED_VALID_VALUE }, defaultValue = "")
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java?rev=1632383&r1=1632382&r2=1632383&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java Thu Oct 16 16:51:30 2014
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.ManagedContextDefault;
import org.apache.qpid.server.model.ManagedObject;
@ManagedObject( defaultType = "test" )
@@ -35,6 +36,13 @@ public interface TestRootCategory<X exte
String STRING_VALUE = "stringValue";
String MAP_VALUE = "mapValue";
+
+ String TEST_CONTEXT_DEFAULT = "TEST_CONTEXT_DEFAULT";
+
+ @ManagedContextDefault(name = TEST_CONTEXT_DEFAULT)
+ String testGlobalDefault = "default";
+
+
@ManagedAttribute
String getAutomatedPersistedValue();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org