]> SALOME platform Git repositories - modules/gde.git/blobdiff - projects/GDE_App/GDE-war/test/com/edf/gde/test/dao/AttributeDaoTest.java
Salome HOME
Attribute DAO
[modules/gde.git] / projects / GDE_App / GDE-war / test / com / edf / gde / test / dao / AttributeDaoTest.java
index 146981901f9a875ec50562a31dc35d7201992f1d..30f44a1cb99c273331075f26d3fc70447f74878d 100644 (file)
@@ -9,7 +9,6 @@ import com.edf.gde.transferables.AttributeGroupTO;
 import com.edf.gde.transferables.AttributeTO;
 import org.junit.After;
 import org.junit.AfterClass;
-import org.junit.Assert;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -43,32 +42,64 @@ public class AttributeDaoTest extends BaseTest {
     public void testCreateAttribute() throws Exception {
         AttributeDaoClient daoClient = new AttributeDaoClient();
         testName("createAttribute");
-        
         /* Create an instance of AttributeGroup*/
         AttributeGroupTO attributeGroup = new AttributeGroupTO();
         AttributeGroupTO resultAttributeGroup = daoClient.createAttributeGroup(attributeGroup);
         assertNotNull(resultAttributeGroup);
-        assertTrue(resultAttributeGroup.getId()>0);
+        assertTrue(resultAttributeGroup.getId() > 0);
+        /* Create Attribute */
         AttributeTO ato = new AttributeTO();
         ato.setName("Attribute1");
         ato.setType("integer");
         ato.setValue("12");
         ato.setGroupId(resultAttributeGroup.getId());
         AttributeTO newAttribute = daoClient.createAttribute(ato);
-        
         assertNotNull(newAttribute);
-        assertEquals(ato.getName(),newAttribute.getName());
-        assertTrue(newAttribute.getId()!=0);
-        try {
+        assertEquals(ato.getName(), newAttribute.getName());
+        assertTrue(newAttribute.getId() != 0);
+        passed();
+    }
+
+    @Test
+    public void testDeleteAttribute() throws Exception {
+        AttributeDaoClient daoClient = new AttributeDaoClient();
+        testName("deleteAttribute");
+        /* Create an instance of AttributeGroup*/
+        AttributeGroupTO attributeGroup = new AttributeGroupTO();
+        AttributeGroupTO resultAttributeGroup = daoClient.createAttributeGroup(attributeGroup);
+        assertNotNull(resultAttributeGroup);
+        assertTrue(resultAttributeGroup.getId() > 0);
+        /* Create Attribute */
+        AttributeTO ato = new AttributeTO();
+        ato.setName("Attribute2");
+        ato.setType("long");
+        ato.setValue("13");
+        ato.setGroupId(resultAttributeGroup.getId());
+        AttributeTO newAttribute = daoClient.createAttribute(ato);
+        assertNotNull(newAttribute);
+        assertEquals(ato.getName(), newAttribute.getName());
+        assertTrue(newAttribute.getId() != 0);
         daoClient.deleteAttribute(newAttribute.getId());
-        } catch (Exception e) {
-            Assert.fail("Error deleting attribute");
-        }
-        try {
-        daoClient.deleteAttributeGroup(resultAttributeGroup.getId());
-        } catch (Exception e) {
-            Assert.fail("Error deleting attribute group");
-        }
         passed();
     }
+
+    @Test
+    public void createAttributeGroup() throws Exception {
+        AttributeDaoClient daoClient = new AttributeDaoClient();
+        testName("createAttributeGroup");
+        /* Create an instance of AttributeGroup*/
+        AttributeGroupTO attributeGroup = new AttributeGroupTO();
+        AttributeGroupTO resultAttributeGroup = daoClient.createAttributeGroup(attributeGroup);
+        assertNotNull(resultAttributeGroup);
+        assertTrue(resultAttributeGroup.getId() > 0);
+        passed();
+    }
+    /*
+     try {
+     daoClient.deleteAttributeGroup(resultAttributeGroup.getId());
+     } catch (Exception e) {
+     Assert.fail("Error deleting attribute group");
+     }
+
+     */
 }