\
@@ -187,7 +189,7 @@ var PetsView = (function() {//creo clase
var createPetsRow = function(pet) {
return '
\
' + pet.name + ' | \
- ' + pet.id_person + ' | \
+ ' + pet.id_person + ' | \
' + pet.food + ' | \
\
Editar\
diff --git a/src/test/java/es/uvigo/esei/daa/dataset/PetsDataset.java b/src/test/java/es/uvigo/esei/daa/dataset/PetsDataset.java
new file mode 100644
index 0000000..55f700d
--- /dev/null
+++ b/src/test/java/es/uvigo/esei/daa/dataset/PetsDataset.java
@@ -0,0 +1,83 @@
+package es.uvigo.esei.daa.dataset;
+
+import static java.util.Arrays.binarySearch;
+import static java.util.Arrays.stream;
+
+import java.util.Arrays;
+import java.util.function.Predicate;
+
+import es.uvigo.esei.daa.entities.Pet;
+
+public final class PetsDataset {
+ private PetsDataset() {}
+
+ public static Pet[] pets() {
+ return new Pet[] {
+ new Pet(1, "Pepe", "Pienso",1),
+ new Pet(2, "Ali", "Pescado",2),
+ new Pet(3, "Nico", "Pienso",3),
+ new Pet(4, "Kiko", "Pienso",4),
+ new Pet(5, "Blanca", "Atún",7),
+ new Pet(6, "Copito", "Pienso",6),
+ new Pet(7, "Perico", "Pienso",7),
+ new Pet(8, "Shiro", "Carne",8),
+ new Pet(9, "Pancho", "Pollo",9),
+ new Pet(10, "Mimi", "Atun",10)
+ };
+ }
+
+ public static Pet[] petsOfOwner(int ownerId) {
+ return stream(pets())
+ .filter(pet -> pet.getId_person() == ownerId)
+ .toArray(Pet[]::new);
+ }
+
+ public static Pet[] petsWithout(int ... ids) {
+ Arrays.sort(ids);
+
+ final Predicate hasValidId = pet ->
+ binarySearch(ids, pet.getId()) < 0;
+
+ return stream(pets())
+ .filter(hasValidId)
+ .toArray(Pet[]::new);
+ }
+
+ public static Pet pet(int id) {
+ return stream(pets())
+ .filter(pet -> pet.getId() == id)
+ .findAny()
+ .orElseThrow(IllegalArgumentException::new);
+ }
+
+ public static int existentId() {
+ return 5;
+ }
+
+ public static int nonExistentId() {
+ return 34;
+ }
+
+ public static Pet existentPet() {
+ return pet(existentId());
+ }
+
+ public static Pet nonExistentPet() {
+ return new Pet(nonExistentId(), "Jane", "palitos", 18);
+ }
+
+ public static String newName() {
+ return "John";
+ }
+
+ public static String newFood() {
+ return "Maiz";
+ }
+ public static int newIdPerson() {
+ return 7;
+ }
+
+ public static Pet newPet() {
+ return new Pet(pets().length + 1, newName(), newFood(),newIdPerson());
+ }
+}
diff --git a/src/test/java/es/uvigo/esei/daa/entities/PetUnitTest.java b/src/test/java/es/uvigo/esei/daa/entities/PetUnitTest.java
new file mode 100644
index 0000000..62a5a42
--- /dev/null
+++ b/src/test/java/es/uvigo/esei/daa/entities/PetUnitTest.java
@@ -0,0 +1,103 @@
+package es.uvigo.esei.daa.entities;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
+
+public class PetUnitTest {
+ @Test
+ public void testPetIntStringString() {
+ final int id = 1;
+ final String name = "John";
+ final String food = "Maiz";
+ final int id_person = 7;
+
+
+ final Pet pet = new Pet(id, name, food,id_person);
+
+ assertThat(pet.getId(), is(equalTo(id)));
+ assertThat(pet.getName(), is(equalTo(name)));
+ assertThat(pet.getFood(), is(equalTo(food)));
+ assertThat(pet.getId_person(), is(equalTo(id_person)));
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testPetIntStringStringNullName() {
+ new Pet(1, null, "Maiz",7);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testPetIntStringStringNullFood() {
+ new Pet(1, "John", null,7);
+ }
+
+ @Test
+ public void testSetName() {
+ final int id = 1;
+ final String food = "Maiz";
+ final int id_person = 7;
+
+ final Pet pet = new Pet(id, "John", food,id_person);
+ pet.setName("Juan");
+
+ assertThat(pet.getId(), is(equalTo(id)));
+ assertThat(pet.getName(), is(equalTo("Juan")));
+ assertThat(pet.getFood(), is(equalTo(food)));
+ assertThat(pet.getId_person(), is(equalTo(id_person)));
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testSetNullName() {
+ final Pet pet = new Pet(1, "John", "Maiz",7);
+
+ pet.setName(null);
+ }
+
+ @Test
+ public void testSetFood() {
+ final int id = 1;
+ final String name = "John";
+ final int id_person = 7;
+
+ final Pet pet = new Pet(id, name, "Maiz",id_person);
+ pet.setFood("Pizza");
+
+ assertThat(pet.getId(), is(equalTo(id)));
+ assertThat(pet.getName(), is(equalTo(name)));
+ assertThat(pet.getFood(), is(equalTo("Pizza")));
+ assertThat(pet.getId_person(), is(equalTo(id_person)));
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testSetNullFood() {
+ final Pet pet = new Pet(1, "John", "Maiz",7);
+
+ pet.setFood(null);
+ }
+
+ @Test
+ public void testEqualsObject() {
+ final Pet petA = new Pet(1, "Name A", "Food A",7);
+ final Pet petB = new Pet(1, "Name B", "Food B",7);
+
+ assertTrue(petA.equals(petB));
+ }
+
+ @Test
+ public void testEqualsHashcode() {
+ EqualsVerifier.forClass(Pet.class)
+ .withIgnoredFields("name", "food","id_person")
+ .suppress(Warning.STRICT_INHERITANCE)
+ .suppress(Warning.NONFINAL_FIELDS)
+ .verify();
+ }
+}
diff --git a/src/test/java/es/uvigo/esei/daa/filters/AuthorizationFilter.java b/src/test/java/es/uvigo/esei/daa/filters/AuthorizationFilter.java
index 40400f7..1e134bc 100644
--- a/src/test/java/es/uvigo/esei/daa/filters/AuthorizationFilter.java
+++ b/src/test/java/es/uvigo/esei/daa/filters/AuthorizationFilter.java
@@ -31,7 +31,7 @@ import es.uvigo.esei.daa.entities.User;
@Priority(Priorities.AUTHENTICATION)
public class AuthorizationFilter implements ContainerRequestFilter {
// Add here the list of REST paths that an administrator can access.
- private final static List ADMIN_PATHS = Arrays.asList("people");
+ private final static List ADMIN_PATHS = Arrays.asList("people", "pets");
private final UsersDAO dao;
diff --git a/src/test/java/es/uvigo/esei/daa/matchers/IsEqualToPet.java b/src/test/java/es/uvigo/esei/daa/matchers/IsEqualToPet.java
new file mode 100644
index 0000000..28de719
--- /dev/null
+++ b/src/test/java/es/uvigo/esei/daa/matchers/IsEqualToPet.java
@@ -0,0 +1,59 @@
+package es.uvigo.esei.daa.matchers;
+
+import org.hamcrest.Factory;
+import org.hamcrest.Matcher;
+
+import es.uvigo.esei.daa.entities.Person;
+import es.uvigo.esei.daa.entities.Pet;
+
+public class IsEqualToPet extends IsEqualToEntity {
+ public IsEqualToPet(Pet entity) {
+ super(entity);
+ }
+
+ @Override
+ protected boolean matchesSafely(Pet actual) {
+ this.clearDescribeTo();
+
+ if (actual == null) {
+ this.addTemplatedDescription("actual", expected.toString());
+ return false;
+ } else {
+ return checkAttribute("id", Pet::getId, actual)
+ && checkAttribute("name", Pet::getName, actual)
+ && checkAttribute("food", Pet::getFood, actual)
+ && checkAttribute("id_person", Pet::getId_person, actual);
+ }
+ }
+
+ /**
+ * Factory method that creates a new {@link IsEqualToEntity} matcher with
+ * the provided {@link Person} as the expected value.
+ *
+ * @param pet the expected pet.
+ * @return a new {@link IsEqualToEntity} matcher with the provided
+ * {@link Person} as the expected value.
+ */
+ @Factory
+ public static IsEqualToPet equalsToPet(Pet pet) {
+ return new IsEqualToPet(pet);
+ }
+
+ /**
+ * Factory method that returns a new {@link Matcher} that includes several
+ * {@link IsEqualToPet} matchers, each one using an {@link Person} of the
+ * provided ones as the expected value.
+ *
+ * @param pets the pets to be used as the expected values.
+ * @return a new {@link Matcher} that includes several
+ * {@link IsEqualToPet} matchers, each one using an {@link Pet} of the
+ * provided ones as the expected value.
+ * @see IsEqualToEntity#containsEntityInAnyOrder(java.util.function.Function, Object...)
+ */
+ @Factory
+ public static Matcher> containsPetsInAnyOrder(Pet ... petos) {
+ return containsEntityInAnyOrder(IsEqualToPet::equalsToPet, petos);
+ }
+
+
+}
diff --git a/src/test/java/es/uvigo/esei/daa/rest/PetsResourceTest.java b/src/test/java/es/uvigo/esei/daa/rest/PetsResourceTest.java
new file mode 100644
index 0000000..455f316
--- /dev/null
+++ b/src/test/java/es/uvigo/esei/daa/rest/PetsResourceTest.java
@@ -0,0 +1,319 @@
+package es.uvigo.esei.daa.rest;
+
+import static es.uvigo.esei.daa.dataset.PeopleDataset.nonExistentId;
+import static es.uvigo.esei.daa.dataset.PetsDataset.existentId;
+import static es.uvigo.esei.daa.dataset.PetsDataset.existentPet;
+import static es.uvigo.esei.daa.dataset.PetsDataset.newFood;
+import static es.uvigo.esei.daa.dataset.PetsDataset.newIdPerson;
+import static es.uvigo.esei.daa.dataset.PetsDataset.newName;
+import static es.uvigo.esei.daa.dataset.PetsDataset.newPet;
+import static es.uvigo.esei.daa.dataset.PetsDataset.petsOfOwner;
+import static es.uvigo.esei.daa.dataset.UsersDataset.adminLogin;
+import static es.uvigo.esei.daa.dataset.UsersDataset.normalLogin;
+import static es.uvigo.esei.daa.dataset.UsersDataset.userToken;
+import static es.uvigo.esei.daa.matchers.HasHttpStatus.hasBadRequestStatus;
+import static es.uvigo.esei.daa.matchers.HasHttpStatus.hasOkStatus;
+import static es.uvigo.esei.daa.matchers.HasHttpStatus.hasUnauthorized;
+import static es.uvigo.esei.daa.matchers.IsEqualToPet.containsPetsInAnyOrder;
+import static es.uvigo.esei.daa.matchers.IsEqualToPet.equalsToPet;
+import static javax.ws.rs.client.Entity.entity;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.sql.DataSource;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestExecutionListeners;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+import com.github.springtestdbunit.DbUnitTestExecutionListener;
+import com.github.springtestdbunit.annotation.DatabaseSetup;
+import com.github.springtestdbunit.annotation.ExpectedDatabase;
+
+import es.uvigo.esei.daa.DAAExampleTestApplication;
+import es.uvigo.esei.daa.entities.Pet;
+import es.uvigo.esei.daa.listeners.ApplicationContextBinding;
+import es.uvigo.esei.daa.listeners.ApplicationContextJndiBindingTestExecutionListener;
+import es.uvigo.esei.daa.listeners.DbManagement;
+import es.uvigo.esei.daa.listeners.DbManagementTestExecutionListener;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:contexts/mem-context.xml")
+@TestExecutionListeners({
+ DbUnitTestExecutionListener.class,
+ DbManagementTestExecutionListener.class,
+ ApplicationContextJndiBindingTestExecutionListener.class
+})
+@ApplicationContextBinding(
+ jndiUrl = "java:/comp/env/jdbc/daaexample",
+ type = DataSource.class
+)
+@DbManagement(
+ create = "classpath:db/hsqldb.sql",
+ drop = "classpath:db/hsqldb-drop.sql"
+)
+@DatabaseSetup("/datasets/dataset.xml")
+@ExpectedDatabase("/datasets/dataset.xml")
+public class PetsResourceTest extends JerseyTest {
+ @Override
+ protected Application configure() {
+ return new DAAExampleTestApplication();
+ }
+
+ @Override
+ protected void configureClient(ClientConfig config) {
+ super.configureClient(config);
+
+ // Enables JSON transformation in client
+ config.register(JacksonJsonProvider.class);
+ config.property("com.sun.jersey.api.json.POJOMappingFeature", Boolean.TRUE);
+ }
+
+ @Test
+ public void testList() throws IOException {
+ int ownerId = 1;
+
+ final Response response = target("pets")
+ .queryParam("id_person", ownerId)
+ .request()
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .get();
+ assertThat(response, hasOkStatus());
+
+ final List pets = response.readEntity(new GenericType>(){});
+
+ assertThat(pets, containsPetsInAnyOrder(petsOfOwner(ownerId)));
+ }
+
+ @Test
+ public void testListUnauthorized() throws IOException {
+ final Response response = target("pets").request()
+ .header("Authorization", "Basic " + userToken(normalLogin()))
+ .get();
+ assertThat(response, hasUnauthorized());
+ }
+
+ @Test
+ public void testGet() throws IOException {
+ final Response response = target("pets/" + existentId()).request()
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .get();
+ assertThat(response, hasOkStatus());
+
+ final Pet pet = response.readEntity(Pet.class);
+
+ assertThat(pet, is(equalsToPet(existentPet())));
+ }
+
+ @Test
+ public void testGetUnauthorized() throws IOException {
+ final Response response = target("pets/" + existentId()).request()
+ .header("Authorization", "Basic " + userToken(normalLogin()))
+ .get();
+ assertThat(response, hasUnauthorized());
+ }
+
+ @Test
+ public void testGetInvalidId() throws IOException {
+ final Response response = target("pets/" + nonExistentId()).request()
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .get();
+
+ assertThat(response, hasBadRequestStatus());
+ }
+
+ @Test
+ @ExpectedDatabase("/datasets/dataset-addPet.xml")
+ public void testAdd() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+ form.param("id_person", Integer.toString(newIdPerson()));
+
+ final Response response = target("pets").request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .post(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+ assertThat(response, hasOkStatus());
+
+ final Pet pet = response.readEntity(Pet.class);
+
+ assertThat(pet, is(equalsToPet(newPet())));
+ }
+
+ @Test
+ public void testAddUnauthorized() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+ form.param("id_person", newIdPerson()+"");
+
+ final Response response = target("pets").request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(normalLogin()))
+ .post(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasUnauthorized());
+ }
+
+ @Test
+ public void testAddMissingName() throws IOException {
+ final Form form = new Form();
+ form.param("food", newFood());
+ form.param("id_person", newIdPerson()+"");
+
+ final Response response = target("pets").request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .post(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasBadRequestStatus());
+ }
+
+ @Test
+ public void testAddMissingFood() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("id_person", newIdPerson()+"");
+
+
+ final Response response = target("pets").request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .post(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasBadRequestStatus());
+ }
+ @Test
+ public void testAddMissingIdPerson() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+
+
+ final Response response = target("pets").request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .post(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasBadRequestStatus());
+ }
+
+ @Test
+ @ExpectedDatabase("/datasets/dataset-modifyPet.xml")
+ public void testModify() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+ form.param("id_person", newIdPerson()+"");
+
+ final Response response = target("pets/" + existentId()).request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+ assertThat(response, hasOkStatus());
+
+ final Pet modifiedPet = response.readEntity(Pet.class);
+
+ final Pet pet = existentPet();
+ pet.setName(newName());
+ pet.setFood(newFood());
+
+ assertThat(modifiedPet, is(equalsToPet(pet)));
+ }
+
+ @Test
+ public void testModifyUnauthorized() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+
+ final Response response = target("pets/" + existentId()).request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(normalLogin()))
+ .put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasUnauthorized());
+ }
+
+ @Test
+ public void testModifyName() throws IOException {
+
+ final Form form = new Form();
+ form.param("name", newName());
+
+ final Response response = target("pets/" + existentId()).request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+ assertThat(response, hasBadRequestStatus());
+
+ }
+
+ @Test
+ public void testModifyFood() throws IOException {
+ final Form form = new Form();
+ form.param("food", newFood());
+
+ final Response response = target("pets/" + existentId()).request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasBadRequestStatus());
+ }
+
+ @Test
+ public void testModifyInvalidId() throws IOException {
+ final Form form = new Form();
+ form.param("name", newName());
+ form.param("food", newFood());
+ form.param("id_person", newIdPerson()+"");
+
+
+ final Response response = target("pets/" + nonExistentId()).request(MediaType.APPLICATION_JSON_TYPE)
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .put(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
+
+ assertThat(response, hasBadRequestStatus());
+ }
+
+
+ @Test
+ @ExpectedDatabase("/datasets/dataset-deletePet.xml")
+ public void testDelete() throws IOException {
+ final Response response = target("pets/" + existentId()).request()
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .delete();
+
+ assertThat(response, hasOkStatus());
+
+ final Integer deletedId = response.readEntity(Integer.class);
+
+ assertThat(deletedId, is(equalTo(existentId())));
+ }
+
+ @Test
+ public void testDeleteUnauthorized() throws IOException {
+ final Response response = target("pets/" + existentId()).request()
+ .header("Authorization", "Basic " + userToken(normalLogin()))
+ .delete();
+
+ assertThat(response, hasUnauthorized());
+ }
+
+ @Test
+ public void testDeleteInvalidId() throws IOException {
+ final Response response = target("pets/" + nonExistentId()).request()
+ .header("Authorization", "Basic " + userToken(adminLogin()))
+ .delete();
+
+ assertThat(response, hasBadRequestStatus());
+ }
+}
diff --git a/src/test/resources/datasets/dataset-add.xml b/src/test/resources/datasets/dataset-add.xml
index 9a75a99..703259b 100644
--- a/src/test/resources/datasets/dataset-add.xml
+++ b/src/test/resources/datasets/dataset-add.xml
@@ -16,4 +16,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset-addPet.xml b/src/test/resources/datasets/dataset-addPet.xml
new file mode 100644
index 0000000..167d7aa
--- /dev/null
+++ b/src/test/resources/datasets/dataset-addPet.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset-delete.xml b/src/test/resources/datasets/dataset-delete.xml
index e49223d..42b69e4 100644
--- a/src/test/resources/datasets/dataset-delete.xml
+++ b/src/test/resources/datasets/dataset-delete.xml
@@ -14,4 +14,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset-deletePet.xml b/src/test/resources/datasets/dataset-deletePet.xml
new file mode 100644
index 0000000..db3bd39
--- /dev/null
+++ b/src/test/resources/datasets/dataset-deletePet.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset-modify.xml b/src/test/resources/datasets/dataset-modify.xml
index 6e2dfc9..d5d0228 100644
--- a/src/test/resources/datasets/dataset-modify.xml
+++ b/src/test/resources/datasets/dataset-modify.xml
@@ -15,4 +15,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset-modifyPet.xml b/src/test/resources/datasets/dataset-modifyPet.xml
new file mode 100644
index 0000000..0826b58
--- /dev/null
+++ b/src/test/resources/datasets/dataset-modifyPet.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/datasets/dataset.dtd b/src/test/resources/datasets/dataset.dtd
index e64500f..0502151 100644
--- a/src/test/resources/datasets/dataset.dtd
+++ b/src/test/resources/datasets/dataset.dtd
@@ -1,7 +1,8 @@
-
+
+
+
diff --git a/src/test/resources/datasets/dataset.xml b/src/test/resources/datasets/dataset.xml
index 3f48cc9..86cf76b 100644
--- a/src/test/resources/datasets/dataset.xml
+++ b/src/test/resources/datasets/dataset.xml
@@ -15,4 +15,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/db/hsqldb-drop.sql b/src/test/resources/db/hsqldb-drop.sql
index 31f8643..edd9162 100644
--- a/src/test/resources/db/hsqldb-drop.sql
+++ b/src/test/resources/db/hsqldb-drop.sql
@@ -1,2 +1,3 @@
-DROP TABLE People IF EXISTS;
-DROP TABLE Users IF EXISTS;
+DROP TABLE pets IF EXISTS;
+DROP TABLE people IF EXISTS;
+DROP TABLE users IF EXISTS;
diff --git a/src/test/resources/db/hsqldb.sql b/src/test/resources/db/hsqldb.sql
index a629441..75a0e5d 100644
--- a/src/test/resources/db/hsqldb.sql
+++ b/src/test/resources/db/hsqldb.sql
@@ -10,4 +10,14 @@ CREATE TABLE users (
password VARCHAR(64) NOT NULL,
role VARCHAR(5) NOT NULL,
PRIMARY KEY (login)
+);
+
+CREATE TABLE pets (
+ id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL,
+ name VARCHAR(50) NOT NULL,
+ food VARCHAR(100) NOT NULL,
+ id_person int NOT NULL,
+ PRIMARY KEY (id),
+ FOREIGN KEY (id_person) REFERENCES people(id)
+
);
\ No newline at end of file
diff --git a/src/test/webapp/rest/pets/add.html b/src/test/webapp/rest/pets/add.html
new file mode 100644
index 0000000..c0f7b7d
--- /dev/null
+++ b/src/test/webapp/rest/pets/add.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+add
+
+
+
+
+add |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Xián&surname=Ximénez |
+
+
+ click |
+ link=POST |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 200 OK |
+
+
+ waitForElementPresent |
+ css=#response-body-raw > pre |
+ |
+
+
+ storeText |
+ css=#response-body-raw > pre |
+ responseBody |
+
+
+ echo |
+ ${responseBody} |
+ |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).name |
+ Xián |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).surname |
+ Ximénez |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/addNoFood.html b/src/test/webapp/rest/pets/addNoFood.html
new file mode 100644
index 0000000..ce3e867
--- /dev/null
+++ b/src/test/webapp/rest/pets/addNoFood.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+addNoFood
+
+
+
+
+addNoFood |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Xián |
+
+
+ click |
+ link=POST |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/addNoName.html b/src/test/webapp/rest/pets/addNoName.html
new file mode 100644
index 0000000..04db2e9
--- /dev/null
+++ b/src/test/webapp/rest/pets/addNoName.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+addNoName
+
+
+
+
+addNoName |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ surname=Ximénez |
+
+
+ click |
+ link=POST |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/delete.html b/src/test/webapp/rest/pets/delete.html
new file mode 100644
index 0000000..7c1a242
--- /dev/null
+++ b/src/test/webapp/rest/pets/delete.html
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+delete
+
+
+
+
+delete |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=DELETE |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/11 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 200 OK |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/deleteInvalidId.html b/src/test/webapp/rest/pets/deleteInvalidId.html
new file mode 100644
index 0000000..8d84af4
--- /dev/null
+++ b/src/test/webapp/rest/pets/deleteInvalidId.html
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+deleteInvalidId
+
+
+
+
+deleteInvalidId |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=DELETE |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/100 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/get.html b/src/test/webapp/rest/pets/get.html
new file mode 100644
index 0000000..30f59e5
--- /dev/null
+++ b/src/test/webapp/rest/pets/get.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+rest
+
+
+
+
+rest |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=GET |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 200 OK |
+
+
+ waitForElementPresent |
+ css=#response-body-raw > pre |
+ |
+
+
+ storeText |
+ css=#response-body-raw > pre |
+ responseBody |
+
+
+ echo |
+ ${responseBody} |
+ |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).length |
+ 10 |
+
+
+
+
diff --git a/src/test/webapp/rest/pets/list.html b/src/test/webapp/rest/pets/list.html
new file mode 100644
index 0000000..30f59e5
--- /dev/null
+++ b/src/test/webapp/rest/pets/list.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+rest
+
+
+
+
+rest |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=GET |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 200 OK |
+
+
+ waitForElementPresent |
+ css=#response-body-raw > pre |
+ |
+
+
+ storeText |
+ css=#response-body-raw > pre |
+ responseBody |
+
+
+ echo |
+ ${responseBody} |
+ |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).length |
+ 10 |
+
+
+
+
diff --git a/src/test/webapp/rest/pets/modify.html b/src/test/webapp/rest/pets/modify.html
new file mode 100644
index 0000000..0adc9f2
--- /dev/null
+++ b/src/test/webapp/rest/pets/modify.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+modify
+
+
+
+
+modify |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Marta&surname=Martínez |
+
+
+ click |
+ link=PUT |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/4 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 200 OK |
+
+
+ waitForElementPresent |
+ css=#response-body-raw > pre |
+ |
+
+
+ storeText |
+ css=#response-body-raw > pre |
+ responseBody |
+
+
+ echo |
+ ${responseBody} |
+ |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).name |
+ Marta |
+
+
+ assertEval |
+ JSON.parse(storedVars['responseBody']).surname |
+ Martínez |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/modifyInvalidId.html b/src/test/webapp/rest/pets/modifyInvalidId.html
new file mode 100644
index 0000000..3f9d78c
--- /dev/null
+++ b/src/test/webapp/rest/pets/modifyInvalidId.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+modifyInvalidId
+
+
+
+
+modifyInvalidId |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Marta&surname=Martínez |
+
+
+ click |
+ link=PUT |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/100 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/modifyNoFood.html b/src/test/webapp/rest/pets/modifyNoFood.html
new file mode 100644
index 0000000..1355433
--- /dev/null
+++ b/src/test/webapp/rest/pets/modifyNoFood.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+modifyNoFood
+
+
+
+
+modifyNoFood |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Marta |
+
+
+ click |
+ link=PUT |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/4 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/modifyNoId.html b/src/test/webapp/rest/pets/modifyNoId.html
new file mode 100644
index 0000000..ed0f3bb
--- /dev/null
+++ b/src/test/webapp/rest/pets/modifyNoId.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+modifyNoId
+
+
+
+
+modifyNoId |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ name=Marta&surname=Martínez |
+
+
+ click |
+ link=PUT |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 405 Method Not Allowed |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/modifyNoName.html b/src/test/webapp/rest/pets/modifyNoName.html
new file mode 100644
index 0000000..c29cf81
--- /dev/null
+++ b/src/test/webapp/rest/pets/modifyNoName.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+modifyNoName
+
+
+
+
+modifyNoName |
+
+
+ open |
+ chrome://restclient/content/restclient.html |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Cookie |
+
+
+ type |
+ name=value |
+ token=bXJqYXRvOm1yamF0bw== |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ click |
+ link=Headers |
+ |
+
+
+ click |
+ link=Custom Header |
+ |
+
+
+ type |
+ name=name |
+ Content-Type |
+
+
+ type |
+ name=value |
+ application/x-www-form-urlencoded |
+
+
+ click |
+ css=#modal-custom-header > div.modal-footer > input.btn.btn-inverse |
+ |
+
+
+ type |
+ id=request-body |
+ surname=Martínez |
+
+
+ click |
+ link=PUT |
+ |
+
+
+ type |
+ id=request-url |
+ http://localhost:9080/DAAExample/rest/people/4 |
+
+
+ click |
+ id=request-button |
+ |
+
+
+ click |
+ link=× |
+ |
+
+
+ waitForElementPresent |
+ css=span.header-value |
+ |
+
+
+ assertText |
+ css=span.header-value |
+ 400 Bad Request |
+
+
+
+
+
diff --git a/src/test/webapp/rest/pets/rest.html b/src/test/webapp/rest/pets/rest.html
new file mode 100644
index 0000000..4dd4a50
--- /dev/null
+++ b/src/test/webapp/rest/pets/rest.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Test Suite
+
+
+
+
+
diff --git a/src/test/webapp/web/pets/add.html b/src/test/webapp/web/pets/add.html
new file mode 100644
index 0000000..13d4ad6
--- /dev/null
+++ b/src/test/webapp/web/pets/add.html
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+example
+
+
+
+
+example |
+
+
+ createCookie |
+ token=bXJqYXRvOm1yamF0bw== |
+ |
+
+
+ open |
+ main.html |
+ |
+
+
+ waitForPageToLoad |
+ |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ type |
+ name=name |
+ Hola |
+
+
+ type |
+ name=surname |
+ Mundo |
+
+
+ click |
+ id=btnSubmit |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ verifyText |
+ css=tr:last-child > td.name |
+ Hola |
+
+
+ verifyText |
+ css=tr:last-child > td.surname |
+ Mundo |
+
+
+ deleteCookie |
+ token |
+ |
+
+
+
+
diff --git a/src/test/webapp/web/pets/delete.html b/src/test/webapp/web/pets/delete.html
new file mode 100644
index 0000000..d73f247
--- /dev/null
+++ b/src/test/webapp/web/pets/delete.html
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+delete
+
+
+
+
+delete |
+
+
+ createCookie |
+ token=bXJqYXRvOm1yamF0bw== |
+ |
+
+
+ open |
+ main.html |
+ |
+
+
+ waitForPageToLoad |
+ |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ storeXpathCount |
+ //tr |
+ rows |
+
+
+ click |
+ xpath=(//a[contains(text(),'Delete')])[last()] |
+ |
+
+
+ assertConfirmation |
+ Está a punto de eliminar a una persona. ¿Está seguro de que desea continuar? |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ storeXpathCount |
+ //tr |
+ rowsAfterDeletion |
+
+
+ storeEval |
+ storedVars['rows']-storedVars['rowsAfterDeletion'] |
+ rowsDeleted |
+
+
+ verifyExpression |
+ ${rowsDeleted} |
+ 1 |
+
+
+ deleteCookie |
+ token |
+ |
+
+
+
+
diff --git a/src/test/webapp/web/pets/edit.html b/src/test/webapp/web/pets/edit.html
new file mode 100644
index 0000000..30688fb
--- /dev/null
+++ b/src/test/webapp/web/pets/edit.html
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+edit
+
+
+
+
+edit |
+
+
+ createCookie |
+ token=bXJqYXRvOm1yamF0bw== |
+ |
+
+
+ open |
+ main.html |
+ |
+
+
+ waitForPageToLoad |
+ |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ click |
+ xpath=(//a[contains(text(),'Edit')])[last()] |
+ |
+
+
+ storeAttribute |
+ //tr[last()]/@id |
+ personId |
+
+
+ type |
+ name=name |
+ Ana |
+
+
+ type |
+ name=surname |
+ María |
+
+
+ click |
+ id=btnSubmit |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ verifyText |
+ //tr[@id='${personId}']/td[@class = 'name'] |
+ Ana |
+
+
+ verifyText |
+ //tr[@id='${personId}']/td[@class = 'surname'] |
+ María |
+
+
+ deleteCookie |
+ token |
+ |
+
+
+
+
+
diff --git a/src/test/webapp/web/pets/example.html b/src/test/webapp/web/pets/example.html
new file mode 100644
index 0000000..e1dbb63
--- /dev/null
+++ b/src/test/webapp/web/pets/example.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Test Suite
+
+
+
+
+
diff --git a/src/test/webapp/web/pets/list.html b/src/test/webapp/web/pets/list.html
new file mode 100644
index 0000000..a6b2ac4
--- /dev/null
+++ b/src/test/webapp/web/pets/list.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+list
+
+
+
+
+list |
+
+
+ createCookie |
+ token=bXJqYXRvOm1yamF0bw== |
+ |
+
+
+ open |
+ main.html |
+ |
+
+
+ waitForPageToLoad |
+ |
+ |
+
+
+ waitForCondition |
+ selenium.browserbot.getCurrentWindow().jQuery.active == 0 |
+ 1000 |
+
+
+ verifyXpathCount |
+ //tr |
+ 11 |
+
+
+ deleteCookie |
+ token |
+ |
+
+
+
+
--
2.18.1
|