001: /*
002: * (c) Copyright 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: * All rights reserved.
004: * [See end of file]
005: */
006:
007: package com.hp.hpl.jena.shared.uuid.test;
008:
009: //import junit.framework.TestCase;
010: //import java.util.UUID ;
011: //
012: //import com.hp.hpl.jena.shared.uuid.*;
013:
014: /** Java5-dependent tests.
015: * java.util.UUID only appeared in Java5
016: * @author Andy Seaborne
017: * @version $Id: TestUUID_J5.java,v 1.4 2008/01/02 12:09:21 andy_seaborne Exp $
018: */
019:
020: public class TestUUID_J5 {
021: }
022:
023: //public class TestUUID_J5 extends TestCase
024: //{
025: // UUID_V1_Gen factory1 = new UUID_V1_Gen() ;
026: // UUID_V4_Gen factory4 = new UUID_V4_Gen() ;
027: //
028: // public void testU5_1()
029: // {
030: // JenaUUID u1 = JenaUUID.generate() ;
031: // UUID u2 = UUID.fromString(u1.asString()) ;
032: // assertEquals(u1.getVersion(), u2.version()) ;
033: // assertEquals(u1.getVariant(), u2.variant()) ;
034: // }
035: //
036: // public void testU5_2()
037: // {
038: // UUID_V1 u1 = factory1.generateV1() ;
039: // UUID u2 = UUID.fromString(u1.asString()) ;
040: // assertEquals(u1.getClockSequence(), u2.clockSequence()) ;
041: // assertEquals(u1.getTimestamp() , u2.timestamp() ) ;
042: // assertEquals(u1.getNode(), u2.node()) ;
043: // assertEquals(u1.getVariant(), u2.variant()) ;
044: // assertEquals(u1.getVersion() , u2.version()) ;
045: // assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
046: // assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
047: // }
048: //
049: // public void testU5_3()
050: // {
051: // UUID_V4 u1 = factory4.generateV4() ;
052: // UUID u2 = UUID.fromString(u1.asString()) ;
053: // assertEquals(u1.getVariant(), u2.variant()) ;
054: // assertEquals(u1.getVersion() , u2.version()) ;
055: // assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
056: // assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
057: // }
058: //
059: // public void testU5_4()
060: // {
061: // UUID u1 = UUID.randomUUID() ;
062: // JenaUUID u2 = JenaUUID.parse(u1.toString()) ;
063: // assertEquals(u1.version(), u2.getVersion()) ;
064: // assertEquals(u1.variant(), u2.getVariant()) ;
065: // assertEquals(u1.getMostSignificantBits() , u2.getMostSignificantBits()) ;
066: // assertEquals(u1.getLeastSignificantBits() , u2.getLeastSignificantBits()) ;
067: // assertEquals(u1.toString() , u2.toString()) ;
068: // }
069: //
070: // public void testU5_5()
071: // {
072: // JenaUUID u1 = factory1.generate() ;
073: // UUID u2 = new UUID(u1.getMostSignificantBits(), u1.getLeastSignificantBits()) ;
074: //
075: // assertEquals(u1.getVersion(), u2.version()) ;
076: // assertEquals(u1.getVariant(), u2.variant()) ;
077: // assertEquals(u1.getMostSignificantBits() , u2.getMostSignificantBits()) ;
078: // assertEquals(u1.getLeastSignificantBits() , u2.getLeastSignificantBits()) ;
079: // assertEquals(u1.toString() , u2.toString()) ;
080: // }
081: //
082: // public void testU5_6()
083: // {
084: // JenaUUID u1 = factory4.generate() ;
085: // UUID u2 = new UUID(u1.getMostSignificantBits(), u1.getLeastSignificantBits()) ;
086: //
087: // assertEquals(u1.getVersion(), u2.version()) ;
088: // assertEquals(u1.getVariant(), u2.variant()) ;
089: // assertEquals(u1.getMostSignificantBits() , u2.getMostSignificantBits()) ;
090: // assertEquals(u1.getLeastSignificantBits() , u2.getLeastSignificantBits()) ;
091: // assertEquals(u1.toString() , u2.toString()) ;
092: // }
093: //
094: // private void check(String uuidString)
095: // {
096: // JenaUUID uuid = JenaUUID.parse(uuidString) ;
097: // //assertFalse(u.equals(JenaUUID.nil())) ;
098: // String s2 = uuid.asString() ;
099: //
100: // String s = uuidString ;
101: // if ( s.matches("[uU][rR][nN]:") )
102: // s = s.substring(4) ;
103: // if ( s.startsWith("[uU][uU][iI][dD]:") )
104: // s = s.substring(5) ;
105: //
106: // assertTrue(uuidString.equalsIgnoreCase(s)) ;
107: // }
108: //
109: // private void check(JenaUUID uuid)
110: // {
111: // String s = uuid.asString() ;
112: // if ( uuid.isNil() )
113: // {
114: // assertEquals(JenaUUID.strNil(), s) ;
115: // return ;
116: // }
117: // JenaUUID uuid2 = JenaUUID.parse(s) ;
118: // assertTrue(uuid2.equals(uuid)) ;
119: // }
120: //}
121:
122: /*
123: * (c) Copyright 2006, 2007, 2008 Hewlett-Packard Development Company, LP
124: * All rights reserved.
125: *
126: * Redistribution and use in source and binary forms, with or without
127: * modification, are permitted provided that the following conditions
128: * are met:
129: * 1. Redistributions of source code must retain the above copyright
130: * notice, this list of conditions and the following disclaimer.
131: * 2. Redistributions in binary form must reproduce the above copyright
132: * notice, this list of conditions and the following disclaimer in the
133: * documentation and/or other materials provided with the distribution.
134: * 3. The name of the author may not be used to endorse or promote products
135: * derived from this software without specific prior written permission.
136: *
137: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
138: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
139: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
140: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
141: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
142: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
143: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
144: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
145: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
146: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147: */
|