List of usage examples for java.util UUID toString
public String toString()
From source file:io.selendroid.server.model.SelendroidStandaloneDriverTest.java
@Test public void shouldCreateNewTestSession() throws Exception { // Setting up driver with test app and device stub SelendroidStandaloneDriver driver = getSelendroidStandaloneDriver(); SelendroidConfiguration conf = new SelendroidConfiguration(); conf.addSupportedApp(new File(APK_FILE).getAbsolutePath()); driver.initApplicationsUnderTest(conf); DeviceStore store = new DeviceStore(false, EMULATOR_PORT, anDeviceManager()); DeviceForTest emulator = new DeviceForTest(DeviceTargetPlatform.ANDROID16); Random random = new Random(); final UUID definedSessionId = new UUID(random.nextLong(), random.nextLong()); emulator.testSessionListener = new TestSessionListener(definedSessionId.toString(), "test") { @Override/*from w w w .j av a2 s. c om*/ public SelendroidResponse executeSelendroidRequest(Properties params) { return null; } }; store.addDeviceToStore(emulator); driver.setDeviceStore(store); // testing new session creation SelendroidCapabilities capa = new SelendroidCapabilities(); capa.setAut(TEST_APP_ID); capa.setAndroidTarget(DeviceTargetPlatform.ANDROID16.name()); try { String sessionId = driver.createNewTestSession(new JSONObject(capa.asMap()), 0); Assert.assertNotNull(UUID.fromString(sessionId)); } finally { // this will also stop the http server emulator.stop(); } }
From source file:com.intellectualcrafters.plot.uuid.NameFetcher.java
@Override public Map<UUID, String> call() throws Exception { final Map<UUID, String> uuidStringMap = new HashMap<>(); for (final UUID uuid : this.uuids) { if (uuidStringMap.containsKey(uuid)) { continue; }/*from w w w . ja va 2 s.co m*/ final HttpURLConnection connection = (HttpURLConnection) new URL( PROFILE_URL + uuid.toString().replace("-", "")).openConnection(); final JSONObject response = (JSONObject) this.jsonParser .parse(new InputStreamReader(connection.getInputStream())); final String name = (String) response.get("name"); if (name == null) { continue; } final String cause = (String) response.get("cause"); final String errorMessage = (String) response.get("errorMessage"); if ((cause != null) && (cause.length() > 0)) { throw new IllegalStateException(errorMessage); } uuidStringMap.put(uuid, name); } return uuidStringMap; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUuidDefDefaultValue.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFBamMssCFBindUuidDefDefaultValue.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/* w w w . j a v a2 s . c o m*/ ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFBamUuidDefObj) { UUID defaultValue = ((ICFBamUuidDefObj) genDef).getOptionalDefaultValue(); if (defaultValue == null) { ret = null; } else { ret = defaultValue.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFBamUuidDefObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUuidDefUnknownValue.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFBamMssCFBindUuidDefUnknownValue.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//from www. j a v a 2s . c o m ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFBamUuidDefObj) { UUID unknownValue = ((ICFBamUuidDefObj) genDef).getOptionalUnknownValue(); if (unknownValue == null) { ret = null; } else { ret = unknownValue.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFBamUuidDefObj"); } return (ret); }
From source file:eu.dasish.annotation.backend.dao.impl.JdbcTargetDaoTest.java
/** * Test of getExternalID method, of class JdbcTargetDao. *//* w ww. j a v a 2s. c o m*/ @Test public void testGetExternalID() { System.out.println("getExternalID"); UUID result = jdbcTargetDao.getExternalID(1); assertEquals("00000000-0000-0000-0000-000000000031", result.toString()); }
From source file:com.rest.UserRest.java
@RequestMapping(value = "/createUser", method = RequestMethod.POST) @Transactional/* w w w. j a v a 2 s .com*/ public ResponseEntity createUser(@Valid @RequestBody UserRequestDto userRequestDto) { UserEntity user = userRepository.findByUsername(userRequestDto.getUsername()); if (user != null) { throw new RuntimeException(bundleMessageReader.getMessage("UserAlreadyRegistered")); } String encodedPassword = standardPasswordEncoder.encode(userRequestDto.getPassword()); userRequestDto.setPassword(encodedPassword); user = modelMapper.map(userRequestDto, UserEntity.class); user.setEnabled(false); UUID emailVerificationToken = UUID.randomUUID(); user.setEmailVerificationToken(emailVerificationToken.toString()); userRepository.save(user); AuthorityEntity authorityEntity = new AuthorityEntity(); authorityEntity.setUsername(user.getUsername()); authorityEntity.setAuthority("SYSTEM_USER"); authorityRepository.save(authorityEntity); // initial role is assigned to the new user (needed by spring security) if (emailSender == null) {// this check needed for unit testing perposes emailSender = new EmailSender(mailSender, emailTemplateResolver, thymeleaf, user.getUsername(), mailSendFrom); } String requestBaseUrl = this.gatewayHost + ':' + this.gatewayPort + this.contextPath; emailSender.sendVerificationTokenEmail(emailVerificationToken.toString(), requestBaseUrl); return new ResponseEntity(HttpStatus.OK); }
From source file:com.servioticy.api.commons.data.Subscription.java
/** Create a Subscription * * @param soId/*from www . j a v a 2s . co m*/ * @param streamId * @param body */ public Subscription(SO so, String userId, String streamId, String body) { JsonNode root; soParent = so; JsonNode stream = soParent.getStream(streamId); this.userId = userId; // Check if exists this streamId in the Service Object if (stream == null) throw new ServIoTWebApplicationException(Response.Status.NOT_FOUND, "This Service Object does not have this stream."); try { root = mapper.readTree(body); } catch (JsonProcessingException e) { LOG.error(e); throw new ServIoTWebApplicationException(Response.Status.BAD_REQUEST, e.getMessage()); } catch (IOException e) { LOG.error(e); throw new ServIoTWebApplicationException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()); } // Check if exists callback field in body request if (root.path("callback").isMissingNode()) throw new ServIoTWebApplicationException(Response.Status.BAD_REQUEST, "No callback in the request"); // Check if exists destination field in body request if (root.path("destination").isMissingNode()) throw new ServIoTWebApplicationException(Response.Status.BAD_REQUEST, "No destination in the request"); // Check repeated subscriptions for pubsub subscriptions if (root.get("callback").asText().equals("pubsub")) if (SearchEngine.getRepeatedSubscriptions(root.get("destination").asText(), soParent.getId(), "pubsub", streamId) > 0) throw new ServIoTWebApplicationException(Response.Status.BAD_REQUEST, "Duplicated pubsub subscription"); // OK, create the subscription // servioticy key = subsId // TODO improve key and subsId generation UUID uuid = UUID.randomUUID(); //UUID java library subsId = uuid.toString().replaceAll("-", ""); subsKey = soParent.getId() + "-" + streamId + "-" + subsId; ((ObjectNode) subsRoot).put("id", subsId); ((ObjectNode) subsRoot).put("userId", userId); long time = System.currentTimeMillis(); ((ObjectNode) subsRoot).put("createdAt", time); ((ObjectNode) subsRoot).put("updatedAt", time); ((ObjectNode) subsRoot).put("callback", root.get("callback").asText()); ((ObjectNode) subsRoot).put("source", soParent.getId()); ((ObjectNode) subsRoot).put("destination", root.get("destination").asText()); ((ObjectNode) subsRoot).put("stream", streamId); if (!root.path("customFields").isMissingNode()) ((ObjectNode) subsRoot).put("customFields", root.get("customFields")); if (!root.path("delay").isMissingNode()) ((ObjectNode) subsRoot).put("delay", root.get("delay").asInt()); if (!root.path("expire").isMissingNode()) { ((ObjectNode) subsRoot).put("expire", root.get("expire").asInt()); } // // Put the subscription id in the so stream subscription array // soParent.setSubscription(stream, subsId); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMssCF.CFAstMssCFBindSecSessionSecProxyId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFAstMssCFBindSecSessionSecProxyId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }// ww w . j a va 2s. c om ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFAstSecSessionObj) { UUID secProxyId = ((ICFAstSecSessionObj) genDef).getOptionalSecProxyId(); if (secProxyId == null) { ret = null; } else { ret = secProxyId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFAstSecSessionObj"); } return (ret); }
From source file:org.ovirt.engine.sdk.decorators.DataCenterIscsiBonds.java
/** * Fetches DataCenterIscsiBond object by id. * * @return/* w w w . j a va 2s. co m*/ * {@link DataCenterIscsiBond } * * @throws ClientProtocolException * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public DataCenterIscsiBond get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.IscsiBond.class, DataCenterIscsiBond.class); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindSecUserPasswordResetUuid.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFBamMssCFBindSecUserPasswordResetUuid.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//from w ww .ja v a 2s . com ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFBamSecUserObj) { UUID passwordResetUuid = ((ICFBamSecUserObj) genDef).getOptionalPasswordResetUuid(); if (passwordResetUuid == null) { ret = null; } else { ret = passwordResetUuid.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFBamSecUserObj"); } return (ret); }