Java 类java.util.UUID 实例源码

项目:react-native-blue-manager    文件:Peripheral.java   
private BluetoothGattCharacteristic findReadableCharacteristic(BluetoothGattService service, UUID characteristicUUID) {
    BluetoothGattCharacteristic characteristic = null;

    int read = BluetoothGattCharacteristic.PROPERTY_READ;

    List<BluetoothGattCharacteristic> characteristics = service.getCharacteristics();
    for (BluetoothGattCharacteristic c : characteristics) {
        if ((c.getProperties() & read) != 0 && characteristicUUID.equals(c.getUuid())) {
            characteristic = c;
            break;
        }
    }

    // As a last resort, try and find ANY characteristic with this UUID, even if it doesn't have the correct properties
    if (characteristic == null) {
        characteristic = service.getCharacteristic(characteristicUUID);
    }

    return characteristic;
}
项目:Forge    文件:FileManager.java   
/**
 * Gets the stored Forge accounts from the storage
 *
 * @param context calling context
 * @return a hash map of all Forge accounts stored
 */
public static HashMap<UUID, ForgeAccount> load(Context context) {
    // Create new hash map
    HashMap<UUID, ForgeAccount> accounts = new HashMap<>();
    // If storage file exists
    if (context.getFileStreamPath(context.getString(R.string.filename_forge_accounts)).exists()) {
        // Open file stream
        FileInputStream inputStream;
        try {
            inputStream = context.openFileInput(context.getString(R.string.filename_forge_accounts));
            // Open input stream
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            // Place the file contents into a string
            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            StringBuilder stringBuilder = new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                stringBuilder.append(line);
            }
            // Initialise GSON
            Gson gson = new Gson();
            // Create a list of Forge Accounts from the JSON string
            List<ForgeAccount> accountList =
                    gson.fromJson(stringBuilder.toString(), new TypeToken<List<ForgeAccount>>() {
                    }.getType());
            // Iterate through each Forge account and add it to the hash map
            for (ForgeAccount account : accountList) {
                accounts.put(account.getId(), account);
            }
        } catch (Exception e) {
            // If there is an error, log it
            Log.e(Forge.ERROR_LOG, e.getMessage());
        }
    }
    return accounts;
}
项目:event-driven-spring-boot    文件:ApplicationProcessController.java   
@PostMapping("/")
public RedirectView startCreditApplicationProcess() {
    //Create Credit Application Number
    UUID creditApplicationNumber = UUID.randomUUID();
    Date applicationTime = new Date();
    LOGGER.info("Created a new Credit Application Number: " + creditApplicationNumber.toString());

    // We are saving the initial status
    CreditApplicationStatus status = new CreditApplicationStatus(creditApplicationNumber.toString(), applicationTime);
    repository.save(status);
    LOGGER.info("Saved " + status.toString());

    // We are sending a CreditApplicationNumberGeneratedEvent
    CreditApplicationNumberGeneratedEvent event = new CreditApplicationNumberGeneratedEvent();
    event.setApplicationNumber(creditApplicationNumber.toString());
    event.setCreationTime(applicationTime);
    applicationProcessChannels.creditApplicationNumberGeneratedOut()
            .send(MessageBuilder.withPayload(event).build());
    LOGGER.info("Sent " + event.toString());

    return new RedirectView(nextProcessStepUrl + creditApplicationNumber.toString());
}
项目:allure-java    文件:Allure1AttachAspectsTest.java   
@Test
public void shouldSetupAttachmentTitleFromAnnotation() {
    final String uuid = UUID.randomUUID().toString();
    final TestResult result = new TestResult().withUuid(uuid);

    lifecycle.scheduleTestCase(result);
    lifecycle.startTestCase(uuid);

    attachmentWithTitleAndType("parameter value");

    lifecycle.stopTestCase(uuid);
    lifecycle.writeTestCase(uuid);

    assertThat(results.getTestResults())
            .flatExtracting(TestResult::getAttachments)
            .extracting("name", "type")
            .containsExactly(tuple("attachment with parameter value", "text/plain"));

}
项目:oscm    文件:LocalizedBillingResourceDAOIT.java   
private LocalizedBillingResource createLocalizedBillingResourceInDB(
        UUID objID, String locale, String billingResourceDataType,
        byte[] billingResourceValue) throws Exception {
    final LocalizedBillingResource billingResource = createLocalizedBillingResource(
            objID, locale, billingResourceDataType, billingResourceValue);

    runTX(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            ds.persist(billingResource);
            return null;
        }
    });

    return findLocalizedBillingResourceInDB(billingResource);
}
项目:Elasticsearch    文件:ShardUpsertRequest.java   
public ShardUpsertRequest(ShardId shardId,
                          @Nullable String[] updateColumns,
                          @Nullable Reference[] insertColumns,
                          @Nullable String routing,
                          UUID jobId) {
    super(shardId, routing, jobId);
    assert updateColumns != null || insertColumns != null
            : "Missing updateAssignments, whether for update nor for insert";
    this.updateColumns = updateColumns;
    this.insertColumns = insertColumns;
    if (insertColumns != null) {
        insertValuesStreamer = new Streamer[insertColumns.length];
        for (int i = 0; i < insertColumns.length; i++) {
            insertValuesStreamer[i] = insertColumns[i].valueType().streamer();
        }
    }
}
项目:android-apkbox    文件:ApkInstaller.java   
private static File copyApk(Context context, InputStream inputStream) {
    try {
        File file = new File(getApkDir(context), System.currentTimeMillis() + "_" + UUID.randomUUID() + ".apk");
        OutputStream out = new FileOutputStream(file);
        byte[] buffer = new byte[4096];
        int read;
        while ((read = inputStream.read(buffer)) != -1) {
            out.write(buffer, 0, read);
        }
        inputStream.close();
        inputStream = null;
        out.flush();
        out.close();
        out = null;
        return file;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
项目:universal-graph-client    文件:GraphEntityMutationTest.java   
private GraphEntityMutation createGraphEntityMutation(BatchMutation batchMutation) {
    GraphEntity.Builder builder = new GraphEntity.Builder();
    Name name = TartanImplTestConstants.ATTR_DUMMY_ATTRIBUTE_NAME;
    String attributeValue = "Dummy Attribute";
    Metadata metadata = new MockMetadata();
    GraphAttribute graphAttribute = new GraphAttribute(name, attributeValue, metadata);
    builder.addAttribute(graphAttribute);
    Entity.ID newEntityID = Entity.ID.valueOf("urn:entity:" + TartanImplTestConstants.ATTR_PARENT_ID.getName()
            + "." + TartanImplTestConstants.ATTR_PARENT_ID.getName() + "/" + UUID.randomUUID());
    builder.setID(newEntityID);
    GraphEntity entity = builder.build();

    OperationPipeline assemblyLine = new OperationPipeline();
    NewEntity newEntity = util.createNewEntity(TartanImplTestConstants.ATTR_PARENT_ID);
    CreateEntity createEntity = new CreateEntity(newEntity);
    assemblyLine.add(createEntity);

    if(null == batchMutation){
        MutationExecutorFactory factory = new MockMutationExecuterFactory();
        batchMutation = new GraphMutation(factory );
    }

    GraphEntityMutation graphEntityMutation = new GraphEntityMutation(entity, assemblyLine, batchMutation);
    return graphEntityMutation;
}
项目:cyberduck    文件:DefaultAttributesFinderFeatureTest.java   
@Test
public void testFindLargeUpload() throws Exception {
    final B2Session session = new B2Session(
            new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(),
                    new Credentials(
                            System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")
                    )));
    final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path file = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final B2StartLargeFileResponse startResponse = session.getClient().startLargeFileUpload(
            new B2FileidProvider(session).getFileid(bucket, new DisabledListProgressListener()),
            file.getName(), null, Collections.emptyMap());
    assertNotNull(new DefaultAttributesFinderFeature(session).find(file));
    session.getClient().cancelLargeFileUpload(startResponse.getFileId());
    session.close();
}
项目:swblocks-decisiontree    文件:RuleChangeBuilderTest.java   
@Test
public void addsChangeStartingAtExactEndOfThirdSegment() {
    this.builder.with(RuleChangeBuilder::input, Arrays.asList("VOICE", "CME", "ED", "UK", "INDEX"));
    this.builder.with(RuleChangeBuilder::output, Collections.singletonList("Rate:2.0"));
    this.builder.with(RuleChangeBuilder::changeRange,
            new DateRange(NOW.plus(Period.ofWeeks(8)), NOW.plus(Period.ofWeeks(9))));

    final List<RuleChange> ruleChanges = this.builder.build();
    assertThat(ruleChanges, hasSize(1));

    final List<RuleChange> originals = getChangesByType(ruleChanges, Type.ORIGINAL);
    assertThat(originals, hasSize(0));

    final List<RuleChange> newChanges = getChangesByType(ruleChanges, Type.NEW);
    assertThat(newChanges, hasSize(1));

    assertRuleChange(newChanges.get(0), Type.NEW, null, new UUID(0, 2),
            new String[]{"VOICE", "CME", "ED", "UK", "INDEX"}, Collections.singletonMap("Rate", "2.0"),
            NOW.plus(Period.ofWeeks(8)), NOW.plus(Period.ofWeeks(9)));
}
项目:PaymentService    文件:InvoicesApi.java   
@GET
    @Path("/{invoiceId}/coupons")
    @Consumes({ "application/json" })
    @Produces({ "application/json", "text/plain" })
    @io.swagger.annotations.ApiOperation(value = "Returns a list of coupon adresses along with their balance.", notes = "", response = AddressValuePair.class, responseContainer = "List", tags={  })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "returns the balance for each coupon", response = AddressValuePair.class, responseContainer = "List"),

        @io.swagger.annotations.ApiResponse(code = 404, message = "invoice id not found", response = AddressValuePair.class, responseContainer = "List") })
    public Response getInvoiceCoupons(@ApiParam(value = "the id of the invoice to get the coupons balances for",required=true) @PathParam("invoiceId") UUID invoiceId
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.getInvoiceCoupons(invoiceId,securityContext);
    }
项目:BlockBall    文件:PlayerMetaMySQLControllerTest.java   
@Test
public void insertSelectPlayerMetaTest() throws ClassNotFoundException {
    final Plugin plugin = mockPlugin();
    plugin.getConfig().set("sql.enabled", true);
    Factory.initialize(plugin);
    try (PlayerMetaController controller = Factory.createPlayerDataController()) {
        for (final PlayerMeta item : controller.getAll()) {
            controller.remove(item);
        }
        final UUID uuid = UUID.randomUUID();
        final PlayerMeta playerMeta = new PlayerData();

        assertThrows(IllegalArgumentException.class, () -> controller.store(playerMeta));
        assertEquals(0, controller.size());

        playerMeta.setUuid(uuid);
        controller.store(playerMeta);
        assertEquals(0, controller.size());

        playerMeta.setName("Sample");
        controller.store(playerMeta);
        assertEquals(1, controller.size());
        assertEquals(uuid, controller.getById(playerMeta.getId()).getUUID());
    } catch (final Exception e) {
        Logger.getLogger(this.getClass().getSimpleName()).log(Level.WARNING, "Failed to run test.", e);
        Assert.fail();
    }
}
项目:minijax    文件:UuidConverterTest.java   
@Test
public void testConvert() {
    final UUID uuid = IdUtils.create();
    final byte[] bytes = IdUtils.toBytes(uuid);

    assertArrayEquals(bytes, converter.convertToDatabaseColumn(uuid));
    assertEquals(uuid, converter.convertToEntityAttribute(bytes));
}
项目:cf-java-client-sap    文件:CloudEvent.java   
public UUID getActorGuid() {
    try {
        return UUID.fromString(actor);
    } catch (IllegalArgumentException e) {
        return null;
    }
}
项目:AndroidProgramming3e    文件:CrimeFragment.java   
public static CrimeFragment newInstance(UUID crimeId) {
    Bundle args = new Bundle();
    args.putSerializable(ARG_CRIME_ID, crimeId);

    CrimeFragment fragment = new CrimeFragment();
    fragment.setArguments(args);
    return fragment;
}
项目:oscm    文件:RestResourceTest.java   
@Override
public Object post(MockRepresentation content,
        MockRequestParameters params) {

    assertNotNull(content);
    assertNotNull(params);

    return UUID.randomUUID();
}
项目:EndermanEvolution    文件:EntityFrienderman.java   
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
    super.readEntityFromNBT(compound);
    UUID uuid = null;
    if (compound.hasKey("Owner")) {
        String s1 = compound.getString("Owner");
        uuid = getUUID(s1);
    }

    if (uuid != null) {
        try {
            setOwnerId(uuid);
            setTamed(true);
        }
        catch (Throwable var4) {
            setTamed(false);
        }
    }
    if (compound.hasKey("Item") && compound.getCompoundTag("Item") != null) {
        setHeldItemStack(new ItemStack(compound.getCompoundTag("Item")));
    }
    if (compound.hasKey("Chest")) {
        if (chestInventory == null) {
            chestInventory = new TempChest(compound.getInteger("ChestSize"));
        }
        NBTTagList tagList = compound.getTagList("Chest", 10);
        for (int i = 0; i < tagList.tagCount(); i++) {
            NBTTagCompound slotNBT = tagList.getCompoundTagAt(i);
            if (slotNBT != null) {
                chestInventory.setInventorySlotContents(slotNBT.getInteger("Slot"), new ItemStack(slotNBT));
            }
        }
    }
    if (isSitting() != compound.getBoolean("Sitting")) {
        setSitting(compound.getBoolean("Sitting"));
    }
}
项目:GCSApp    文件:RedPacketUtil.java   
/**
 * 使用cmd消息收取领到红包之后的回执消息
 */
public static void receiveRedPacketAckMessage(EMMessage message) {
    String senderNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, "");
    String receiverNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, "");
    String senderId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, "");
    String receiverId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_ID, "");
    String groupId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_GROUP_ID, "");
    String currentUser = EMClient.getInstance().getCurrentUser();
    //更新UI为 xx领取了你的红包
    if (currentUser.equals(senderId) && !receiverId.equals(senderId)) {//如果不是自己领取的红包更新此类消息UI
        EMMessage msg = EMMessage.createTxtSendMessage("content", groupId);
        msg.setChatType(EMMessage.ChatType.GroupChat);
        msg.setFrom(message.getFrom());
        if (TextUtils.isEmpty(groupId)) {
            msg.setTo(message.getTo());
        } else {
            msg.setTo(groupId);
        }
        msg.setMsgId(UUID.randomUUID().toString());
        msg.setMsgTime(message.getMsgTime());
        msg.setDirection(EMMessage.Direct.RECEIVE);
        msg.setUnread(false);//去掉未读的显示
        msg.setAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, true);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, senderNickname);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, receiverNickname);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, senderId);
        //保存消息
        EMClient.getInstance().chatManager().saveMessage(msg);
    }
}
项目:helper    文件:BungeeMessaging.java   
@Override
public boolean accept(Player receiver, ByteArrayDataInput in) {
    in.readUTF();
    String uuid = in.readUTF();
    callback.accept(java.util.UUID.fromString(uuid));
    return true;
}
项目:azure-libraries-for-java    文件:QueryKeysInner.java   
/**
 * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
 *
 * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
 * @param searchServiceName The name of the Azure Search service associated with the specified resource group.
 * @param key The query key to be deleted. Query keys are identified by value, not by name.
 * @param searchManagementRequestOptions Additional parameters for the operation
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the {@link ServiceResponse} object if successful.
 */
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (searchServiceName == null) {
        throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.");
    }
    if (key == null) {
        throw new IllegalArgumentException("Parameter key is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(searchManagementRequestOptions);
    UUID clientRequestId = null;
    if (searchManagementRequestOptions != null) {
        clientRequestId = searchManagementRequestOptions.clientRequestId();
    }
    return service.delete(resourceGroupName, searchServiceName, key, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
            @Override
            public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<Void> clientResponse = deleteDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
项目:jrbuilder    文件:QueryProcessor.java   
private List<Column> getColumns(ResultSet resultSet) throws SQLException {
    List<Column> result = new ArrayList<>();
    ResultSetMetaData metaData = resultSet.getMetaData();
    for (int i = 1; i <= metaData.getColumnCount(); i++) {
        result.add(new Column(metaData.getColumnName(i), "$F{" + metaData.getColumnName(i) + "}",
                90, prepareClassName(metaData.getColumnClassName(i)),
                UUID.randomUUID().toString(), "#FFFFFF"));
    }
    return result;
}
项目:Recognize-it    文件:AlbumUtils.java   
/**
 * A random name for the image path.
 */
@NonNull
public static String randomJPGPath() {
    File dcimBucket = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
    if (!dcimBucket.exists()) //noinspection ResultOfMethodCallIgnored
        dcimBucket.mkdirs();
    String outFileFolder = dcimBucket.getAbsolutePath();
    String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toString()) + ".jpg";
    File file = new File(outFileFolder, outFilePath);
    return file.getAbsolutePath();
}
项目:vars-annotation    文件:PropertySheetDemo.java   
@Override
public void start(Stage primaryStage) throws Exception {
    Media media = new Media();
    media.setAudioCodec("audio/aac");
    media.setVideoCodec("video/mp4");
    media.setCameraId("Tiburon");
    media.setContainer("video/quicktime");
    media.setDescription("");
    media.setFrameRate(30D);
    media.setHeight(1080);
    media.setWidth(1920);
    media.setDuration(Duration.ofMillis(3030303));
    media.setSha512(new byte[]{1, 2, 3});
    media.setSizeBytes(345678L);
    media.setStartTimestamp(Instant.now());
    media.setUri(new URI("http://www.mbari.org"));
    media.setVideoReferenceUuid(UUID.randomUUID());
    media.setVideoSequenceName("Tiburon 20160606");
    media.setVideoSequenceUuid(UUID.randomUUID());
    media.setVideoUuid(UUID.randomUUID());
    media.setVideoName("Tiburon 20160606T012345Z");
    ObservableList<PropertySheet.Item> props = BeanPropertyUtils.getProperties(media);
    PropertySheet ps = new PropertySheet(props);
    Scene scene = new Scene(ps);
    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:CustomWorldGen    文件:EntityTameable.java   
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    super.readEntityFromNBT(compound);
    String s;

    if (compound.hasKey("OwnerUUID", 8))
    {
        s = compound.getString("OwnerUUID");
    }
    else
    {
        String s1 = compound.getString("Owner");
        s = PreYggdrasilConverter.convertMobOwnerIfNeeded(this.getServer(), s1);
    }

    if (!s.isEmpty())
    {
        try
        {
            this.setOwnerId(UUID.fromString(s));
            this.setTamed(true);
        }
        catch (Throwable var4)
        {
            this.setTamed(false);
        }
    }

    if (this.aiSit != null)
    {
        this.aiSit.setSitting(compound.getBoolean("Sitting"));
    }

    this.setSitting(compound.getBoolean("Sitting"));
}
项目:nectar-server    文件:AuthController.java   
@SuppressWarnings("unchecked")
protected static JSONObject registerClientToDatabase(String ip) {
    MongoCollection<Document> clients = NectarServerApplication.getDb().getCollection("clients");

    String uuid = UUID.randomUUID().toString();
    String authString = Util.generateNextRandomString();

    while(true) {
        if(clients.find(Filters.eq("uuid", uuid)).first() != null
                || clients.find(Filters.eq("auth", Util.computeSHA512(authString))).first() != null) {
            // We have a collision of UUID or auth string, although it should be VERY VERY rare
            uuid = UUID.randomUUID().toString();
            authString = Util.generateNextRandomString();
        } else {
            // UUID and Auth string are unique, break out
            break;
        }
    }

    Document clientDoc = new Document()
            .append("uuid", uuid)
            .append("auth", Util.computeSHA512(authString))
            .append("registeredAt", System.currentTimeMillis())
            .append("registeredBy", ip);
    clients.insertOne(clientDoc);

    NectarServerApplication.getEventLog().logEntry(EventLog.EntryLevel.INFO, "Client registration success from " + ip + ", new client was registered: " + uuid);

    JSONObject root = new JSONObject();
    root.put("uuid", uuid);
    root.put("auth", authString);
    return root;
}
项目:PaymentService    文件:InvoicesApi.java   
@GET
    @Path("/{invoiceId}/coupons/{couponAddress}")
    @Consumes({ "application/json" })
    @Produces({ "application/json", "text/plain" })
    @io.swagger.annotations.ApiOperation(value = "Returns the balance for the requested coupon.", notes = "", response = AddressValuePair.class, tags={  })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "returns the balance of the coupon", response = AddressValuePair.class),

        @io.swagger.annotations.ApiResponse(code = 404, message = "object not found", response = AddressValuePair.class) })
    public Response getInvoiceCouponBalance(@ApiParam(value = "the id of the invoice to get the coupons balance for",required=true) @PathParam("invoiceId") UUID invoiceId
,@ApiParam(value = "the address of the coupon to get the balance for",required=true) @PathParam("couponAddress") String couponAddress
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.getInvoiceCouponBalance(invoiceId,couponAddress,securityContext);
    }
项目:S3Mock    文件:FileStoreTest.java   
@Test
public void missingUploadPreparation() throws Exception {
  expectedExceptions.expect(IllegalStateException.class);
  expectedExceptions.expectMessage("Missed preparing Multipart Request");

  fileStore.copyPart(
      TEST_BUCKET_NAME, UUID.randomUUID().toString(), 0, 0, false, "1",
      TEST_BUCKET_NAME, UUID.randomUUID().toString(), UUID.randomUUID().toString());
}
项目:kong-java-client    文件:RetrofitSniServiceTest.java   
public void testCreateOrUpdateSni() throws IOException {
    Sni request = new Sni();
    request.setName("jwt");
    request.setSslCertificateId(UUID.randomUUID().toString());
    request.setCreatedAt(new Date().getTime());

    Sni response = kongClient.getSniService().createOrUpdateSni(request);
    System.out.print(response);
    Assert.assertEquals(request.getSslCertificateId(), response.getSslCertificateId());
}
项目:bdf2    文件:GroupMaintain.java   
@DataResolver
public void saveGroups(Collection<Group> groups) throws Exception{
    IUser user=ContextHolder.getLoginUser();
    if(user==null){
        throw new NoneLoginException("Please login first");
    }
    String companyId=user.getCompanyId();
    if(StringUtils.isNotEmpty(getFixedCompanyId())){
        companyId=getFixedCompanyId();
    }
    Session session=this.getSessionFactory().openSession();
    try{
        for(Group g:groups){
            EntityState state=EntityUtils.getState(g);
            if(state.equals(EntityState.NEW)){
                g.setId(UUID.randomUUID().toString());
                g.setCompanyId(companyId);
                g.setCreateDate(new Date());
                session.save(g);
            }else if(state.equals(EntityState.MODIFIED)){
                session.update(g);
            }else if(state.equals(EntityState.DELETED)){
                roleService.deleteRoleMemeber(g.getId(), MemberType.Group);
                groupService.deleteGroupMemeber(g.getId(), MemberType.Group);
                session.delete(g);
            }
        }
    }finally{
        session.flush();
        session.close();
    }
}
项目:Equella    文件:MetadataAclTest.java   
private ObjectNode metadataRule(String script, String priv, String who, boolean grant)
{
    ObjectNode rule = MAPPER.createObjectNode();
    rule.put("name", UUID.randomUUID().toString());
    rule.put("script", script);
    ArrayNode entries = rule.putArray("entries");
    ObjectNode entry = entries.objectNode();
    entry.put("granted", grant);
    entry.put("privilege", priv);
    entry.put("who", who);
    entries.add(entry);
    return rule;
}
项目:AndroidApktool    文件:SafeRepresenter.java   
public SafeRepresenter() {
    this.nullRepresenter = new RepresentNull();
    this.representers.put(String.class, new RepresentString());
    this.representers.put(Boolean.class, new RepresentBoolean());
    this.representers.put(Character.class, new RepresentString());
    this.representers.put(UUID.class, new RepresentUuid());
    this.representers.put(byte[].class, new RepresentByteArray());

    Represent primitiveArray = new RepresentPrimitiveArray();
    representers.put(short[].class, primitiveArray);
    representers.put(int[].class, primitiveArray);
    representers.put(long[].class, primitiveArray);
    representers.put(float[].class, primitiveArray);
    representers.put(double[].class, primitiveArray);
    representers.put(char[].class, primitiveArray);
    representers.put(boolean[].class, primitiveArray);

    this.multiRepresenters.put(Number.class, new RepresentNumber());
    this.multiRepresenters.put(List.class, new RepresentList());
    this.multiRepresenters.put(Map.class, new RepresentMap());
    this.multiRepresenters.put(Set.class, new RepresentSet());
    this.multiRepresenters.put(Iterator.class, new RepresentIterator());
    this.multiRepresenters.put(new Object[0].getClass(), new RepresentArray());
    this.multiRepresenters.put(Date.class, new RepresentDate());
    this.multiRepresenters.put(Enum.class, new RepresentEnum());
    this.multiRepresenters.put(Calendar.class, new RepresentDate());
    classTags = new HashMap<Class<? extends Object>, Tag>();
}
项目:Lithium-Spigot    文件:SliderValueChanged.java   
@Override
public void execute(LithiumPlayer player, List<String> data) {
    LControl w = player.getControlById(UUID.fromString(data.get(0)));
    if (w.getClass().equals(LSlider.class)) {
        LSlider sl = (LSlider) w;
        try {
            sl.setValue(Integer.parseInt(data.get(1)));
            sl.invokeValueChanged(player.getUniqueId());
        } catch (Exception e) {
        }
    }
}
项目:CropControl    文件:CropControlDropEvent.java   
/**
 * Constructor for a drop event.
 * 
 * @param location Immutable location where the drop will occur unless cancelled
 * @param breakType The type of break, also immutable
 * @param dropable What is breaking, also immutable
 * @param player The UUID of the player responsible, if any
 * @param items A replaceable list of items. The list after all handlers will be dropped.
 */
public CropControlDropEvent(final Location location, final BreakType breakType, 
        final Locatable dropable, final UUID player, List<ItemStack> items, List<String> commands) {
    this.location = location;
    this.breakType = breakType;
    this.dropable = dropable;
    this.player = player;
    this.items = items;
    this.commands = commands;
}
项目:fluvius    文件:FlowEventRepository.java   
@Override
public void stepStarted(UUID flowId, UUID stepId, Map<String, Object> scratchpadState) {
  Map<String, T> serialisedState = new LinkedHashMap<>();
  for (Map.Entry<String, Object> entry : scratchpadState.entrySet()) {
    serialisedState.put(entry.getKey(), dataSerialiser.serialise(entry.getValue()));
  }
  eventStore.storeEvent(FlowEvent.started(flowId, stepId, System.currentTimeMillis(), serialisedState));
}
项目:CustomWorldGen    文件:EntityTameable.java   
@Nullable
public EntityLivingBase getOwner()
{
    try
    {
        UUID uuid = this.getOwnerId();
        return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid);
    }
    catch (IllegalArgumentException var2)
    {
        return null;
    }
}
项目:Elasticsearch    文件:PutChunkReplicaRequest.java   
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    sourceNodeId = in.readString();
    transferId = new UUID(in.readLong(), in.readLong());
    currentPos = in.readVInt();
    content = in.readBytesReference();
    isLast = in.readBoolean();
}
项目:CustomWorldGen    文件:Minecraft.java   
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
}
项目:osc-core    文件:CreateOrUpdateK8sDAITaskTest.java   
private DeploymentSpec createAndRegisterDeploymentSpec(DistributedApplianceInstance dai) {
    VirtualizationConnector vc = new VirtualizationConnector();
    vc.setProviderIpAddress("1.1.1.1");
    VirtualSystem vs = new VirtualSystem(null);
    vs.setVirtualizationConnector(vc);
    vs.setId(102L);

    ApplianceSoftwareVersion avs = new ApplianceSoftwareVersion();
    avs.setImageUrl("ds-image-url");
    avs.setImagePullSecretName("ds-pull-secret-name");

    vs.setApplianceSoftwareVersion(avs);
    DeploymentSpec ds = new DeploymentSpec(vs, null, null, null, null, null);
    ds.setId(101L);
    ds.setName(UUID.randomUUID().toString());
    ds.setNamespace("ds-namespace");
    ds.setInstanceCount(5);
    Set<DistributedApplianceInstance> dais = new HashSet<>();
    if (dai!= null) {
        dai.setDeploymentSpec(ds);
        dais.add(dai);
    }

    ds.setDistributedApplianceInstances(dais);

    when(this.em.find(DeploymentSpec.class, ds.getId())).thenReturn(ds);

    return ds;
}
项目:verify-hub    文件:MatchingServiceHealthCheckerTest.java   
@Test
public void shouldLogExceptionsWhenAFailureOccursInGeneratingHealthCheckRequest() throws Exception {
    ApplicationException unauditedException = ApplicationException.createUnauditedException(ExceptionType.INVALID_SAML, UUID.randomUUID());
    when(samlEngineProxy.generateHealthcheckAttributeQuery(any())).thenThrow(unauditedException);

    matchingServiceHealthChecker.performHealthCheck(aMatchingServiceConfigEntityDataDto().build());

    verify(eventLogger).logException(unauditedException, "Saml-engine was unable to generate saml to send to MSA: uk.gov.ida.exceptions.ApplicationException: Exception of type [INVALID_SAML] ");
}