Package org.teiid.core.id

Examples of org.teiid.core.id.UUID$Version


  }
 
  public static Version toWGAVersion(VersionCompliance versionCompliance) {
    if (versionCompliance != null) {
      if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA3)) {
        return new Version(3, 0, 0);
      } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA4)) {
        return new Version(4, 0, 0);
      } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA41)) {
        return new Version(4, 1, 0);
      } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA50)) {
        return new Version(5, 0 ,0);
      } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA51)) {
                return new Version(5, 1 ,0);
            } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA52)) {
                return new Version(5, 2 ,0);
            } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA53)) {
                return new Version(5, 3 ,0);
            } else if (versionCompliance.getKey().equals(VERSIONCOMPLIANCE_WGA54)) {
                return new Version(5, 4 ,0);
            }
    }
    return null;
  }
View Full Code Here


        bean.setUniqueName(sValue)
        update(bean);
        break;
      case 1:
        try {       
          bean.setVersion(new Version((String)value));
          update(bean);
        } catch (RuntimeException e) {
          // unparsable version
            throw new IllegalArgumentException("Unparseable plugin version");
        }
View Full Code Here

    /**
     * Test UUID generation for IDs generated from powers of 2.
     */
    private static void helpTestGenPowers( int nGen ) {
        UUID uuid = null;

        // First test some fairly "regular" numbers...
        for ( int j = 0; j < Math.min(nGen,63); j++ ) {
            long v1 = 1L << j;
            long v2 = (1L << j)/2;
            uuid = new UUID(v1,v2);
            checkStringToObject(uuid)// Test case may fail here
        }
    }
View Full Code Here

   
    /**
     * Test UUID generation for IDs generated randomly.
     */
    private static void helpTestGenRandom( int nGen ) {
        UUID uuid = null;

        // Then test some random numbers...
        java.util.Random rng = new java.util.Random();
        for ( int k = 0; k < nGen; k++ ) {
            long v1 = rng.nextLong();
            long v2 = rng.nextLong();
            uuid = new UUID(v1,v2);
            checkStringToObject(uuid)// Test case may fail here
        }
    }
View Full Code Here

   
    /**
     * Test for duplicates when generating a bunch of IDs.
     */
    private static void helpTestDuplicates( int nGen ) {
        UUID uuid = null;
        Set uuids = new HashSet();
//        Set duplicates = new HashSet();

        // First test some fairly "regular" numbers...
        for ( int j = 0; j < Math.min(nGen,63); j++ ) {
            long v1 = 1L << j;
            long v2 = (1L << j)/2;
            uuid = new UUID(v1,v2);
            assertTrue( "UUID '" + uuid + "' is a duplicate!", !uuids.contains(uuid) ); //$NON-NLS-1$ //$NON-NLS-2$
            uuids.add(uuid);
        }

        // Then test some random numbers...
        java.util.Random rng = new java.util.Random();
        for ( int k = 0; k < nGen; k++ ) {
            long v1 = rng.nextLong();
            long v2 = rng.nextLong();
            uuid = new UUID(v1,v2);
            if ( uuids.contains(uuid) ) {
                fail( "UUID '" + uuid + "' is a duplicate!" ); //$NON-NLS-1$ //$NON-NLS-2$
            }
            uuids.add(uuid);
        }
View Full Code Here

     * @param id1 The ID to test
     */
    public static void checkStringToObject( UUID id1 ) {
        String uuidString = id1.exportableForm();

        UUID id2 = null;
        try {
            id2 = (UUID)UUID.stringToObject( uuidString );
        } catch ( InvalidIDException e ) {
            fail( "Could not convert UUID exportable form '" + uuidString + "' to UUID: " //$NON-NLS-1$ //$NON-NLS-2$
                + e.getMessage() );
View Full Code Here

TOP

Related Classes of org.teiid.core.id.UUID$Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.