Example usage for java.util UUID fromString

List of usage examples for java.util UUID fromString

Introduction

In this page you can find the example usage for java.util UUID fromString.

Prototype

public static UUID fromString(String name) 

Source Link

Document

Creates a UUID from the string standard representation as described in the #toString method.

Usage

From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanEncrypted.java

@Override
public Map<String, Object> bind(ServiceInstance serviceInstance) throws ServiceBrokerException {
    UUID instanceId = UUID.fromString(serviceInstance.getServiceInstanceId());
    UUID orgId = UUID.fromString(serviceInstance.getOrganizationGuid());
    return bindingOperations.createCredentialsMap(instanceId, orgId);
}

From source file:org.sventon.web.ctrl.template.ExportControllerTest.java

@Test
public void testExport() throws Exception {
    final File tempFile = File.createTempFile("sventon-", "-test");
    tempFile.deleteOnExit();// w w  w .j  a  va2s .  c  om

    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    final UserRepositoryContext context = new UserRepositoryContext();
    final MultipleEntriesCommand command = new MultipleEntriesCommand();
    final PathRevision[] entriesToExport = new PathRevision[] {
            new PathRevision("/trunk/file1", Revision.create(100)),
            new PathRevision("/tags/test/file2", Revision.create(101)) };
    command.setName(new RepositoryName("test"));
    command.setEntries(entriesToExport);

    assertFalse(context.getIsWaitingForExport());
    assertNull(context.getExportUuid());

    final ExportController ctrl = new ExportController(new ExportExecutor() {
        public UUID submit(MultipleEntriesCommand command, SVNConnection connection, long pegRevision) {
            return UUID.fromString(UUID_STRING);
        }

        public void downloadByUUID(UUID uuid, HttpServletRequest request, HttpServletResponse response)
                throws IOException {
        }

        public void delete(UUID uuid) {
        }

        public int getProgress(UUID uuid) {
            return 1;
        }
    });

    final ModelAndView modelAndView = ctrl.svnHandle(null, command, 123, context, request, response, null);
    assertNotNull(modelAndView);

    assertTrue(context.getIsWaitingForExport());
    assertEquals(UUID_STRING, context.getExportUuid().toString());
}

From source file:com.haulmont.cuba.core.QueryResultTest.java

private void createEntities() {
    Transaction tx = cont.persistence().createTransaction();
    try {//from w w w.  j  a v  a2 s.  com
        EntityManager em = cont.persistence().getEntityManager();
        User user;

        Group group = em.find(Group.class, UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93"));

        int k = 0;
        for (String domain : Arrays.asList("@aaa.com", "@bbb.com")) {
            for (String name : Arrays.asList("A-", "B-")) {
                for (String firstName : Arrays.asList("C-", "D-")) {
                    for (int i = 0; i < 5; i++) {
                        user = new User();
                        user.setGroup(group);

                        userIds.add(user.getId());
                        user.setLogin("user" + StringUtils.leftPad(String.valueOf(k++), 2, '0'));
                        user.setName(name + "User" + i);
                        user.setFirstName(firstName + "User" + i);
                        user.setEmail(user.getLogin() + domain);

                        em.persist(user);
                    }
                }
            }
        }

        tx.commit();
    } finally {
        tx.end();
    }
}

From source file:com.galactogolf.genericobjectmodel.levelloader.LevelSet.java

public LevelSet(String levelSetId, String name) {
    _id = UUID.fromString(levelSetId);
    _name = name;
    _levels = new ArrayList<LevelDefinition>();
    _currentLevel = -1;
}

From source file:com.drevelopment.couponcodes.bukkit.BukkitServerModTransformer.java

@Override
public void runCommand(CommandSender sender, String command) {
    if (sender instanceof Player) {
        Bukkit.getServer().dispatchCommand(Bukkit.getPlayer(UUID.fromString(((Player) sender).getUUID())),
                command);/*from   w ww  .j a  v a2s  . c  o  m*/
    } else {
        Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
    }
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKb.CFGenKbSecUserPKey.java

public CFGenKbSecUserPKey() {
    requiredSecUserId = UUID.fromString(CFGenKbSecUserBuff.SECUSERID_INIT_VALUE.toString());
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_1.CFEnSyntax.CFEnSyntaxSecUserPKey.java

public CFEnSyntaxSecUserPKey() {
    requiredSecUserId = UUID.fromString(CFEnSyntaxSecUserBuff.SECUSERID_INIT_VALUE.toString());
}

From source file:nl.esciencecenter.octopus.webservice.job.JobsPollerTest.java

@Test
public void run_NoState_StateFilledAndIterationIncreased() throws URISyntaxException {
    Map<String, SandboxedJob> jobs = new HashMap<String, SandboxedJob>();
    String identifier = "11111111-1111-1111-1111-111111111111";
    UUID uuid = UUID.fromString(identifier);
    Job job = new JobImplementation(mock(JobDescription.class), mock(Scheduler.class), uuid, identifier, false,
            false);/*  w w  w  .  jav a 2s .  c o m*/
    SandboxedJob sjob = new SandboxedJob(null, job, null, null);
    jobs.put(identifier, sjob);
    PollConfiguration pollConf = new PollConfiguration();
    Octopus octopus = mock(Octopus.class);
    Jobs jobsEngine = mock(Jobs.class);
    when(octopus.jobs()).thenReturn(jobsEngine);
    JobStatus jobstatus = new JobStatusImplementation(job, "RUNNING", 0, null, true, false, null);
    JobStatus[] statuses = { jobstatus };
    // use `doReturn` instead of `when` as argument matching fails
    doReturn(statuses).when(jobsEngine).getJobStatuses((Job[]) any());
    JobsPoller poller = new JobsPoller(jobs, pollConf, octopus);

    poller.run();

    assertThat(sjob.getStatus()).isEqualTo(jobstatus);
    assertThat(sjob.getPollIterations()).isEqualTo(1);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFsw.CFFswSecUserPKey.java

public CFFswSecUserPKey() {
    requiredSecUserId = UUID.fromString(CFFswSecUserBuff.SECUSERID_INIT_VALUE.toString());
}

From source file:org.apache.usergrid.android.sdk.utils.JsonUtils.java

public static UUID getUUIDProperty(Map<String, JsonNode> properties, String name) {
    JsonNode value = properties.get(name);
    if (value != null) {
        UUID uuid = null;/*from ww  w. ja v  a  2  s .c o m*/
        try {
            uuid = UUID.fromString(value.asText());
        } catch (Exception e) {
        }
        return uuid;
    }
    return null;
}