\
@@ -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 0000000000000000000000000000000000000000..55f700d4611ae8d2b7fa9850d16996524113ecce
--- /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 0000000000000000000000000000000000000000..62a5a427cc8a6d63bd90945644cc8d3b0494a7f4
--- /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 40400f7a873791dddbcb3f6e0b18dad524f1f7cf..1e134bcfad93683a4964a021dc9c152a8a5efb44 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 0000000000000000000000000000000000000000..28de719169384b5b2d64e5361370246e2674f755
--- /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 0000000000000000000000000000000000000000..455f3162e482295968e61e35ce943de2731eb4d9
--- /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 9a75a999a98510f7d6d32992877e71772e8f536c..703259b422effc18afbeaa90a09fc34bbb29c104 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 0000000000000000000000000000000000000000..167d7aa73c20a771074efe03d47596a805f7a82e
--- /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 e49223db335c0f49f7d78cdcb3f27e80e14d30da..42b69e450286d8377f87a91422f4be2118561779 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 0000000000000000000000000000000000000000..db3bd398a5661b039d7af976dc91d7f8456615a1
--- /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 6e2dfc903798c9e26431fbaf42bea176a05fc59c..d5d0228c011bd0e8a3e046439235556cd8764ab8 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 0000000000000000000000000000000000000000..0826b5878e18cea2a5ceae9ef003252ec6496e74
--- /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 e64500f9760310832c4352657d6b41454a653582..0502151363ca8bae56be0ce77e4fa8675a5b0640 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 3f48cc9b6888070b9fb5b4c42bee31f8eae267b6..86cf76bf5f369b6efd64c6d2c1600099f89b4510 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 31f86431b16948308e44087e73b488fc3043628a..edd91623abbf5bd06fffe2141a726398abeb308b 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 a62944149d65c732b38a85ca9455f804265fd185..75a0e5d8936f463045d9ed11bc34522210bfe057 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 0000000000000000000000000000000000000000..c0f7b7df36c086b33d5cd3d060db6152f17887ba
--- /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 0000000000000000000000000000000000000000..ce3e867445c6a0de06546345b2df0874e2c3a876
--- /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 0000000000000000000000000000000000000000..04db2e9b02a105d248647e90b47ee2941f1e00ed
--- /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 0000000000000000000000000000000000000000..7c1a242b86336b296ec9932772a4709c89b561ea
--- /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 0000000000000000000000000000000000000000..8d84af44137d53cb60eede774fbc650abf35c1f6
--- /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 0000000000000000000000000000000000000000..30f59e5d9748fa97f4c955125f54d0fda99a2d68
--- /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 0000000000000000000000000000000000000000..30f59e5d9748fa97f4c955125f54d0fda99a2d68
--- /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 0000000000000000000000000000000000000000..0adc9f2a68a806af53478c1e425f7814d7812497
--- /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 0000000000000000000000000000000000000000..3f9d78c28d04964bce35fde1623916c4c1f3655a
--- /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 0000000000000000000000000000000000000000..135543357b8f953bd18ab3e35e7aa38552b19103
--- /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 0000000000000000000000000000000000000000..ed0f3bbb0db98543dd3aae94f5d4100f4ac612ec
--- /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 0000000000000000000000000000000000000000..c29cf81617684baf34bd828194075ec07260d55e
--- /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 0000000000000000000000000000000000000000..4dd4a50ba84da579259318519e76ea9673e32f56
--- /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 0000000000000000000000000000000000000000..13d4ad63479307e6b37542ee2678fa1c2bdb7bde
--- /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 0000000000000000000000000000000000000000..d73f24795fac92ee915f93ccebc5e7a240d04a60
--- /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 0000000000000000000000000000000000000000..30688fbe039ee31600c88882d8d086abbfcd0e9c
--- /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 0000000000000000000000000000000000000000..e1dbb63c7c06f84fb2fdef1066c88da329189bdd
--- /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 0000000000000000000000000000000000000000..a6b2ac41a9d402ec5e8a93d8b40242ce5c6b073b
--- /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
+
+
+
+
+