Ejemplo n.º 1
0
  @Test
  @DataSet
  public void testUpdateAccount() {
    Account account = new Account();
    account.setId(1);
    account.setAccountname("abc");
    account.setSaccountid(1);
    accountService.updateWithSession(account, "hai79");

    SimpleAccount simpleAccount = accountService.findById(1, 1);
    assertThat(simpleAccount.getAccountname()).isEqualTo("abc");
    assertThat(simpleAccount.getIndustry()).isEqualTo(null);
  }
Ejemplo n.º 2
0
  @Test
  @DataSet
  public void testMassUpdate() {
    List<Integer> updateKeys = Arrays.asList(1, 2, 3);
    Account account = new Account();
    account.setAssignuser("hai79");
    account.setIndustry("aaa");
    accountService.massUpdateWithSession(account, updateKeys, 1);

    AccountSearchCriteria criteria = new AccountSearchCriteria();
    criteria.setSaccountid(new NumberSearchField(1));

    List<SimpleAccount> accountList =
        accountService.findPagableListByCriteria(
            new SearchRequest<AccountSearchCriteria>(criteria, 0, Integer.MAX_VALUE));
    Assert.assertEquals(3, accountList.size());
    for (SimpleAccount account1 : accountList) {
      Assert.assertEquals("hai79", account1.getAssignuser());
    }
  }
  @Override
  public void displayConvertLeadInfo(final SimpleLead lead) {
    previewForm.removeAllComponents();
    this.lead = lead;

    Label header = new Label("Conversion Details");
    header.addStyleName("h2");
    previewForm.addComponent(header);

    GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 3);
    layoutHelper.getLayout().setWidth("100%");
    layoutHelper.getLayout().setMargin(false);
    layoutHelper.getLayout().addStyleName("colored-gridlayout");

    LOG.debug("Display associate account");
    AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class);
    final SimpleAccount account =
        accountService.findAccountAssoWithConvertedLead(lead.getId(), AppContext.getAccountId());
    if (account != null) {
      Button accountLink =
          new Button(
              account.getAccountname(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new AccountEvent.GotoRead(this, account.getId()));
                }
              });
      accountLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
      accountLink.setStyleName("link");
      layoutHelper.addComponent(accountLink, "Account", 0, 0);
    } else {
      layoutHelper.addComponent(new Label(""), "Account", 0, 0);
    }

    LOG.debug("Display associate contact");
    ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class);
    final SimpleContact contact =
        contactService.findContactAssoWithConvertedLead(lead.getId(), AppContext.getAccountId());
    if (contact != null) {
      Button contactLink =
          new Button(
              contact.getContactName(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new ContactEvent.GotoRead(this, contact.getId()));
                }
              });
      contactLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
      contactLink.setStyleName("link");
      layoutHelper.addComponent(contactLink, "Contact", 0, 1);
    } else {
      layoutHelper.addComponent(new Label(""), "Contact", 0, 1);
    }

    LOG.debug("Display associate opportunity");
    OpportunityService opportunityService =
        ApplicationContextUtil.getSpringBean(OpportunityService.class);
    final SimpleOpportunity opportunity =
        opportunityService.findOpportunityAssoWithConvertedLead(
            lead.getId(), AppContext.getAccountId());
    if (opportunity != null) {
      Button opportunityLink =
          new Button(
              opportunity.getOpportunityname(),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                  EventBusFactory.getInstance()
                      .post(new OpportunityEvent.GotoRead(this, opportunity.getId()));
                }
              });
      opportunityLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
      opportunityLink.setStyleName("link");
      layoutHelper.addComponent(opportunityLink, "Opportunity", 0, 2);
    } else {
      layoutHelper.addComponent(new Label(""), "Opportunity", 0, 2);
    }

    previewForm.addComponent(layoutHelper.getLayout());
    previewLayout.addBody(previewContent);

    this.addComponent(previewItemContainer);
  }
Ejemplo n.º 4
0
 @Test
 @DataSet
 public void testFindAccountById() {
   SimpleAccount account = accountService.findById(1, 1);
   assertThat(account.getAccountname()).isEqualTo("xyz");
 }
Ejemplo n.º 5
0
 @Test
 @DataSet
 public void testFindAccountById() {
   SimpleAccount account = accountService.findById(1, 1);
   Assert.assertEquals("xyz", account.getAccountname());
 }