Package models

Examples of models.Person


        }
        renderText(p.x + "|" + p.y);
    }

    public static void signin(@As("secure") Person person) {
        Person verifyPerson = get();
        flash.clear();
        if (verifyPerson.userName.equals(person.userName) && verifyPerson.password.equals(person.password)) {
           flash.success("Authentication successful!");
        } else {
           flash.error("Authentication failed!");
View Full Code Here


        }
        render("/DataBinding/signinPage.html", person);
    }

    static Person get() {
        Person person = new Person();
        person.userName = "nicolas";
        person.password = "nicolas";
        return person;
    }
View Full Code Here

  Fixtures.deleteAllModels();
  Fixtures.loadModels("pc.yml");
 
  Parent father = Parent.find("byName", "parent").first();
  Parent mother = Parent.find("byName", "mother").first();
  Person tutor = Person.find("byUserName", "tutor").first();
  Person newTutor = Person.find("byUserName", "new_tutor").first();
  Child child = Child.find("byName", "child_2").first();
 
  assertNotNull(father);
  assertNotNull(mother);
  assertNotNull(child);
  assertNotNull(tutor);
 
  assertEquals(father, child.father);
  assertEquals(mother, child.mother);
  assertEquals(tutor, child.tutor);
 
 
  Map<String, String> params = new HashMap<String, String>();
  params.put("child.id", child.id.toString());
  params.put("child.father.code", mother.code);
  params.put("child.mother.code", father.code);
  params.put("child.tutor.id", newTutor.getId().toString());
        Response response = POST(Router.reverse("DataBinding.saveChild").url, params);
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"mother\", \"mother\":\"parent\", \"tutor\":\"new_tutor\"}", response);
       
        params.clear();
  params.put("child.id", child.id.toString());
  params.put("child.father", mother.code);
  params.put("child.mother", father.code);
  params.put("child.tutor", newTutor.getId().toString());
        response = POST(Router.reverse("DataBinding.saveChild").url, params);
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"null\", \"mother\":\"null\", \"tutor\":\"null\"}", response);
    }
View Full Code Here

  Fixtures.deleteAllModels();
  Fixtures.loadModels("pc.yml");
 
  Parent father = Parent.find("byName", "parent").first();
  Parent mother = Parent.find("byName", "mother").first();
  Person tutor = Person.find("byUserName", "tutor").first();
  Person newTutor = Person.find("byUserName", "new_tutor").first();
  Child child = Child.find("byName", "child_2").first();
 
  assertNotNull(father);
  assertNotNull(mother);
  assertNotNull(child);
  assertNotNull(tutor);
 
  assertEquals(father, child.father);
  assertEquals(mother, child.mother);
  assertEquals(tutor, child.tutor);
 
 
  Map<String, String> params = new HashMap<String, String>();
  params.put("child.id", child.id.toString());
  params.put("child.father.code", mother.code);
  params.put("child.mother.code", father.code)
  params.put("child.tutor.id", newTutor.getId().toString());
        Response response = POST(Router.reverse("DataBinding.saveChild").url, params);
     
        assertContentEquals("{\"name\":\"child_2\", \"father\":\"mother\", \"mother\":\"parent\", \"tutor\":\"new_tutor\"}", response);
       
        response = POST(Router.reverse("DataBinding.saveChildAsSecure").url, params);
View Full Code Here

        }
        renderText(p.x + "|" + p.y);
    }

    public static void signin(@As("secure") Person person) {
        Person verifyPerson = get();
        flash.clear();
        if (verifyPerson.userName.equals(person.userName) && verifyPerson.password.equals(person.password)) {
           flash.success("Authentication successful!");
        } else {
           flash.error("Authentication failed!");
View Full Code Here

        }
        render("/DataBinding/signinPage.html", person);
    }

    static Person get() {
        Person person = new Person();
        person.userName = "nicolas";
        person.password = "nicolas";
        return person;
    }
View Full Code Here

  @Test
  public void collectionAsContent() {
    List<Person> peopleRenderArg = get("/renderargs/people").getRenderArg("people");
    assertThat(peopleRenderArg).hasSize(3);
    assertThat(peopleRenderArg).containsExactly(new Person("Alex"), new Person("Ben"), new Person("Caroline"));
  }
View Full Code Here

    assertThat(peopleRenderArg).containsExactly(new Person("Alex"), new Person("Ben"), new Person("Caroline"));
  }

  @Test
  public void hasRenderArgValue() {
    List<Person> expected = newArrayList(new Person("Alex"), new Person("Ben"), new Person("Caroline"));
    assertThat(get("/renderargs/people")).hasRenderArgValue("people", expected);
  }
View Full Code Here

    }


    @Test
    public void validShouldBeValid() {
        Object invalidPerson = new Person(null, null);
        assertThat("validPerson").withValue(invalidPerson).hasValidationError(VALID);
        assertThat("validPerson").withValue(invalidPerson).hasValidationError("validation.object");
    }
View Full Code Here

    private class ValidModelBuilder extends Builder<ValidModel> {
        @Override
        public ValidModel build() {
            ValidModel model = new ValidModel();
            model.validPerson = new Person("Ben");
            return model;
        }
View Full Code Here

TOP

Related Classes of models.Person

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.