01: /*
02: * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.monitoring.utilities.test;
06:
07: import com.sun.portal.monitoring.utilities.Hallmark;
08: import com.sun.portal.monitoring.utilities.UtilityException;
09: import com.sun.portal.monitoring.utilities.PropertyHelper;
10: import junit.framework.Test;
11: import junit.framework.TestCase;
12: import junit.framework.TestSuite;
13:
14: import javax.crypto.SealedObject;
15: import java.util.Properties;
16:
17: public class TestHallmark extends TestCase {
18: public TestHallmark(final String name) {
19: super (name);
20: }
21:
22: public static void main(final String[] args) {
23: junit.textui.TestRunner.run(suite());
24: }
25:
26: public static Test suite() {
27: final TestSuite suite = new TestSuite(TestHallmark.class);
28: return suite;
29: }
30:
31: public void testHallmark() throws UtilityException {
32: ASerializable input = new ASerializable();
33: input.testString = new String("Test String");
34:
35: Hallmark hallmark = new Hallmark(new PropertyHelper(
36: new Properties()));
37: SealedObject sealedObject = hallmark.seal(input);
38:
39: ASerializable output = (ASerializable) hallmark
40: .unSeal(sealedObject);
41: assertEquals("UnSeal should give same test string!",
42: input.testString, output.testString);
43: }
44: }
|