Update of /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/wbem
In directory vz-cvs-3.sog:/tmp/cvs-serv1795/utst/org/sblim/cimclient/unittest/wbem
Modified Files:
WBEMListenerTest.java
Log Message:
3529065 - Enable WBEMListener get/setProperty
Index: WBEMListenerTest.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/wbem/WBEMListenerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- WBEMListenerTest.java 13 Jun 2012 23:23:18 -0000 1.2
+++ WBEMListenerTest.java 20 Jun 2012 18:09:50 -0000 1.3
@@ -15,12 +15,14 @@
* Flag Date Prog Description
*-------------------------------------------------------------------------------
* 3529062 2012-05-23 blaschke-oss WBEMListenerFactory should return new instance
+ * 3529065 2012-05-31 hellerda Enable WBEMListener get/setProperty
*/
package org.sblim.cimclient.unittest.wbem;
import javax.wbem.client.WBEMClientConstants;
import javax.wbem.listener.WBEMListener;
+import javax.wbem.listener.WBEMListenerConstants;
import javax.wbem.listener.WBEMListenerFactory;
import org.sblim.cimclient.unittest.TestCase;
@@ -34,10 +36,41 @@
* Tests if the listener factory returns unique instances
*/
public void testListenerInstance() {
+ String pw1 = "passw0rd", pw2 = "abc123";
+
WBEMListener listener1 = WBEMListenerFactory
.getListener(WBEMClientConstants.PROTOCOL_CIMXML);
WBEMListener listener2 = WBEMListenerFactory
.getListener(WBEMClientConstants.PROTOCOL_CIMXML);
verify("Listener instances not different!", !listener1.equals(listener2));
+
+ // Uninitialized props should be same (null or empty string)
+ String testProperty = WBEMListenerConstants.PROP_LISTENER_KEYSTORE;
+ String prop1 = listener1.getProperty(testProperty);
+ String prop2 = listener2.getProperty(testProperty);
+ verify("Uninitialized property \'" + testProperty +"\' not null!",
+ prop1 == null && prop2 == null);
+
+ testProperty = WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD;
+ prop1 = listener1.getProperty(testProperty);
+ prop2 = listener2.getProperty(testProperty);
+ verify("Uninitialized property \'" + testProperty +"\' not empty string!",
+ prop1 == "" && prop2 == "");
+
+ testProperty = WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE;
+ prop1 = listener1.getProperty(testProperty);
+ prop2 = listener2.getProperty(testProperty);
+ verify("Uninitialized property \'" + testProperty +"\' not null!",
+ prop1 == null && prop2 == null);
+
+ // Initialized props should not collide
+ listener1.setProperty(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD, pw1);
+ listener2.setProperty(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD, pw2);
+ prop1 = listener1.getProperty(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD);
+ prop2 = listener2.getProperty(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD);
+ verify("Initialized property not as expected! " + pw1 + " vs " + prop1, pw1
+ .equalsIgnoreCase(prop1));
+ verify("Initialized property not as expected! " + pw2 + " vs " + prop2, pw2
+ .equalsIgnoreCase(prop2));
}
}
|