Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.TagProperty


  protected IDataSet getDataSet() throws Exception {
    return new FlatXmlDataSet(TestTagPropertyDBDao.class.getResourceAsStream("/dbunit/tagprptdbdao/TestTagPrptDBDao-input.xml"));
  }

  public void testGetTagProperty() throws Exception{
    TagProperty prpt = dao.getTagProperty(1);
    assertNotNull(prpt);
    assertEquals("related",prpt.getName());
    assertEquals("skos",prpt.getNamespacePrefix());
    assertEquals("default",prpt.getPropertyType());
    assertEquals(TagProperty.CARDINALITY_ONE_OR_MORE,prpt.getCardinality());
    assertNull(dao.getTagProperty(4000));
    assertNull(dao.getTagProperty(0));
    assertNull(dao.getTagProperty(-1032));
  }
View Full Code Here


    assertNull(dao.getTagProperty(0));
    assertNull(dao.getTagProperty(-1032));
  }
 
  public void testDeleteTagProperty() throws Exception{
    TagProperty prpt = dao.getTagProperty(2);
    assertNotNull(prpt);
    assertTrue(dao.deleteTagProperty(2));
    assertNull(dao.getTagProperty(2));
  }
View Full Code Here

    assertTrue(dao.deleteTagProperty(2));
    assertNull(dao.getTagProperty(2));
  }
 
  public void testCreateTagProperty() throws Exception{
    TagProperty prpt = new TagProperty();
    prpt.setName("foobar");
    prpt.setNamespacePrefix("xx")
    prpt.setPropertyType(TagProperty.TYPE_DEFAULT);

    int id = dao.createTagProperty(prpt);
    assertNotNull(id);
    assertTrue((id >0));
    TagProperty prptCopy = dao.getTagProperty(id);
    assertEquals(prpt.getName(),prptCopy.getName());
    assertEquals(prpt.getNamespacePrefix(),prptCopy.getNamespacePrefix());
    assertEquals(TagProperty.CARDINALITY_ONE_OR_MORE,prptCopy.getCardinality());
    assertEquals(TagProperty.TYPE_DEFAULT,prptCopy.getPropertyType())
  }
View Full Code Here

    assertEquals(TagProperty.CARDINALITY_ONE_OR_MORE,prptCopy.getCardinality());
    assertEquals(TagProperty.TYPE_DEFAULT,prptCopy.getPropertyType())
  }
 
  public void testUpdateTagProperty() throws Exception{
    TagProperty prpt = new TagProperty();
    prpt.setName("foobar");
    prpt.setNamespacePrefix("xx")
   
    int id = dao.createTagProperty(prpt);
    prpt = dao.getTagProperty(id);
    assertEquals("foobar",prpt.getName());
    assertEquals(TagProperty.TYPE_DEFAULT,prpt.getPropertyType());
   
    prpt.setPropertyType(TagProperty.TYPE_SPATIAL);
    assertTrue(dao.updateTagProperty(prpt));
   
    prpt = dao.getTagProperty(id);
    assertEquals(TagProperty.TYPE_SPATIAL,prpt.getPropertyType());
  }
View Full Code Here

    List<TagProperty> prpt = dao.findTagProperty();
    assertEquals(4,prpt.size());
  }
 
  public void testGetTagPropertyNSName() throws Exception{
    TagProperty tagPrpt = dao.getTagProperty("skos","related");
    assertNotNull(tagPrpt);
    assertEquals(1,tagPrpt.getId());
   
    tagPrpt = dao.getTagProperty("gn", "resident");
    assertNotNull(tagPrpt);
    assertEquals(4,tagPrpt.getId());
  }
View Full Code Here

  }
 
  public void testCreateTagAssertion() throws Exception{
    TagAssertion asrt = new TagAssertion();
    asrt.setSubject(new UserTag((104)));
    asrt.setProperty(new TagProperty((1)));
    asrt.setObject(new UserTag((103)));
    asrt.setUser(new User((1)));
    int id = dao.createTagAssertion(asrt);
    assertNotNull(id);
    assertTrue((id >0));
View Full Code Here

 
  public void testUpdateTagAssertion() throws Exception{
    TagAssertion asrt = dao.getTagAssertion((1));
    assertNotNull(asrt);
    assertEquals((1),asrt.getProperty().getId());
    asrt.setProperty(new TagProperty((3)));
    assertTrue(dao.updateTagAssertion(asrt));
    asrt = dao.getTagAssertion((1));
    assertEquals((3),asrt.getProperty().getId());
  }
View Full Code Here

  }
 
  public void testFindTagAssertion() throws Exception{
    User user = new User((1));
    UserTag subjectTag = new UserTag((100));
    TagProperty tagPrpt = new TagProperty((1));
    UserTag objectTag = new UserTag((101));
    List<TagAssertion> assertions = dao.findTagAssertion(user, subjectTag, tagPrpt, objectTag);
    assertEquals(1,assertions.size());
  }
View Full Code Here

  }
 
  public void testFindTagAssertionSubjectPrpt() throws Exception{
    User hchen1 = new User((1));
    UserTag cnn = new UserTag((100));
    TagProperty related = new TagProperty((1));
    List<TagAssertion> assertions = dao.findTagAssertion(hchen1,cnn,related,null);
    assertEquals(1,assertions.size());
  }
View Full Code Here

  }
 
  public void testFindTagAssertionPrptObject() throws Exception{
    User hchen1 = new User((1));
    UserTag breakingnews = new UserTag((103));
    TagProperty narrower = new TagProperty((3));
    List<TagAssertion> assertions = dao.findTagAssertion(hchen1,null,narrower,breakingnews);
    assertEquals(1,assertions.size());
  }
View Full Code Here

TOP

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

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.