Exemple #1
0
  @Override
  protected void initChildren() {
    List<OrderItem> orderItems =
        FacadeContext.getOrderItemFacade().findBy(getOrder(), OrderItemType.first);
    for (OrderItem orderItem : orderItems) {
      AOrderNode node =
          nodeBuilder.build(
              OrderItemNode.class,
              MapUtils.putAll(
                  new HashMap<String, Object>(), new Object[] {"orderItem", orderItem}));
      add(node);
    }
    orderItems = FacadeContext.getOrderItemFacade().findBy(getOrder(), OrderItemType.common);
    for (OrderItem orderItem : orderItems) {
      if (orderItem.getSource() == null) {
        AOrderNode node =
            nodeBuilder.build(
                OrderItemNode.class,
                MapUtils.putAll(
                    new HashMap<String, Object>(), new Object[] {"orderItem", orderItem}));
        add(node);
      }
    }

    if (getOrder() instanceof Order) {
      add(
          nodeBuilder.build(
              TemplatesNode.class,
              MapUtils.putAll(
                  new HashMap<String, Object>(), new Object[] {"nodeBuilder", nodeBuilder})));
      add(nodeBuilder.build(AGTFacadeNode.class, MapUtils.EMPTY_MAP));
      add(nodeBuilder.build(ZFacadeNode.class, MapUtils.EMPTY_MAP));
    } else if (getOrder() instanceof TemplateOrder) {
      add(nodeBuilder.build(TemplateFacadeNode.class, MapUtils.EMPTY_MAP));
    }
  }
  @Test(groups = "dev")
  public void collectionTest() {
    DB db = mongo.getDB(DBNAME);
    DBCollection myCollection = db.getCollection("myCollection");
    myCollection.save(
        new BasicDBObject(
            MapUtils.putAll(new HashMap(), new Object[] {"name", "leon", "age", 33})));
    myCollection.findOne();

    Set<String> names = db.getCollectionNames();

    assertNotNull(names);
    boolean hit = false;

    for (String name : names) {
      if ("myCollection".equals(name)) {
        hit = true;
        break;
      }
    }

    assertTrue(hit);
  }