Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.User


    assertFalse(bm304.getTagList().contains("B"));
    assertFalse(bm304.getTagList().contains("C"));
  }
 
  public void testDeleteTag1() throws Exception{
    List<Bookmark> bmarks = bookmarkDao.pageBookmarks(new User(1),new Tag(1),0,10).getResult();
    assertEquals(3,bmarks.size());   
    bmarks = bookmarkDao.pageBookmarks(new User(1), new Tag(2),0,10).getResult();
    assertEquals(0,bmarks.size());
    Tag tagA = tagDao.getTag(1);
    assertEquals(4,tagA.getCount());
    Tag tagB = tagDao.getTag(2);
    assertEquals(0,tagB.getCount());
    LinkTag linkTag1000_A = tagDao.findLinkTag(new Link(1000),new Tag(1)).get(0);
    assertEquals(1,linkTag1000_A.getCount());
    LinkTag linkTag1001_A = tagDao.findLinkTag(new Link(1001),new Tag(1)).get(0);
    assertEquals(1,linkTag1001_A.getCount());
    LinkTag linkTag1002_A = tagDao.findLinkTag(new Link(1002),new Tag(1)).get(0);
    assertEquals(2,linkTag1002_A.getCount());
    Bookmark bm301 = bookmarkDao.getBookmark(301);
    assertTrue(bm301.getTagList().contains("A"));
    Bookmark bm302 = bookmarkDao.getBookmark(302);
    assertTrue(bm302.getTagList().contains("A"));
    Bookmark bm303 = bookmarkDao.getBookmark(303);
    assertTrue(bm303.getTagList().contains("A"));
    Bookmark bm304 = bookmarkDao.getBookmark(304);
    assertTrue(bm304.getTagList().contains("A"));
   
    action.setTag("A");
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS,code);
   
    bmarks = bookmarkDao.pageBookmarks(new User(1),new Tag(1),0,10).getResult();
    assertEquals(0,bmarks.size());
   
    tagA = tagDao.getTag(1);
    assertEquals(1,tagA.getCount());
   
View Full Code Here


    bm304 = bookmarkDao.getBookmark(304);
    assertTrue(bm304.getTagList().contains("A"));
  }
 
  public void testDeleteTag2() throws Exception{
    List<Bookmark> bmarks = bookmarkDao.pageBookmarks(new User(1),new Tag(1),0,10).getResult();
    assertEquals(3,bmarks.size());   
    bmarks = bookmarkDao.pageBookmarks(new User(1), new Tag(2),0,10).getResult();
    assertEquals(0,bmarks.size());
    Tag tagA = tagDao.getTag(1);
    assertEquals(4,tagA.getCount());
    Tag tagB = tagDao.getTag(2);
    assertEquals(0,tagB.getCount());
    LinkTag linkTag1000_A = tagDao.findLinkTag(new Link(1000),new Tag(1)).get(0);
    assertEquals(1,linkTag1000_A.getCount());
    LinkTag linkTag1001_A = tagDao.findLinkTag(new Link(1001),new Tag(1)).get(0);
    assertEquals(1,linkTag1001_A.getCount());
    LinkTag linkTag1002_A = tagDao.findLinkTag(new Link(1002),new Tag(1)).get(0);
    assertEquals(2,linkTag1002_A.getCount());
    Bookmark bm301 = bookmarkDao.getBookmark(301);
    assertTrue(bm301.getTagList().contains("A"));
    Bookmark bm302 = bookmarkDao.getBookmark(302);
    assertTrue(bm302.getTagList().contains("A"));
    Bookmark bm303 = bookmarkDao.getBookmark(303);
    assertTrue(bm303.getTagList().contains("A"));
    Bookmark bm304 = bookmarkDao.getBookmark(304);
    assertTrue(bm304.getTagList().contains("A"));
   
    action.setTag("B");
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS,code);
   
    // delete a 0-usage-freq tag is allowed.
    assertNull(GnizrDaoUtil.getUserTag(tagDao, new User(1), new Tag(2)));
   
    bmarks = bookmarkDao.pageBookmarks(new User(1),new Tag(1),0,10).getResult();
    assertEquals(3,bmarks.size());
   
    tagA = tagDao.getTag(1);
    assertEquals(4,tagA.getCount());
   
View Full Code Here

    return new FlatXmlDataSet(TestListForUserBookmark.class
        .getResourceAsStream("/TestListForUserBookmark-input.xml"));
  }
 
  public void testDoGetTotalCount() throws Exception{
    action.setLoggedInUser(new User("hchen1"));
    String code = action.doGetTotalCount();
    assertEquals(ActionSupport.SUCCESS,code);
    assertEquals(8,action.getTotalCount());
  }
View Full Code Here

    return new FlatXmlDataSet(TestEditSubscription.class.getResourceAsStream("/TestEditSubscription-input.xml"));
  }

  public void testCreateFeed() throws Exception{
    String feedUrl = "http://java.com/rss";
    action.setLoggedInUser(new User("hchen1"));
    action.setFeedUrl(feedUrl);
    action.setFeedTitle("java feed");
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS, code);
   
    FeedSubscription feed = feedManager.getSubscription(new User("hchen1"),feedUrl );
    assertNotNull(feed);
    assertEquals(feedUrl,feed.getBookmark().getLink().getUrl());
  }
View Full Code Here

    assertEquals(feedUrl,feed.getBookmark().getLink().getUrl());
  }
 
  public void testCreateFeed2() throws Exception{
    String feedUrl = "http://rss.slashdot.org/Slashdot/slashdot";
    User user = new User(1);
   
    action.setLoggedInUser(user);
    action.setFeedUrl(feedUrl);
    action.setFeedTitle("fjdskla");
View Full Code Here

    assertEquals("Slashdot Feed",feed.getBookmark().getTitle());   
  }
 
  public void testDeleteSubscription() throws Exception{
    String feedUrl = "http://rss.slashdot.org/Slashdot/slashdot";
    User user = new User(1);
   
    action.setLoggedInUser(user);
    action.setFeedUrl(feedUrl);
    action.setFeedTitle("fjdskla");
   
    String code = action.doDeleteSubscription();
    assertEquals(ActionSupport.SUCCESS,code);
   
    FeedSubscription feed = feedManager.getSubscription(new User("hchen1"),feedUrl );
    assertNull(feed);
  }
View Full Code Here

  protected IDataSet getDataSet() throws Exception {
    return new FlatXmlDataSet(TestListSubscriptions.class.getResourceAsStream("/TestListSubscriptions-input.xml"));
  }
 
  public void testGo() throws Exception{
    action.setLoggedInUser(new User("hchen1"));   
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS,code);
   
    List<FeedSubscription> subs = action.getSubscriptions();
    assertEquals(1,subs.size());
View Full Code Here

    assertEquals(20,subs.get(0).getId());
  }

 
  public void testGo2() throws Exception{
    action.setLoggedInUser(new User("hchen1"));
    action.setUsername("gnizr");
    String code = action.execute();
    assertEquals(ActionSupport.SUCCESS,code);
   
    List<FeedSubscription> subs = action.getSubscriptions();
View Full Code Here

  protected IDataSet getDataSet() throws Exception {
    return new FlatXmlDataSet(TestEditUserTag.class.getResourceAsStream("/TestEditUserTags-input.xml"));   
  }
 
  public void testAddRelatedTags() throws Exception{
    action.setLoggedInUser(new User(1));
    action.setTag("webwork");
    action.setRelatedTags("wii java");
    action.setNarrowerTags(null);
    action.setBroaderTags(null);
    action.setInstanceTags("");   
View Full Code Here

    assertTrue(related.contains("tag:"));
    assertTrue(related.contains("joe"));
  }
 
  public void testDeleteRelatedTags() throws Exception{
    action.setLoggedInUser(new User(1));
    action.setTag("webwork");
    action.setRelatedTags("wii gn:tag=hchen1/play java tag: ");
    action.setNarrowerTags(null);
    action.setBroaderTags(null);
    action.setInstanceTags("");   
View Full Code Here

TOP

Related Classes of com.gnizr.db.dao.User

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.