org.apache.usergrid.persistence.model.util.UUIDGenerator.newTimeUUID()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(59)

本文整理了Java中org.apache.usergrid.persistence.model.util.UUIDGenerator.newTimeUUID()方法的一些代码示例,展示了UUIDGenerator.newTimeUUID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUIDGenerator.newTimeUUID()方法的具体详情如下:
包路径:org.apache.usergrid.persistence.model.util.UUIDGenerator
类名称:UUIDGenerator
方法名:newTimeUUID

UUIDGenerator.newTimeUUID介绍

[英]Create a new time uuid
[中]创建一个新的时间uuid

代码示例

代码示例来源:origin: apache/usergrid

/**
 * Create a new ID.  Should only be used for new entities
 * @param type
 */
public SimpleId( final String type ){
  this(UUIDGenerator.newTimeUUID(), type);
}

代码示例来源:origin: apache/usergrid

/**
   * Generate a new UUID, and remove all the '-' characters from the resulting string.
   * @return
   */
  public static String newUUIDString() {
    return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
  }
}

代码示例来源:origin: apache/usergrid

/**
 * When marking nodes for deletion we must use the same unit of measure as the edge timestamps
 * @return
 */
public static long createGraphOperationTimestamp(){
  return UUIDGenerator.newTimeUUID().timestamp();
}

代码示例来源:origin: apache/usergrid

@Override
public Optional<MvccEntity> load( final ApplicationScope scope, final Id entityId ) {
  final EntitySet results = load( scope, Collections.singleton( entityId ), UUIDGenerator.newTimeUUID() );
  return Optional.fromNullable( results.getEntity( entityId ));
}

代码示例来源:origin: apache/usergrid

/**
 * Create the id
 */
public static Id createId( String type ) {
  return createId( UUIDGenerator.newTimeUUID(), type );
}

代码示例来源:origin: apache/usergrid

protected ElasticsearchIndexEvent getESIndexEvent(final IndexOperationMessage indexOperationMessage) {
  final String jsonValue = ObjectJsonSerializer.INSTANCE.toString( indexOperationMessage );
  final UUID newMessageId = UUIDGenerator.newTimeUUID();
  final int expirationTimeInSeconds =
    ( int ) TimeUnit.MILLISECONDS.toSeconds( indexProcessorFig.getIndexMessageTtl() );
  //write to the map in ES
  esMapPersistence.putString( newMessageId.toString(), jsonValue, expirationTimeInSeconds );
  return new ElasticsearchIndexEvent(queueFig.getPrimaryRegion(), newMessageId );
}

代码示例来源:origin: apache/usergrid

/**
   * Null entity type
   */
  private static Id nullEntityType() {
    final Id entityId = mock( Id.class );
    when( entityId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
    when( entityId.getType() ).thenReturn( null );
    return entityId;
  }
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void mockApp() {
  this.scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( this.scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
  serialization = getSerializationImpl();
}

代码示例来源:origin: apache/usergrid

@Test( expected = UnsupportedOperationException.class )
public void loadAscendingHistory() throws ConnectionException {
  final Id applicationId = new SimpleId( "application" );
  final String name = "test";
  ApplicationScope context = new ApplicationScopeImpl( applicationId );
  final Id entityId = new SimpleId( UUIDGenerator.newTimeUUID(), name );
  final UUID version1 = UUIDGenerator.newTimeUUID();
  serializationStrategy.loadAscendingHistory( context, entityId, version1, 20 );
}

代码示例来源:origin: apache/usergrid

@Test
public void multiReadNoKey() {
  MapManager mm = mmf.createMapManager( this.scope );
  final String key = UUIDGenerator.newTimeUUID().toString();
  final Map<String, String> results = mm.getStrings( Collections.singleton( key ) );
  assertNotNull( results );
  final String shouldBeMissing = results.get( key );
  assertNull( shouldBeMissing );
}

代码示例来源:origin: apache/usergrid

private MvccEntity getEntity( final String type ) {
  final SimpleId entityId = new SimpleId( type );
  final UUID version = UUIDGenerator.newTimeUUID();
  final Entity entity = new Entity( entityId );
  MvccEntityImpl logEntry = new MvccEntityImpl( entityId, version, MvccEntity.Status.COMPLETE, entity );
  return logEntry;
}

代码示例来源:origin: apache/usergrid

protected void before( Description description ) throws Exception {
  final String orgName = description.getClassName()+ UUIDGenerator.newTimeUUID();
  final String appName = description.getMethodName();
  createApplication( orgName, appName  );
}

代码示例来源:origin: apache/usergrid

@Test(expected = NullPointerException.class)
public void deleteParamEntityId() throws ConnectionException {
  serializationStrategy.delete(
      new ApplicationScopeImpl( new SimpleId( "organization" ) ), null,
      UUIDGenerator.newTimeUUID() );
}

代码示例来源:origin: apache/usergrid

@Test(expected = NullPointerException.class)
public void loadParamEntityId() throws ConnectionException {
  serializationStrategy
      .load( new ApplicationScopeImpl(new SimpleId( "organization" ) ), null, UUIDGenerator.newTimeUUID() );
}

代码示例来源:origin: apache/usergrid

@Test
  public void testBasicOperation() {

    EntityVersion original = new EntityVersion( new SimpleId("test"), UUIDGenerator.newTimeUUID() );

    EntityVersionSerializer evs = new EntityVersionSerializer();
    ByteBuffer serialized = evs.toByteBuffer(original);

    EntityVersion deserialized = evs.fromBytes( serialized.array() );

    Assert.assertEquals( original, deserialized );
  }
}

代码示例来源:origin: apache/usergrid

public void doTest( Field<?> field ) {

    final UUID version = UUIDGenerator.newTimeUUID();

    final UniqueFieldEntry entry = new UniqueFieldEntry( version, field );

    final ByteBuffer buffer = TEST.toByteBuffer( entry );

    final UniqueFieldEntry returned = TEST.fromByteBuffer( buffer );

    assertEquals( "Same field", field, returned.getField() );

    assertEquals( "Same version", version, returned.getVersion() );
  }
}

代码示例来源:origin: apache/usergrid

@Test
public void correctValue() {
  final SimpleId entityId = new SimpleId( "test" );
  final UUID version = UUIDGenerator.newTimeUUID();
  final Stage stage = Stage.COMPLETE;
  final MvccLogEntry.State state = MvccLogEntry.State.COMPLETE;
  MvccLogEntry logEntry = new MvccLogEntryImpl( entityId, version, stage, state );
  assertEquals( entityId, logEntry.getEntityId() );
  assertEquals( version, logEntry.getVersion() );
  assertEquals( stage, logEntry.getStage() );
}

相关文章

微信公众号

最新文章

更多

UUIDGenerator类方法