Examples of withJsonBody()


Examples of play.test.FakeRequest.withJsonBody()

          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);

          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
         
          assertRoute(result, "routeCreateUser check username", Status.CREATED, "name\":\""+sFakeUser+"\"", true);
          assertRoute(result, "routeCreateUser check role", Status.CREATED, "roles\":[{\"name\":\"registered\"}", true);
         
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

          //this MUST not raise an error
          ((ObjectNode) node).put(dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER,(JsonNode)null);
          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
         
          assertRoute(result, "routeCreateUser_issue_401", Status.BAD_REQUEST, "One or more profile sections is not a valid JSON object", true);
        }
      }
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);

          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
          assertRoute(result, "routeCreateUserCaseInsensitive", Status.CREATED, null, false);
          // try to create the second one
          node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser2);
          request = new FakeRequest(getMethod(), getRouteAddress());
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

          assertRoute(result, "routeCreateUserCaseInsensitive", Status.CREATED, null, false);
          // try to create the second one
          node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser2);
          request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          result = routeAndCall(request);
          //it should be fail
          assertRoute(result, "routeCreateUserCaseInsensitive", Status.BAD_REQUEST, sFakeUser2 + " already exists", true);
         
        }
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);

          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
         
          assertRoute(result, "routeCreateUser_2", Status.CREATED, null, false);
          String body = play.test.Helpers.contentAsString(result);
          JsonNode jsonRes = Json.parse(body);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                        ObjectMapper mapper = new ObjectMapper();
                                        JsonNode actualObj = mapper.readTree("{\"username\":\""+userName+"\","
                                            + "\"password\":\"test\"," 
                                            + "\"role\":\""+ roleName +"\"}");
                                        requestCreation = requestCreation.withJsonBody(actualObj);
                                        requestCreation = requestCreation.withHeader("Content-Type", "application/json");
                                        result = route(requestCreation);
                                        assertRoute(result, "testRoleCreate.createUser", Status.CREATED, null, true);
                                      
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

                                        requestCreation = new FakeRequest(POST, sFakeRole);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                        mapper = new ObjectMapper();
                                        actualObj = mapper.readTree("{\"description\":\"this is a test\"}")
                                        requestCreation = requestCreation.withJsonBody(actualObj);
                                        requestCreation = requestCreation.withHeader("Content-Type", "application/json");
                                        result = route(requestCreation);
                                        assertRoute(result, "testRoleCreate.create_the_same", Status.CREATED, null, true);
                                    //checks the role
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

                                     requestCreation = new FakeRequest(PUT, sFakeRole);
                                         requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                         requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                         mapper = new ObjectMapper();
                                         actualObj = mapper.readTree("{\"description\":\"this is new test\"}")
                                         requestCreation = requestCreation.withJsonBody(actualObj,PUT);
                                         result = route(requestCreation);
                                         assertRoute(result, "testRoleCreate.update_desc", Status.OK, null, true);
                                        
                                                                            
                                    //checks the role
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                        ObjectMapper mapper = new ObjectMapper();
                                        JsonNode actualObj = mapper.readTree("{\"username\":\""+userName+"\","
                                            + "\"password\":\"test\"," 
                                            + "\"role\":\""+ roleName +"\"}");
                                        requestCreation = requestCreation.withJsonBody(actualObj);
                                        requestCreation = requestCreation.withHeader("Content-Type", "application/json");
                                        result = route(requestCreation);
                                        assertRoute(result, "testRoleCreate.createUser", Status.CREATED, null, true);

                                     //checks the user
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

                                         requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                         mapper = new ObjectMapper();
                                         actualObj = mapper.readTree("{\"username\":\""+sFakeRegUser+"\","
                                             + "\"password\":\"test\"," 
                                             + "\"role\":\"registered\"}");
                                         requestCreation = requestCreation.withJsonBody(actualObj);
                                         requestCreation = requestCreation.withHeader("Content-Type", "application/json");
                                         result = route(requestCreation);
                                         assertRoute(result, "testRoleCreate.createRegUser", Status.CREATED, null, true);
                                   
                                         requestCreation = new FakeRequest(GET, "/document/"+sFakeCollection + "/" + sUUID);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.