List of usage examples for java.util UUID randomUUID
public static UUID randomUUID()
From source file:com.googlecode.t7mp.TomcatDirectorySetupTest.java
@Before public void setUp() { File tempDir = new File(System.getProperty("java.io.tmpdir")); baseDir = new File(tempDir, "tomcat_TEST_" + UUID.randomUUID().toString()); Assert.assertTrue(baseDir.mkdirs()); }
From source file:com.devicehive.dao.DeviceClassDaoTest.java
@Test public void testCreate() throws Exception { UUID uuid = UUID.randomUUID(); DeviceClassEquipmentVO equipment = new DeviceClassEquipmentVO(); equipment.setName("deviceClassName"); DeviceClassWithEquipmentVO deviceClass = new DeviceClassWithEquipmentVO(); deviceClass.setName("device-class-" + uuid); deviceClass.setEquipment(new HashSet<>()); deviceClass.getEquipment().add(equipment); deviceClassDao.persist(deviceClass); Long id = deviceClass.getId(); deviceClass = deviceClassDao.find(id); assertThat(deviceClass, notNullValue()); }
From source file:nl.pinniq.web.service.AsyncProcessRunnableImpl.java
public AsyncProcessRunnableImpl() { this.dateTime = new Date(); this.processId = UUID.randomUUID().toString(); this.state = ProcessState.STATE_NOT_STARTED; }
From source file:bogdanrechi.lansator.properties.ProgramItem.java
public ProgramItem(ProgramItem object) throws StringException { this.guid = UUID.randomUUID().toString(); this.name = object.name; this.path = object.path; this.runInFolder = object.runInFolder; this.asSuperuser = object.asSuperuser; this.parameters = object.parameters; this.isImageAndText = object.isImageAndText; this.isSeparator = object.isSeparator; if (object.imageFile.length() > 0 && Files.exists(MainWindow.getImagesPath() + object.imageFile)) { String imageCopy = UUID.randomUUID().toString() + "." + FilenameUtils.getExtension(object.imageFile); Files.copyFileToFolder(MainWindow.getImagesPath() + object.imageFile, MainWindow.getImagesPath(), imageCopy);/* w w w .ja v a2 s . com*/ this.imageFile = imageCopy; } else { this.imageFile = object.imageFile; } }
From source file:de.pawlidi.openaletheia.base.model.User.java
public User(String uuid, String username, String password) { super();//from w w w. ja va2 s .c o m this.uuid = UUID.randomUUID().toString(); this.username = username; this.password = password; }
From source file:org.apache.taverna.robundle.manifest.PathAnnotation.java
public void generateAnnotationId() { setUri(URI.create("urn:uuid:" + UUID.randomUUID())); }
From source file:com.vmware.photon.controller.deployer.xenon.util.VibUtils.java
public static Runnable removeVibs(HostService.State hostState, Service service, Consumer<Throwable> completion) { return new Runnable() { @Override/* ww w . j a v a2 s. c o m*/ public void run() { try { DeployerContext deployerContext = HostUtils.getDeployerContext(service); for (String vibName : deployerContext.getVibUninstallOrder()) { ServiceUtils.logInfo(service, "Uninstalling vib [%s] from host [%s]", vibName, hostState.hostAddress); List<String> command = Arrays.asList("./" + DELETE_VIB_SCRIPT_NAME, hostState.hostAddress, hostState.userName, hostState.password, vibName); File scriptLogFile = new File(deployerContext.getScriptLogDirectory(), DELETE_VIB_SCRIPT_NAME + "-" + hostState.hostAddress + "-" + UUID.randomUUID().toString() + ".log"); ScriptRunner scriptRunner = new ScriptRunner.Builder(command, deployerContext.getScriptTimeoutSec()) .directory(deployerContext.getScriptDirectory()) .redirectOutput(ProcessBuilder.Redirect.to(scriptLogFile)) .redirectErrorStream(true).build(); int scriptReturnCode = scriptRunner.call(); if (scriptReturnCode != 0) { ServiceUtils.logSevere(service, DELETE_VIB_SCRIPT_NAME + " returned " + scriptReturnCode); ServiceUtils.logSevere(service, "Script output: " + FileUtils.readFileToString(scriptLogFile)); throw new IllegalStateException("Installing VIB file " + vibName + " to host " + hostState.hostAddress + " failed with exit code " + scriptReturnCode); } } } catch (Throwable t) { completion.accept(t); } completion.accept(null); } }; }
From source file:com.redhat.poc.mt.emission.evt.EventGenerator.java
public void process(Exchange exchange) throws Exception { Event event = new Event(); String author = null;//w w w . j a v a2 s .c o m String message = null; exchange.getOut().copyFrom(exchange.getIn()); String body = exchange.getIn().getBody(String.class); event.setId(UUID.randomUUID().toString()); author = (String) exchange.getIn().getHeader(EVENT_AUTHOR); message = (String) exchange.getIn().getHeader(EVENT_MESSAGE); if (author == null || "".compareTo(author) == 0) { event.setAuthor(Referentiel.randomName()); } else { event.setAuthor(author); } if (message != null) { event.setMessage(message); } event.setSystem(Referentiel.randomSystem()); event.setCreationTime(Calendar.getInstance().getTime()); event.setGeo(Referentiel.randomISO3166_1alpha_3()); event.setVersion(Referentiel.randomVersion()); event.setState(State.NEW); event.setType(((String) exchange.getIn().getHeader(SOURCE_GENERATION))); if (StringUtils.isNotBlank(body)) { event.setMessage(body); } exchange.getOut().setBody(event); }
From source file:io.github.msurdi.redeye.api.Query.java
@Builder @JsonCreator//from ww w . ja v a2s. co m public Query(@JsonProperty("id") String id, @JsonProperty("query") String query, @JsonProperty("name") String name, @JsonProperty("description") String description) { this.id = (id != null ? id : UUID.randomUUID().toString()); this.query = query; this.name = name; this.description = description; }
From source file:com.teradata.benchto.driver.macro.shell.ShellMacroExecutionDriverTest.java
@Test public void shouldExecuteMacro() throws IOException { String filename = "/tmp/" + UUID.randomUUID().toString(); String suffix = System.getenv("USER"); macroService.runBenchmarkMacro("create-file", ImmutableMap.of("FILENAME", filename)); Path path = Paths.get(filename + suffix); assertThat(exists(path)).isTrue();/*from w ww .ja v a 2s. com*/ delete(path); }