KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > notification > evaluate > DynamicEvaluatorTest


1 package org.jacorb.test.notification.evaluate;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1999-2003 Gerald Brose
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */

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 JavaDoc;
30 import org.omg.CosNotification.Property;
31 import org.omg.CosNotification.PropertyHelper;
32 import org.omg.CosNotification.PropertySeqHelper;
33
34 /**
35  * @author Alphonse Bendt
36  */

37
38 public class DynamicEvaluatorTest extends NotificationTestCase {
39
40     private DefaultETCLEvaluator objectUnderTest_;
41
42     public DynamicEvaluatorTest (String JavaDoc name, NotificationTestCaseSetup setup){
43         super(name, setup);
44     }
45
46     public static Test suite() throws Exception JavaDoc {
47         return NotificationTestCase.suite(DynamicEvaluatorTest.class);
48     }
49
50
51     public void setUpTest() throws Exception JavaDoc {
52         objectUnderTest_ = new DefaultETCLEvaluator(getConfiguration(), getDynAnyFactory());
53     }
54
55
56     public void testExtractAny() throws Exception JavaDoc {
57         Any JavaDoc _any = getORB().create_any();
58         _any.insert_long(10);
59         Property p = new Property("number", _any);
60         Any JavaDoc _testData = getORB().create_any();
61         PropertyHelper.insert(_testData, p);
62         Any JavaDoc a = objectUnderTest_.evaluateIdentifier(_testData, "name");
63         assertEquals("number", a.extract_string());
64     }
65
66
67     public void testEvaluateNamedValueList() throws Exception JavaDoc {
68         Any JavaDoc _any = getORB().create_any();
69         _any.insert_long(10);
70         Property[] p = new Property[1];
71         p[0] = new Property("number", _any);
72         Any JavaDoc _testData = getORB().create_any();
73         PropertySeqHelper.insert(_testData, p);
74         Any JavaDoc _result = objectUnderTest_.evaluateNamedValueList(_testData, "number");
75         Any JavaDoc _second = _result.extract_any();
76         assertTrue(_second.extract_long() == 10);
77     }
78 }
79
Popular Tags