예제 #1
0
  /**
   * Test if a Catalog exists or not
   *
   * @param expected if false the Test will be successful if the Catalog does NOT exist
   */
  public void testExists(boolean expected) {
    TExists_Return[] Catalogs_out = catalogService.exists(new String[] {full});

    // test if update was successful
    assertEquals("update result set", 1, Catalogs_out.length);
    assertEquals("exists?", expected, Catalogs_out[0].getExists());
  }
예제 #2
0
  /** Sets all the required prerequisites for the tests. Will be called before the test are run. */
  @Before
  public void setUp() {

    // create test Catalogs that can be used with the create and update
    // methods
    Catalog_in.setAlias(alias);
    Catalog_in.setName(
        new TLocalizedValue[] {
          new TLocalizedValue("de", "Test-Katalog"), new TLocalizedValue("en", "test Catalog"),
        });
    Catalog_in.setIsVisible(true);
    Catalog_in.setParentCatalog(path);

    String dateStr =
        new String(sdf_in.format(new GregorianCalendar(2005, 11, 24, 18, 00).getTime()));
    TAttribute attr1 = new TAttribute();
    attr1.setName("Date");
    attr1.setType("DateTime");
    attr1.setValue(dateStr);
    Catalog_in.setAttributes(new TAttribute[] {attr1});

    TAttribute layout1 = new TAttribute();
    layout1.setName("Content-Order");
    layout1.setValue("Base_Products_Pages");
    TAttribute layout2 = new TAttribute();
    layout2.setName("Content-Pages");
    layout2.setValue("Pages_SingleColumn");
    Catalog_in.setTemplateTypes(new TAttribute[] {layout1, layout2});

    Catalog_up.setPath(full);
    Catalog_up.setName(
        new TLocalizedValue[] {
          new TLocalizedValue("de", "veränderter Test-Katalog"),
          new TLocalizedValue("en", "updated test Catalog"),
        });

    dateStr = sdf_in.format(new GregorianCalendar(2005, 11, 25, 18, 00).getTime());
    TAttribute attr_update = new TAttribute();
    attr_update.setName("Date");
    attr_update.setType("DateTime");
    attr_update.setValue(dateStr);
    Catalog_up.setAttributes(new TAttribute[] {attr_update});

    TAttribute layout3 = new TAttribute();
    layout3.setName("Content-Order");
    layout3.setValue("Pages_Products_Base");
    TAttribute layout4 = new TAttribute();
    layout4.setName("Content-Pages");
    layout4.setValue("Pages_TwoColumns");
    Catalog_up.setTemplateTypes(new TAttribute[] {layout3, layout4});

    Catalog_sort1.setPath(sort1);
    Catalog_sort2.setPath(sort2);
    Catalog_sort2.setSort("byPriceDESC");
    Catalog_sort3.setPath(sort3);
    Catalog_sort3.setSort("byPriceASC");
    Catalog_sort3.setAllSub(true);

    // delete the test catalog if it exists
    TExists_Return[] Catalogs_exists_out = catalogService.exists(new String[] {full});
    if (Catalogs_exists_out[0].getExists()) {
      catalogService.delete(new String[] {full});
    }
  }