예제 #1
0
  @Test
  public void test() {
    final TestSvc test = (TestSvc) context.getBean("testSvc");

    // *AssignCache assignments are not very dynamic by their very nature.
    // Take care to invalidate the caches before each of the *AssignCache tests
    test.invalidateL2AssignIndia(System.currentTimeMillis());

    // Set the first cached datum
    final String orig = test.getL2AssignGolf(999L, RandomStringUtils.randomAlphabetic(4) + "-");

    // Make sure the value is definitely in there
    for (int ix = 0; ix < 3; ix++) {
      assertEquals(
          orig,
          test.getL2AssignGolf(1000L + ix, RandomStringUtils.randomAlphanumeric(4 + ix) + "-"));
    }

    // Force the update to happen.
    final String renew =
        test.getL2AssignHotel(
            System.currentTimeMillis(), RandomStringUtils.randomAlphanumeric(8) + "-");
    assertFalse(orig.equals(renew));

    // Make sure the NEW value is definitely in there
    for (int ix = 0; ix < 3; ix++) {
      assertEquals(
          renew,
          test.getL2AssignGolf(1000L + ix, RandomStringUtils.randomAlphanumeric(8 + ix) + "-"));
    }
  }
예제 #2
0
 private void wait4Load(String childFolderId) {
   long timeout = System.currentTimeMillis() + 120000;
   while (!getJspTestUtils().isElement(By.id(childFolderId))
       && timeout < System.currentTimeMillis()) {
     getJspTestUtils().waitSec();
     LOGGER.info("WAITING");
   }
 }
예제 #3
0
 // Create OrderStatus Pass Case. Case when description is unique and Flag is Invoice(Allowed)
 @Test
 public void createOrderStatus() {
   String statusName = "Test: " + System.currentTimeMillis();
   refOrderStatus = buildOrderStatus(OrderStatusFlag.INVOICE, statusName);
   refOrderStatus.setId(api.createUpdateOrderStatus(refOrderStatus));
   assertNotNull("Order status created", refOrderStatus.getId());
 }
예제 #4
0
  private InvoiceWS buildInvoice(Integer userId, Integer itemId) {
    InvoiceWS invoice = new InvoiceWS();
    invoice.setUserId(userId);
    invoice.setNumber("800" + System.currentTimeMillis());
    invoice.setTotal("15");
    invoice.setToProcess(1);
    invoice.setBalance("15");
    invoice.setCurrencyId(CURRENCY_USD);
    invoice.setDueDate(new Date());
    invoice.setPaymentAttempts(1);
    invoice.setInProcessPayment(1);
    invoice.setCarriedBalance("0");

    InvoiceLineDTO invoiceLineDTO = new InvoiceLineDTO();
    invoiceLineDTO.setAmount("15");
    invoiceLineDTO.setDescription("line desc");
    invoiceLineDTO.setItemId(itemId);
    invoiceLineDTO.setPercentage(1);
    invoiceLineDTO.setPrice("15");
    invoiceLineDTO.setQuantity("1");
    invoiceLineDTO.setSourceUserId(userId);

    invoice.setInvoiceLines(new InvoiceLineDTO[] {invoiceLineDTO});
    return invoice;
  }
예제 #5
0
 private ItemTypeWS buildItemType() {
   ItemTypeWS type = new ItemTypeWS();
   type.setDescription("Invoice, Item Type:" + System.currentTimeMillis());
   type.setOrderLineTypeId(1); // items
   type.setAllowAssetManagement(0); // does not manage assets
   type.setOnePerCustomer(false);
   type.setOnePerOrder(false);
   return type;
 }
예제 #6
0
  // Update Order Status Description Pass case. Case when description is unique.
  @Test
  public void createUpdateOrderStatus() {
    // create vanilla Invoice order status
    String statusName = "Update Test: " + System.currentTimeMillis();
    refOrderStatus = buildOrderStatus(OrderStatusFlag.INVOICE, statusName);
    refOrderStatus.setId(api.createUpdateOrderStatus(refOrderStatus));

    // refresh and verify description
    refOrderStatus = api.findOrderStatusById(refOrderStatus.getId());
    assertEquals("Description should match", statusName, refOrderStatus.getDescription());

    // modify the description of the order status
    String newDescription = "New Update Test: " + System.currentTimeMillis();
    refOrderStatus.setDescription(newDescription);
    refOrderStatus.setDescriptions(buildDescriptions(newDescription));

    api.createUpdateOrderStatus(refOrderStatus);
    refOrderStatus = api.findOrderStatusById(refOrderStatus.getId());
    assertEquals(
        "Updated Description should match", newDescription, refOrderStatus.getDescription());
  }
예제 #7
0
  // Delete Order Status Pass case.
  @Test(expectedExceptions = SessionInternalError.class)
  public void deleteOrderStatus() {
    String statusName = "Test: " + System.currentTimeMillis();
    refOrderStatus = buildOrderStatus(OrderStatusFlag.INVOICE, statusName);
    Integer orderStatusId = api.createUpdateOrderStatus(refOrderStatus);

    refOrderStatus = api.findOrderStatusById(orderStatusId);
    api.deleteOrderStatus(refOrderStatus);
    refOrderStatus = null; // mark as deleted

    // explodes with exception because the order status does not exist anymore
    refOrderStatus = api.findOrderStatusById(orderStatusId);
  }
예제 #8
0
  // Update Order Status fail case. Case when status flag is set to finished(Already exist)
  @Test(expectedExceptions = SessionInternalError.class)
  public void createUpdateOrderStatus2() {
    // create vanilla Invoice order status
    String statusName = "Update Test: " + System.currentTimeMillis();
    refOrderStatus = buildOrderStatus(OrderStatusFlag.INVOICE, statusName);
    refOrderStatus.setId(api.createUpdateOrderStatus(refOrderStatus));

    // attempt to change flag from INVOICE to FINISHED
    //		refOrderStatus = api.findOrderStatusById(refOrderStatus.getId());
    refOrderStatus.setOrderStatusFlag(OrderStatusFlag.FINISHED);

    api.createUpdateOrderStatus(refOrderStatus);
  }
예제 #9
0
 private ItemDTOEx buildItem(Integer itemTypeId, Integer priceModelCompanyId) {
   ItemDTOEx item = new ItemDTOEx();
   long millis = System.currentTimeMillis();
   String name = String.valueOf(millis) + new Random().nextInt(10000);
   item.setDescription("Payment, Product:" + name);
   item.setPriceModelCompanyId(priceModelCompanyId);
   item.setPrice(new BigDecimal("10"));
   item.setNumber("PYM-PROD-" + name);
   item.setAssetManagementEnabled(0);
   Integer typeIds[] = new Integer[] {itemTypeId};
   item.setTypes(typeIds);
   return item;
 }
예제 #10
0
 private Integer getOrCreateOrderChangeStatusApply(JbillingAPI api) {
   OrderChangeStatusWS[] statuses = api.getOrderChangeStatusesForCompany();
   for (OrderChangeStatusWS status : statuses) {
     if (status.getApplyToOrder().equals(ApplyToOrder.YES)) {
       return status.getId();
     }
   }
   // there is no APPLY status in db so create one
   OrderChangeStatusWS apply = new OrderChangeStatusWS();
   String status1Name = "APPLY: " + System.currentTimeMillis();
   OrderChangeStatusWS status1 = new OrderChangeStatusWS();
   status1.setApplyToOrder(ApplyToOrder.YES);
   status1.setDeleted(0);
   status1.setOrder(1);
   status1.addDescription(
       new InternationalDescriptionWS(Constants.LANGUAGE_ENGLISH_ID, status1Name));
   return api.createOrderChangeStatus(apply);
 }
예제 #11
0
  @BeforeMethod
  public void setUp() throws Exception {
    // do cleanup of other tests that may have started writers.
    // this is necessary in a non-forked test suite environment
    // where partition ids could collide
    Utils.finishBackupWriters();

    m_tmpDir = new File(System.getProperty("java.io.tmpdir"), "PartitionStoreStageTest");
    if (!m_tmpDir.exists()) {
      assertTrue("Failed to make the directories.", m_tmpDir.mkdirs());
    }

    // Add a dummy partition
    String server = "test";
    String storage = m_tmpDir + "/storage";

    File storageDir = new File(storage);
    if (!storageDir.exists()) {
      assertTrue("Failed to make the storage directory.", storageDir.mkdirs());
      if (!storageDir.exists()) {
        s_logger.warn("Storage Directory " + storage + " does not exist.");
      }
    }

    String mapped = m_tmpDir + "/mapped";

    File mappedDir = new File(mapped);
    if (!mappedDir.exists()) {
      assertTrue("Failed to make the mapped directories.", mappedDir.mkdirs());
      if (!mappedDir.exists()) {
        s_logger.warn("Storage Directory " + mapped + " does not exist.");
      }
    }

    if (m_part == null) {
      IPartitionManager pm = ManagementContainer.getInstance().getPartitionManager();
      m_part = pm.initializePartition(TEST_PID, server, storage, mapped);
    }
    Utils.startBackupWriters();
  }
예제 #12
0
 // Create OrderStatus Fail case. Case when Status flag is SUSPENDED_AGEING.(It already exist)
 @Test(expectedExceptions = SessionInternalError.class)
 public void createOrderStatus3() {
   String statusName = "Test3: " + System.currentTimeMillis();
   OrderStatusWS orderStatus = buildOrderStatus(OrderStatusFlag.SUSPENDED_AGEING, statusName);
   api.createUpdateOrderStatus(orderStatus);
 }
예제 #13
0
 // Create OrderStatus Fail case. Case when Status flag is Finished.(It already exist)
 @Test(expectedExceptions = SessionInternalError.class)
 public void createOrderStatus2() {
   String statusName = "Test2: " + System.currentTimeMillis();
   OrderStatusWS orderStatusWS = buildOrderStatus(OrderStatusFlag.FINISHED, statusName);
   api.createUpdateOrderStatus(orderStatusWS);
 }
예제 #14
0
 public TestUcfOpenDj() throws JAXBException {
   System.setProperty("midpoint.home", "target/midPointHome/");
 }
예제 #15
0
  @Test
  public void verifyRetentionPolicyFilterForRetentionHolds() throws Exception {
    // Create a new Test User
    LOGGER.info("Creating a new Test user");
    String currentTime = Long.toString(System.currentTimeMillis());
    String userName = "******" + currentTime;
    String userAddress = userName + "@" + getJspTestUtils().getDomain();
    String password = getJspTestUtils().getPasswd();

    getJspTestUtils().createTestUser(userName, userAddress, password);

    int custId = getJspTestUtils().getCustId();
    LOGGER.info("Test user creation completed:" + userAddress);
    LOGGER.info("Customer Id is: " + Integer.toString(custId));

    // Get Retention policy manager, Reviewer group manager and User manager
    IRetentionPolicyManager mgr = ManagementContainer.getInstance().getRetentionPolicyManager();
    IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager();
    IUserManager um = ManagementContainer.getInstance().getUserManager();

    // Create Reviewer User set-1  for reviewers
    UserAccount reviewer1 = um.findUserForEmail(getJspTestUtils().m_userAddress);
    SavedUserSet sus1 = new SavedUserSet(custId);
    sus1.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer1.getUserID()))));
    // sus1.setInternal(true);
    sus1.setName("REVIEWERS-1");
    um.saveUserSet(sus1);
    // Create User set-1 for users whose mails will be reviewed by reviewer
    SavedUserSet scope1 = InternalUserSets.getAllUsersSet(custId);
    // scope1.setInternal(true);
    scope1.setName("SCOPE-1");
    um.saveUserSet(scope1);
    // Create Reviewer group-1
    LOGGER.info("Creating Reviewer group reviewerGrp1");
    ReviewerGroup rg1 = rgm.createReviewerGroup(custId, "reviewerGrp1", sus1, scope1, null);
    rgm.updateReviewerGroup(rg1);
    rg1 = rgm.getReviewerGroup(custId, "reviewerGrp1");
    LOGGER.info(
        "Reviewer group creation done. Reviewer group details-> GroupId:"
            + rg1.getGroupID()
            + ";GroupName:"
            + rg1.getGroupName());

    RetentionPolicy qblh1 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-1",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp1");
    LOGGER.info(
        "Query based legal hold QBLH-1 details-> Policy Id:"
            + qblh1.getId()
            + ";Policy Name:"
            + qblh1.getName());

    // Create Reviewer User set-2 for reviewers
    UserAccount reviewer2 = um.findUserForEmail(userAddress);
    SavedUserSet sus2 = new SavedUserSet(custId);
    sus2.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer2.getUserID()))));
    sus2.setName("REVIEWERS-2");
    um.saveUserSet(sus2);
    // Create User set-2 for users whose mails will be reviewed by reviewer
    SavedUserSet scope2 = InternalUserSets.getAllUsersSet(custId);
    scope2.setName("SCOPE-2");
    um.saveUserSet(scope2);
    // Create Reviewer group-2
    ReviewerGroup rg2 = rgm.createReviewerGroup(custId, "reviewerGrp2", sus2, scope2, null);
    rgm.updateReviewerGroup(rg2);
    rg2 = rgm.getReviewerGroup(custId, "reviewerGrp2");
    LOGGER.info("Reviewer group details:" + rg2.getGroupID() + ";" + rg2.getGroupName());
    RetentionPolicy qblh2 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-2",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp2");
    LOGGER.info(
        "Query based legal hold QBLH-2 details-> Policy Id:"
            + qblh2.getId()
            + ";Policy Name:"
            + qblh2.getName());

    // Login as reviewer-1  and verify QBLH-1 is visible to reviewer-1 and QBLH-2 is not visible
    LOGGER.info("Logging in as reviewer-1");
    getJspTestUtils()
        .login(getJspTestUtils().m_cappLoginUrl, getJspTestUtils().m_userAddress, password);
    getJspTestUtils().navigateToArchivePage();
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-1 is not present for REVIEWERS-1",
        getJspTestUtils().findElement(By.linkText("QBLH-1")));
    assertFalse(
        "Query Based legal hold QBLH-2 is present for REVIEWERS-1",
        getJspTestUtils().isElement(By.linkText("QBLH-2")));
    getJspTestUtils().logout();

    // Login as reviewer-2  and verify QBLH-2 is visible to reviewer-2 and QBLH-1 is not visible
    LOGGER.info("Logging in as reviewer-2");
    getJspTestUtils().login(getJspTestUtils().m_cappLoginUrl, userAddress, password);
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-2 is not present for REVIEWERS-2",
        getJspTestUtils().findElement(By.linkText("QBLH-2")));
    assertFalse(
        "Query Based legal hold QBLH-1 is present for REVIEWERS-2",
        getJspTestUtils().isElement(By.linkText("QBLH-1")));
    getJspTestUtils().logout();
  }