Package org.geomajas.layer.hibernate.association.pojo

Examples of org.geomajas.layer.hibernate.association.pojo.AssociationFeature


*/
public class AssociationLayerTest extends AbstractHibernateAssociationTest {

  @Test
  public void testCreate() throws Exception {
    AssociationFeature feature = AssociationFeature.getDefaultInstance1(null);
    Object created = layer.create(feature);
    Assert.assertNotNull(created);
    Assert.assertTrue(created instanceof AssociationFeature);
    AssociationFeature createdFeature = (AssociationFeature) created;
    Assert.assertNotNull(createdFeature.getId());
  }
View Full Code Here


    Assert.assertNotNull(createdFeature.getId());
  }

  @Test
  public void testRead() throws Exception {
    AssociationFeature f1 = (AssociationFeature) layer.create(AssociationFeature.getDefaultInstance1(null));
    Assert.assertNotNull(f1.getId());
    Object feature = layer.read(f1.getId().toString());
    Assert.assertNotNull(feature);
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("rawtypes")
  public void testUpdate() throws Exception {
    AssociationFeature f1 = (AssociationFeature) layer.create(AssociationFeature.getDefaultInstance1(null));
    Assert.assertNotNull(f1.getId());
    Object feature = layer.read(f1.getId().toString());
    Assert.assertNotNull("The requested feature could not be found!", feature);

    // Create a detached copy
    AssociationFeature detached = AssociationFeature.getDefaultInstance1(null);
    detached.setId(((AssociationFeature) feature).getId());
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();

    // Set a ManyToOne attribute without an ID (a new one)
    attributes.put(MTO, ManyToOneProperty.getDefaultAttributeInstance(null));
View Full Code Here

    Assert.assertNotNull(manytoOne.getValue().getId()); // Test for ID
  }

  @Test
  public void testSave() throws Exception {
    AssociationFeature feature = AssociationFeature.getDefaultInstance1(null);
    Object created = layer.saveOrUpdate(feature);
    Assert.assertNotNull(created);
    Assert.assertTrue(created instanceof AssociationFeature);
    AssociationFeature createdFeature = (AssociationFeature) created;
    Assert.assertNotNull(createdFeature.getId());
  }
View Full Code Here

    Assert.assertNotNull(feature);
  }

  @Test
  public void testDelete() throws Exception {
    AssociationFeature f1 = (AssociationFeature) layer.create(AssociationFeature.getDefaultInstance1(null));
    Assert.assertNotNull(f1.getId());
    Assert.assertNotNull(layer.read(f1.getId().toString()));
    layer.delete(f1.getId().toString());
    try {
      layer.read(f1.getId().toString());
      Assert.fail("No exception thrown for non-exisiting feature");
    } catch (LayerException e) {
    }
  }
View Full Code Here

*/
public class FilterOneToManyTest extends AbstractHibernateAssociationTest {

  @Before
  public void setUpTestDataWithinTransaction() throws LayerException {
    AssociationFeature f1 = AssociationFeature.getDefaultInstance1(null);
    AssociationFeature f2 = AssociationFeature.getDefaultInstance2(null);
    AssociationFeature f3 = AssociationFeature.getDefaultInstance3(null);
    AssociationFeature f4 = AssociationFeature.getDefaultInstance4(null);

    Set<OneToManyProperty> otm1 = new HashSet<OneToManyProperty>();
    otm1.add(OneToManyProperty.getDefaultInstance1(null, f1));
    otm1.add(OneToManyProperty.getDefaultInstance2(null, f1));
    f1.setOneToMany(otm1);

    Set<OneToManyProperty> otm2 = new HashSet<OneToManyProperty>();
    otm2.add(OneToManyProperty.getDefaultInstance3(null, f2));
    otm2.add(OneToManyProperty.getDefaultInstance4(null, f2));
    f2.setOneToMany(otm2);

    Set<OneToManyProperty> otm3 = new HashSet<OneToManyProperty>();
    otm3.add(OneToManyProperty.getDefaultInstance1(null, f3));
    otm3.add(OneToManyProperty.getDefaultInstance3(null, f3));
    f3.setOneToMany(otm3);

    Set<OneToManyProperty> otm4 = new HashSet<OneToManyProperty>();
    otm4.add(OneToManyProperty.getDefaultInstance1(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance2(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance3(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance4(null, f4));
    f4.setOneToMany(otm4);

    layer.create(f1);
    layer.create(f2);
    layer.create(f3);
    layer.create(f4);
View Full Code Here

  @Autowired
  private FilterService filterService;

  @Before
  public void setUpTestDataWithinTransaction() throws LayerException {
    AssociationFeature f1 = AssociationFeature.getDefaultInstance1(null);
    AssociationFeature f2 = AssociationFeature.getDefaultInstance2(null);
    AssociationFeature f3 = AssociationFeature.getDefaultInstance3(null);
    AssociationFeature f4 = AssociationFeature.getDefaultInstance4(null);

    Set<OneToManyProperty> otm1 = new HashSet<OneToManyProperty>();
    otm1.add(OneToManyProperty.getDefaultInstance1(null, f1));
    otm1.add(OneToManyProperty.getDefaultInstance2(null, f1));
    f1.setOneToMany(otm1);

    Set<OneToManyProperty> otm2 = new HashSet<OneToManyProperty>();
    otm2.add(OneToManyProperty.getDefaultInstance3(null, f2));
    otm2.add(OneToManyProperty.getDefaultInstance4(null, f2));
    f2.setOneToMany(otm2);

    Set<OneToManyProperty> otm3 = new HashSet<OneToManyProperty>();
    otm3.add(OneToManyProperty.getDefaultInstance1(null, f3));
    otm3.add(OneToManyProperty.getDefaultInstance3(null, f3));
    f3.setOneToMany(otm3);

    Set<OneToManyProperty> otm4 = new HashSet<OneToManyProperty>();
    otm4.add(OneToManyProperty.getDefaultInstance1(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance2(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance3(null, f4));
    otm4.add(OneToManyProperty.getDefaultInstance4(null, f4));
    f4.setOneToMany(otm4);

    layer.create(f1);
    layer.create(f2);
    layer.create(f3);
    layer.create(f4);
View Full Code Here

TOP

Related Classes of org.geomajas.layer.hibernate.association.pojo.AssociationFeature

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.