Package com.changestuffs.shared.actions

Examples of com.changestuffs.shared.actions.ArticlesAddAction


  @Override
  public void handleSubmit(final Tags tag, final String name,
      final String interestedIn, final String language) {
    final Date date = new Date();
    dispatcher.execute(
        new ArticlesAddAction(tag, name, editorPresenter.getHtml(),
            date, interestedIn, language),
        new AsyncCallback<ArticlesAddResult>() {
          @Override
          public void onFailure(Throwable caught) {
            GWT.log("Error", caught);
View Full Code Here


        });
  }

  @Override
  public void updateProduct(Tags tag, String name, String interestedIn, String language) {
    final ArticlesAddAction action = new ArticlesAddAction(tag, name, editorPresenter.getHtml(), new Date(), keyHash, interestedIn, language);
    dispatcher.execute(action, new AsyncCallback<ArticlesAddResult>() {
      @Override
      public void onFailure(Throwable caught) {
        GWT.log("Some error", caught);
      }
      @Override
      public void onSuccess(ArticlesAddResult result) {
        ArticlesDtoOut articlesDto = new ArticlesDtoOut();
        articlesDto.setDate(action.getDate());
        articlesDto.setKeyHash(action.getKeyHash());
        articlesDto.setName(action.getName());
        articlesDto.setTag(result.getTagOut());
        uiHandlers.updateSuccessProduct(articlesDto);
        Builder request = new PlaceRequest.Builder().nameToken(
            NameTokens.getLookfor()).with(
            LookforPresenter.Parameters.id.name(),
View Full Code Here

  }
 
  @Test
  public void testAll(){
   
    ArticlesAddAction dto = createArticlesDtoIn(tag);
    checksInsert(dto);
    checksGetProductAndRemove();
   
  }
View Full Code Here

   
  }
 
  @Test
  public void testGetArticles(){ 
    ArticlesAddAction dto1 = createArticlesDtoIn(tag);
    Product product1 = oam.insertArticle(dto1, userId);
   
    ArticlesAddAction dto2 = createArticlesDtoIn(Tags.entertainment);
    Product product2 = oam.insertArticle(dto2, userId);
   
    LookForAction action1 = new LookForAction(dto1.getTag(), null);
    Map<String, IArticlesDto> articles1 = oam.getArticles(action1, null);
    assertEquals(1, articles1.size());
    String key1 = KeyFactory.keyToString(product1.getKey());
    assertTrue(articles1.containsKey(key1));
    assertEquals(dto1.getTag(), articles1.get(key1).getTag());
   
    LookForAction action2 = new LookForAction(null, KeyFactory.keyToString(product2.getKey()));
    Map<String, IArticlesDto> articles2 = oam.getArticles(action2, null);
    assertEquals(1, articles2.size());
    String key2 = KeyFactory.keyToString(product2.getKey());
    assertTrue(articles2.containsKey(key2));
    assertEquals(dto2.getTag(), articles2.get(key2).getTag());
  }
View Full Code Here

    Map<String, String> keys = oam.addImages(userId, images);
    assertEquals(2, keys.size());
  }
 
  private ArticlesAddAction createArticlesDtoIn(Tags tag){
    return new ArticlesAddAction(tag, name, description, date, interestedIn, null);
  }
View Full Code Here

    assertEquals(description, product.getDescription().getValue());
    assertEquals(name, product.getName());
    assertEquals(userId, product.getUserId());
    assertEquals(date, product.getDate());
   
    ArticlesAddAction forUpdate = new ArticlesAddAction(Tags.clothes, "anyName", "anyDescription", new Date(), KeyFactory.keyToString(product.getKey()), "interest", null);
    Product productUpdatedNoDb = oam.updateArticle(forUpdate, userId);
    Product productUpdated = lookUpProduct(productUpdatedNoDb.getKey());
    assertNotNull(productUpdated);
    assertEquals(forUpdate.getName(), productUpdated.getName());
    assertEquals(forUpdate.getDate(), productUpdated.getDate());
    assertEquals(forUpdate.getDescription(), productUpdated.getDescription().getValue());
  }
View Full Code Here

TOP

Related Classes of com.changestuffs.shared.actions.ArticlesAddAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.