public void getTestCase() throws Exception {

    TestCase testCaseObj = tmsManager.getTestCase("15");

    System.out.println(testCaseObj.getTestCaseId());
    System.out.println(testCaseObj.getTestCaseDescription());
    System.out.println(testCaseObj.getTestCasePhase());
    Project projectObj = testCaseObj.getProjectObj();
    System.out.println(projectObj.getProjectId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getExpectedBehaviour());
  }
  public void getTestCaseExecutionDetails() throws Exception {
    //                testCaseObj.setTestCaseId("001");
    TestCase testCaseObj = tmsManager.getTestCaseExecutionDetails("001");

    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getTestCaseId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    System.out.println(testCaseObj.getActualDate());

    System.out.println(testCaseObj.getTestCaseStatus());
    System.out.println(testCaseObj.getComments());
    System.out.println(testCaseObj.getActualBehaviour());
  }
Ejemplo n.º 3
0
  public void buyItemFromUser(User buyer, User seller, Item currentItem)
        // PRE:  buyer, seller, currentItem must be initialized
        // POST: Purchases item from the store and has stores it into inventory.
      {

    int buyer_balance; // The new balance of the buyer
    int seller_balance; // The new balance of the seller
    String str; // First query
    String str2; // Second query
    String str3; // Third query

    buyer_balance = buyer.getBalance() - currentItem.getPrice();
    seller_balance = seller.getBalance() + currentItem.getPrice();

    if (buyer_balance > 0) // If the buyer wont go negative
    {
      str =
          String.format(
              "Update users set balance = (%d) where user_name = '%s'",
              buyer_balance, buyer.getUserName());

      str2 =
          String.format(
              "Update users set balance = (%d) where user_name = '%s'",
              seller_balance, seller.getUserName());

      str3 =
          String.format(
              "Update items set owner_id = (%d) where item_name = '%s'",
              buyer.getUserId(), currentItem.getItemName());

      updateTables(str, str2, str3);

    } else {
      // Prompt the user with an error
      JOptionPane.showMessageDialog(
          null, "You will go bankrupt if you try buying that, try selling some items.");
    }
  }