Package teammates

Examples of teammates.TeammatesServlet


        resp.getWriter();
        result = new PrintWriter("test.txt");
      }
    };

    TeammatesServlet ts = new TeammatesServlet();
    ts.doPost(req, resp);
    ts.getResponse().getWriter().flush();
    assertTrue(FileUtils.readFileToString(new File("test.txt"), "UTF-8").contains("<status>course added</status>"));
  }
View Full Code Here


        resp.getWriter();
        result = new PrintWriter("test.txt");
      }
    };

    TeammatesServlet ts = new TeammatesServlet();
    ts.doPost(req, resp);
    ts.getResponse().getWriter().flush();
    assertTrue(FileUtils.readFileToString(new File("test.txt"), "UTF-8").contains("<status>course exists</status>"));
  }
View Full Code Here

  //Test coordinatorDeleteCourse(courseID) function in TeammatesServlet.java
  @Test
  public void testTeammatesServletDeleteCourse() {
    setupTestData();
   
    TeammatesServlet ts = new TeammatesServlet();
    String response;
   
    //normal delete
    response = ts.coordinatorDeleteCourse(COURSE_ID);
    assertEquals(RESPONSE_DELETED, response);
   
    //course not exists
    response = ts.coordinatorDeleteCourse("unknown courseID");
    assertEquals(RESPONSE_NOT_DELETED, response);
   
  }
View Full Code Here

    }
  }
 
  //Test coordinatorGetCourseList(googleID) function in TeammatesServlet.java
  public void testTeammatesServletCoordGetCourseList() throws IOException, ServletException {
    TeammatesServlet ts = new TeammatesServlet();
    String result = ts.coordinatorGetCourseList("teammates.coord");
    String expected =
        "<courses>" +
        "<coursesummary>" +
          "<courseid><![CDATA[CS1101]]></courseid>" +
          "<coursename><![CDATA[Programming Methodology]]></coursename>" +
View Full Code Here

   * @throws ServletException
   */
  @Test
  public void testTeammatesServletAddCourseSuccessful() throws IOException, ServletException {
    Datastore.initialize();
    TeammatesServlet ts = new TeammatesServlet();
    String response;
   
    //normal course
    response = ts.coordinatorAddCourse(COURSE_ID, COURSE_NAME, GOOGLE_ID);
    assertEquals(RESPONSE_ADDED, response);

    //duplicate id
    response = ts.coordinatorAddCourse(COURSE_ID, COURSE_NAME, GOOGLE_ID);
    assertEquals(RESPONSE_EXISTS, response);
   
    //different id
    response = ts.coordinatorAddCourse("id1010", COURSE_NAME, GOOGLE_ID);
    assertEquals(RESPONSE_ADDED, response);
   
    //different name
    response = ts.coordinatorAddCourse(COURSE_ID, "different name", GOOGLE_ID);
    assertEquals(RESPONSE_EXISTS, response);
   
    //different coordinator
    response = ts.coordinatorAddCourse(COURSE_ID, COURSE_NAME, "different coordinator");
    assertEquals(RESPONSE_EXISTS, response);
  }
View Full Code Here

   * @throws IOException
   * @throws ServletException
   */
  @Test
  public void testCourseIDCaseSensitivity() throws IOException, ServletException {
    TeammatesServlet ts = new TeammatesServlet();
    String response;
    String COURSE_ID_LOWER = "cs1101";
    String COURSE_ID_UPPER = "CS1101";
   
    response = ts.coordinatorAddCourse(COURSE_ID_LOWER, COURSE_NAME, GOOGLE_ID);
    assertEquals(RESPONSE_ADDED, response);
   
    response = ts.coordinatorAddCourse(COURSE_ID_LOWER, "sensitive course", GOOGLE_ID);
    assertEquals(RESPONSE_EXISTS, response);
   
    //TODO: change to insensitive
    response = ts.coordinatorAddCourse(COURSE_ID_UPPER, COURSE_NAME, GOOGLE_ID);
//    assertEquals(RESPONSE_EXISTS, response);
   
    //TODO: change to insensitive
    response = ts.coordinatorAddCourse(COURSE_ID_UPPER, "sensitive course", GOOGLE_ID);
//    assertEquals(RESPONSE_EXISTS, response);
  }
View Full Code Here

   * @rule compulsory field
   * @throws Exception
   */
  @Test
  public void testAddCourseWithEmptyIDFailed() throws Exception {
    TeammatesServlet ts = new TeammatesServlet();
    ts.coordinatorAddCourse("", COURSE_NAME, GOOGLE_ID);
  }
View Full Code Here

   * @rule compulsory field
   * @throws Exception
   */
  @Test
  public void testAddCourseWithEmptyNameFailed() throws Exception {
    TeammatesServlet ts = new TeammatesServlet();
    assertEquals(RESPONSE_INVALID, ts.coordinatorAddCourse(COURSE_ID, "", GOOGLE_ID));
  }
View Full Code Here

   * @rule size <= 21
   * @throws Exception
   */
  @Test
  public void testAddCourseWithLongIDFailed() throws Exception {
    TeammatesServlet ts = new TeammatesServlet();
    assertEquals(RESPONSE_INVALID, ts.coordinatorAddCourse("LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG", COURSE_NAME, GOOGLE_ID));
  }
View Full Code Here

   * @rule size <= 38
   * @throws Exception
   */
  @Test
  public void testAddCourseWithLongNameFailed() throws Exception {
    TeammatesServlet ts = new TeammatesServlet();
    assertEquals(RESPONSE_INVALID, ts.coordinatorAddCourse(COURSE_ID, "LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG LONG", GOOGLE_ID));
  }
View Full Code Here

TOP

Related Classes of teammates.TeammatesServlet

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.