1 package org.jacorb.test.notification.evaluate; 2 3 23 24 import junit.framework.Test; 25 26 import org.jacorb.notification.filter.impl.DefaultETCLEvaluator; 27 import org.jacorb.test.notification.NotificationTestCase; 28 import org.jacorb.test.notification.NotificationTestCaseSetup; 29 import org.omg.CORBA.Any ; 30 import org.omg.CosNotification.Property; 31 import org.omg.CosNotification.PropertyHelper; 32 import org.omg.CosNotification.PropertySeqHelper; 33 34 37 38 public class DynamicEvaluatorTest extends NotificationTestCase { 39 40 private DefaultETCLEvaluator objectUnderTest_; 41 42 public DynamicEvaluatorTest (String name, NotificationTestCaseSetup setup){ 43 super(name, setup); 44 } 45 46 public static Test suite() throws Exception { 47 return NotificationTestCase.suite(DynamicEvaluatorTest.class); 48 } 49 50 51 public void setUpTest() throws Exception { 52 objectUnderTest_ = new DefaultETCLEvaluator(getConfiguration(), getDynAnyFactory()); 53 } 54 55 56 public void testExtractAny() throws Exception { 57 Any _any = getORB().create_any(); 58 _any.insert_long(10); 59 Property p = new Property("number", _any); 60 Any _testData = getORB().create_any(); 61 PropertyHelper.insert(_testData, p); 62 Any a = objectUnderTest_.evaluateIdentifier(_testData, "name"); 63 assertEquals("number", a.extract_string()); 64 } 65 66 67 public void testEvaluateNamedValueList() throws Exception { 68 Any _any = getORB().create_any(); 69 _any.insert_long(10); 70 Property[] p = new Property[1]; 71 p[0] = new Property("number", _any); 72 Any _testData = getORB().create_any(); 73 PropertySeqHelper.insert(_testData, p); 74 Any _result = objectUnderTest_.evaluateNamedValueList(_testData, "number"); 75 Any _second = _result.extract_any(); 76 assertTrue(_second.extract_long() == 10); 77 } 78 } 79 | Popular Tags |