List of usage examples for java.util UUID randomUUID
public static UUID randomUUID()
From source file:io.sidecar.org.Organization.java
public Organization(String name, String url, OrganizationType type) { this.orgId = UUID.randomUUID(); Preconditions.checkNotNull(name);/* w ww . j av a 2 s . c o m*/ Preconditions.checkArgument(StringUtils.isNotBlank(name)); this.name = name; Preconditions.checkNotNull(url); Preconditions.checkArgument(StringUtils.isNotBlank(url)); Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(url)); this.url = url; Preconditions.checkNotNull(type); this.type = type; }
From source file:org.messic.server.facade.security.AuthenticationSessionManager.java
/** * Perform an authentication, returning the token associated * // ww w . j a v a2s. co m * @param authentication * @return */ public static String successfulAuthentication(Authentication authentication) { try { String token = UUID.randomUUID().toString(); AuthenticationHolder authHolder = new AuthenticationHolder(); for (GrantedAuthority gauth : authentication.getAuthorities()) { authHolder.authorities.add(gauth.getAuthority()); } authHolder.auth = authentication; authMap.put(token, authHolder); return token; } catch (AuthenticationException e) { return null; } }
From source file:org.opensafety.hishare.model.factories.PermissionFactory.java
private Long createPermissionId() { return UUID.randomUUID().getLeastSignificantBits(); }
From source file:com.github.robozonky.common.remote.InterceptingInputStreamTest.java
@Test void standard() throws IOException { final String contents = UUID.randomUUID().toString(); final InputStream s = new ByteArrayInputStream(contents.getBytes()); try (final InterceptingInputStream s2 = new InterceptingInputStream(s)) { // first check content has been intercepted assertThat(s2.getContents()).isEqualTo(contents); // then check content is still available assertThat(IOUtils.toString(s2, Defaults.CHARSET)).isEqualTo(contents); }/*from www. j a va2s. c o m*/ }
From source file:com.dangdang.ddframe.reg.spring.placeholder.RegistryPropertySource.java
public RegistryPropertySource(final RegistryCenter source) { super(UUID.randomUUID().toString(), source); this.source = source; }
From source file:org.fcrepo.integration.kernel.impl.AbstractIT.java
public String getRandomPid() { return UUID.randomUUID().toString(); }
From source file:com.dangdang.config.service.support.spring.ConfigGroupResource.java
public ConfigGroupResource(ConfigGroup configNode) { super(UUID.randomUUID().toString(), configNode); }
From source file:org.elasticsoftware.elasticactors.examples.pi.messages.Calculate.java
public Calculate() { this(UUID.randomUUID().toString()); }
From source file:com.emacs.xpets.utils.Utils.java
public static String getMachineKey(Context context) { String value = System.getProperty(Constants.MACHINE_KEY); if (value == null) { SharedPreferences sp = context.getSharedPreferences(Constants.MACHINE_KEY, Context.MODE_PRIVATE); value = sp.getString(Constants.MACHINE_KEY, null); if (value == null) { value = UUID.randomUUID().toString(); Editor editor = sp.edit();/*from w ww . jav a 2 s .co m*/ editor.putString(Constants.MACHINE_KEY, value); editor.commit(); } System.setProperty(Constants.MACHINE_KEY, value); } return value; }
From source file:de.perdian.commons.i18n.polyglot.PolyglotInvocationHandlerTest.java
@Test public void testInvoke() { MessageSource messageSource = Mockito.mock(MessageSource.class); PolyglotInvocationInfo invocationInfo = new PolyglotInvocationInfo(); invocationInfo.setKey(UUID.randomUUID().toString()); invocationInfo.setDefaultValue(UUID.randomUUID().toString()); Object[] arguments = new Object[] { "a", 42 }; PolyglotInvocationHandler invocationHandler = new PolyglotInvocationHandler(); invocationHandler.setLocale(Locale.GERMANY); invocationHandler.setMessageSource(messageSource); invocationHandler.setInfoMap(Collections.singletonMap((Method) null, invocationInfo)); invocationHandler.invoke(null, null, arguments); // Make sure all the information get's passed correctly to the // underlaying MessageSource implementation Mockito.verify(messageSource).getMessage(Matchers.eq(invocationInfo.getKey()), Matchers.eq(arguments), Matchers.eq(invocationInfo.getDefaultValue()), Matchers.eq(invocationHandler.getLocale())); }