Ejemplo n.º 1
0
 private void setUpProducts() {
   try {
     Product product = pdt.setUpProduct1();
     mysqlProduct.create(product);
     product = pdt.setUpProduct2();
     mysqlProduct.create(product);
     product = pdt.setUpProduct3();
     mysqlProduct.create(product);
     product = pdt.setUpProduct4();
     mysqlProduct.create(product);
     product = pdt.setUpProduct5();
     mysqlProduct.create(product);
     product = pdt.setUpProduct6();
     mysqlProduct.create(product);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
  public void createTables() throws Exception {
    System.out.println("SetUpTables createTables");
    mySqlProduct = TableFactory.getTable(TableEnum.PRODUCT);
    mySqlRegisteredUser = TableFactory.getTable(TableEnum.REGISTERED_USER);
    mySqlUserToProduct = TableFactory.getTable(TableEnum.USER_TO_PRODUCT);
    try {
      mySqlProduct.dropTable();
      mySqlRegisteredUser.dropTable();
      mySqlUserToProduct.dropTable();
    } catch (Exception e) {
      // ignore if no table found
    }
    mySqlProduct.createTable();
    mySqlRegisteredUser.createTable();
    mySqlUserToProduct.createTable();

    System.out.println("SetUpTables set up product");

    Product product = ptd.setUpProduct1();
    mySqlProduct.create(product);
    product = ptd.setUpProduct2();
    mySqlProduct.create(product);
    product = ptd.setUpProduct3();
    mySqlProduct.create(product);
    product = ptd.setUpProduct4();
    mySqlProduct.create(product);
    product = ptd.setUpProduct5();
    mySqlProduct.create(product);
    product = ptd.setUpProduct6();
    mySqlProduct.create(product);

    System.out.println("SetUpTables set up registered user");

    RegisteredUser registeredUser = rutd.setUpRegisteredUser1();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser2();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser3();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser4();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser5();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser6();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser7();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser8();
    mySqlRegisteredUser.create(registeredUser);
    registeredUser = rutd.setUpRegisteredUser9();
    mySqlRegisteredUser.create(registeredUser);

    System.out.println("SetUpTables set up user to product");

    UserToProduct UserToProduct = utptd.insertUserToProductTable1();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable2();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable3();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable4();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable5();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable6();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable7();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable8();
    mySqlUserToProduct.create(UserToProduct);
    UserToProduct = utptd.insertUserToProductTable9();
    mySqlUserToProduct.create(UserToProduct);
  }