Package com.netflix.suro.message

Examples of com.netflix.suro.message.DefaultMessageContainer$Item


    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue());
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here


    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List<Item> itemList = new ArrayList<Item>();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);

    if (taxTableSelector != null) {
      item.setTaxTableSelector(taxTableSelector);
    }
   
    if (privateItemData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(privateItemData);
      item.setMerchantPrivateItemData(anyType);
    }
   
    return item;
  }
View Full Code Here

      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
   
    try {
      Money money = createMoney(unitPrice, currency);
      Item item = _objectFact.createItem();
      item.setItemName(itemName);
      item.setItemDescription(itemDesc);
      item.setQuantity(quantity);
      item.setUnitPrice(money);
 
      if (taxTableSelector != null) {
        item.setTaxTableSelector(taxTableSelector);
      }
     
      if (privateItemData != null) {
        AnyType anyType = _objectFact.createAnyType();
        anyType.setAny(privateItemData);
        item.setMerchantPrivateItemData(anyType);
      }
     
      return item;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue(), 0);
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here

    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List itemList = new ArrayList();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

                .put("f3", "v3")
                .put("ts", dt.getMillis())
                .build();

        for (int i = 0; i < 100; ++i) {
            sink.writeTo(new DefaultMessageContainer(new Message(index, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();
        return sink;
    }
View Full Code Here

                .build();

        String routingKey = "topic";
        String index = "topic20141012";
        for (int i = 0; i < 100; ++i) {
            sink.writeTo(new DefaultMessageContainer(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();

        node.client().admin().indices().prepareRefresh(index).execute().actionGet();
        CountResponse response = node.client().prepareCount(index).execute().actionGet();
View Full Code Here

                client);
        sink.open();

        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                sink.writeTo(new DefaultMessageContainer(new Message("parsing_failed_topic" + i, getAnyMessage()), jsonMapper));
            }
            for (int j = 0; j < 3; ++j) {
                sink.writeTo(new DefaultMessageContainer(new Message("indexed" + i, getAnyMessage()), jsonMapper));
            }
            for (int j = 0; j < 3; ++j) {
                sink.writeTo(new DefaultMessageContainer(new Message("rejected" + i, getAnyMessage()), jsonMapper));
            }
        }

        sink.close();
        String stat = sink.getStat();
View Full Code Here

                if (route.doFilter(msg)) {
                    Sink sink = sinkManager.getSink(route.getSink());
                    input.setPause(sink.checkPause());
                    if (!Strings.isNullOrEmpty(route.getAlias())) {
                        sink.writeTo(
                                new DefaultMessageContainer(
                                        new Message(route.getAlias(), msg.getMessage().getPayload()), jsonMapper));
                    } else {
                        sink.writeTo(msg);
                    }
                }
View Full Code Here

TOP

Related Classes of com.netflix.suro.message.DefaultMessageContainer$Item

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.