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;
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");
+ }
+
+ */
}