Package com.amazonaws.services.simpledb.model

Examples of com.amazonaws.services.simpledb.model.PutAttributesRequest


        sdbClient.createDomain(new CreateDomainRequest().withDomainName(domainName));
        try {
          Assert.assertNull(DomainHelper.findItemById(sdbClient, domainName, "noexist"));
         
          sdbClient.putAttributes(
              new PutAttributesRequest()
                .withItemName("exist")
                .withDomainName(domainName)
                .withAttributes(new ReplaceableAttribute("name", "value", true)));
         
          Assert.assertNotNull(DomainHelper.findItemById(sdbClient, domainName, "exist"));
View Full Code Here


        sdbClient.createDomain(new CreateDomainRequest().withDomainName(domainName));
        try {
         
          for(int i = 0; i < 3; i++) {
              sdbClient.putAttributes(
                  new PutAttributesRequest()
                    .withItemName("thing" + i)
                    .withDomainName(domainName)
                    .withAttributes(new ReplaceableAttribute("name", "value", true)));           
          }
View Full Code Here

        recordEvent(evt);

        verify(sdbMock).putAttributes(arg.capture());

        PutAttributesRequest req = arg.getValue();
        Assert.assertEquals(req.getDomainName(), "DOMAIN");
        Assert.assertEquals(req.getItemName(), "MONKEY-testId-region-" + evt.eventTime().getTime());
        Map<String, String> map = new HashMap<String, String>();
        for (ReplaceableAttribute attr : req.getAttributes()) {
            map.put(attr.getName(), attr.getValue());
        }

        Assert.assertEquals(map.remove("id"), "testId");
        Assert.assertEquals(map.remove("eventTime"), String.valueOf(evt.eventTime().getTime()));
View Full Code Here

    List<Map<String, List<String>>> attributeChunks = MapUtils.splitToChunksOfSize(rawAttributes,
        MAX_NUMBER_OF_ATTRIBUTES_PER_SIMPLE_DB_REQUEST);

    for(Map<String, List<String>> chunk : attributeChunks) {
      PutAttributesRequest request = createPutAttributesRequest(domain, itemName, chunk);
      putAttributesRequests.add(request);
    }

    return putAttributesRequests;
  }
View Full Code Here

    return putAttributesRequests;
  }

  private static PutAttributesRequest createPutAttributesRequest(String domain, String itemName,
      Map<String, List<String>> chunk) {
    final PutAttributesRequest putRequest = new PutAttributesRequest();
    putRequest.setDomainName(domain);
    putRequest.setItemName(itemName);

    List<ReplaceableAttribute> simpleDbAttributes = toReplaceableAttributeList(chunk);
    putRequest.setAttributes(simpleDbAttributes);
    return putRequest;
  }
View Full Code Here

        throws Exception
    {
        String  modelName = jsoda.getModelName(modelClass);
        String  table = jsoda.getModelTable(modelName);
        String  idValue = makeIdValue(modelName, dataObj);
        PutAttributesRequest    req =
            expectedField == null ?
                new PutAttributesRequest(table, idValue, buildAttrs(dataObj, modelName)) :
                new PutAttributesRequest(table, idValue, buildAttrs(dataObj, modelName),
                                         buildExpectedValue(modelName, expectedField, expectedValue, expectedExists));
        sdbClient.putAttributes(req);
    }
View Full Code Here

        // Now finally send it for storage (If have attributes to add)
        long start2 = System.currentTimeMillis();
        long duration2;
        if (!attsToPut.isEmpty()) {
            this.em.getSimpleDb().putAttributes(
                    new PutAttributesRequest().withDomainName(domainName).withItemName(id).withAttributes(attsToPut)
                            .withExpected(expected));
            duration2 = System.currentTimeMillis() - start2;
            if (logger.isLoggable(Level.FINE))
                logger.fine("putAttributes time=" + (duration2));
            em.statsAttsPut(attsToPut.size(), duration2);
View Full Code Here

        AmazonSimpleDB db = factory.getSimpleDb();
        for (Item item : items) {
            List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();

            atts.add(new ReplaceableAttribute(dtype, newClassName, true));
            db.putAttributes(new PutAttributesRequest(domainName, item.getName(), atts));
        }
    }
View Full Code Here

            if (oldAtts.size() > 0) {
                Attribute oldAtt = oldAtts.get(0);
                List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
                atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true));

                db.putAttributes(new PutAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(atts));

                db.deleteAttributes(new DeleteAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(oldAtts));
            }
        }
    }
View Full Code Here

        TestSimpleDBJanitorResourceTracker tracker = new TestSimpleDBJanitorResourceTracker();

        tracker.addOrUpdate(resource);
        verify(tracker.sdbMock).putAttributes(arg.capture());
        PutAttributesRequest req = arg.getValue();

        Assert.assertEquals(req.getDomainName(), "DOMAIN");
        Assert.assertEquals(req.getItemName(), getSimpleDBItemName(resource));
        Map<String, String> map = new HashMap<String, String>();
        for (ReplaceableAttribute attr : req.getAttributes()) {
            map.put(attr.getName(), attr.getValue());
        }

        Assert.assertEquals(map.remove(AWSResource.FIELD_RESOURCE_ID), id);
        Assert.assertEquals(map.remove(AWSResource.FIELD_DESCRIPTION), description);
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.PutAttributesRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.