コード例 #1
0
 @After
 public void tearDownHelper() throws IOException {
   if (closeable != null) {
     closeable.close(); // Objectify
   }
   helper.tearDown();
 }
コード例 #2
0
 @Test
 public void noGreenlist() throws Exception {
   helper.setEnvEmail(BAD_USER).setUp();
   assertFalse(isGreenlistActive());
   FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN);
   assertTrue(SC_UNAUTHORIZED != RESPONSE.getStatus());
 }
コード例 #3
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   helper.setUp();
   taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue();
   StubMapper.fakeSetUp();
 }
コード例 #4
0
  @Before
  public void setupSignGuestBookServlet() {
    helper.setUp();
    OfyHelper.register(); // Needed for Objectify
    closeable = ObjectifyService.begin(); // Objectify

    signGuestbookServlet = new SignGuestbookServlet();
  }
コード例 #5
0
  @Test
  public void inGreenlist() throws Exception {
    helper.setEnvEmail(GOOD_USER).setUp();
    setupGreenlist();

    FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN);
    assertTrue(SC_UNAUTHORIZED != RESPONSE.getStatus());
  }
コード例 #6
0
  @Test
  public void notLoggedIn() throws Exception {
    helper.setEnvIsLoggedIn(false).setUp();
    setupGreenlist();

    FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN);
    assertTrue(SC_UNAUTHORIZED == RESPONSE.getStatus());
  }
コード例 #7
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    // Sets up the UserServiceFactory used in SignGuestbookServlet (but not in this test)
    helper.setUp();

    signGuestbookServlet = new SignGuestbookServlet();
    TestUtils.startDatastore();
  }
コード例 #8
0
  @BeforeClass
  public static void setUpClass() throws Exception {
    helper.setUp();
    ThreadLocalEntityManager.initialize();

    // Factoría y servicios con back-end simulado
    factory = RequestFactoryHelper.create(SocialwindRequestFactory.class);
    service = RequestFactoryHelper.getService(SurferRequest.class);
  }
コード例 #9
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    helper.setUp();

    // Set up a fake HTTP response.
    responseWriter = new StringWriter();
    when(mockResponse.getWriter()).thenReturn(new PrintWriter(responseWriter));

    servletUnderTest = new GeoServlet();
  }
コード例 #10
0
  @Before
  public void setUp() throws Exception {
    HashMap<String, Object> envAttr = new HashMap<String, Object>();
    envAttr.put("com.google.appengine.api.users.UserService.user_id_key", "10");
    helper =
        new LocalServiceTestHelper(
            new LocalUserServiceTestConfig(),
            new LocalMemcacheServiceTestConfig(),
            new LocalDatastoreServiceTestConfig());
    helper.setEnvEmail(GOOD_USER);
    helper.setEnvIsLoggedIn(true);
    helper.setEnvAuthDomain("addama.org");
    helper.setEnvAttributes(envAttr);
    helper.setUp();

    FILTER = new GreenlistFilter();
    REQUEST = new MockHttpServletRequest();
    RESPONSE = new MockHttpServletResponse();
    FILTER_CHAIN = new MockFilterChain();
  }
コード例 #11
0
ファイル: GeoDaoTest.java プロジェクト: nathanpp/mardao
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    LOG.info("=== setUp() " + getName() + " ===");
    helper.setUp();

    final GeneratedDEmployeeDaoImpl employeeImpl = new GeneratedDEmployeeDaoImpl();
    employeeImpl.setManagerDao(employeeImpl);
    this.employeeDao = employeeImpl;

    populate();
    LOG.info("--- setUp() " + getName() + " ---");
    System.out.println("--- setUp() " + getName() + " ---");
  }
コード例 #12
0
  /** @throws java.lang.Exception */
  @Before
  public void setUp() throws Exception {
    helper.setUp();
    DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
    date = dateFormat.parse("08/25/2015");

    highlights = new ArrayList<>();
    highlights.add("Highlight1");
    highlights.add("Highlight2");
    highlights.add("Highlight3");

    sessionForm =
        new SessionForm(NAME, highlights, SPEAKER, DURATION, TYPE_OF_SESSION, date, START_TIME);
  }
コード例 #13
0
  @Before
  public void setUp() {
    datastoreHelper.setUp();
    ObjectifyFilter.complete();

    Client.create(client);
    sgp = Group.create(client, "Singapore", User.SUPER_USER);
    assertEquals(1, sgp.groupId);

    kl = Group.create(client, "KL", User.SUPER_USER);
    assertEquals(2, kl.groupId);

    validUser = User.create(client, "*****@*****.**", sgp.groupId, User.SUPER_USER);

    userWithSendMailPermissionForSgp =
        User.create(client, "*****@*****.**", sgp.groupId, User.SUPER_USER);
    User.addGroupLevelPrivilege(
        client,
        sgp.groupId,
        userWithSendMailPermissionForSgp.email,
        GroupLevelPrivilege.SEND_EMAIL,
        User.SUPER_USER);

    sgpTeachers = List.createRestricted(client, sgp.groupId, "Sgp Teachers", null, User.SUPER_USER);

    ContactProp c = new ContactProp();
    c.email = "*****@*****.**";
    c.asOfyyyymmdd = 20141026;
    c.firstName = "Sathya";
    sathya = Member.create(client, sgp.groupId, c, false, User.SUPER_USER);

    c.firstName = "Sharmila";
    c.mobilePhone = "+6593849384";
    c.email = null;
    sharmila = Member.create(client, sgp.groupId, c, false, User.SUPER_USER);
    assertEquals("Sharmila", sharmila.contact.firstName);

    c.email = "*****@*****.**";
    murugavel = Member.create(client, sgp.groupId, c, false, User.SUPER_USER);
    assertEquals("*****@*****.**", murugavel.contact.email);

    // add sathya and sharmila to sgpTeachers
    Member.addOrDeleteList(client, sathya.memberId, sgpTeachers.listId, true, User.SUPER_USER);
    Member.addOrDeleteList(client, sharmila.memberId, sgpTeachers.listId, true, User.SUPER_USER);
    Member.subscribeGroup(client, sathya.memberId, sgp.groupId, User.SUPER_USER);
    Member.subscribeGroup(client, sharmila.memberId, sgp.groupId, User.SUPER_USER);

    ObjectifyFilter.complete();
  }
コード例 #14
0
  @Override
  public void setUp() {
    try {
      helper.setUp();

      ModelFactory.setInstance(new ServerModelFactory());

      try {
        ObjectifyService.register(UserImpl.class);
        ObjectifyService.register(InterestImpl.class);
        ObjectifyService.register(C2DMConfig.class);
      } catch (IllegalArgumentException e) {
      }

      /*
       * Viene utilizzato Jetty v7.5.4 come Servlet Container
       * http://www.eclipse.org/jetty/
       */
      server = new Server(0);
      ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
      context.setContextPath("/");
      server.setHandler(context);
      context.addFilter(new FilterHolder(new FilterForTesting()), "/*", 0);
      context.addFilter(new FilterHolder(new ServletFilter()), "/*", 0);
      context.addServlet(new ServletHolder(new MockServlet()), "/*");

      server.start();
      port = server.getConnectors()[0].getLocalPort();

      // User utilizzato col solo scopo di ottenere un X-AccessToken valido per effettuare le
      // richieste
      UserImpl user1 =
          (UserImpl) ModelFactory.getInstance().createUser(12345, "Michele Piccirillo", null);
      fbAccessToken = "accessToken";
      user1.setAuthToken(fbAccessToken);
      ObjectifyService.begin().put(user1);

      Thread.sleep(
          15); // Ulizzato per assicurare che il tempo necessario per la persistenza sul Datatore
               // sia passato

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #15
0
 @After
 public void tearDownHelper() {
   helper.tearDown();
 }
コード例 #16
0
 @Before
 public void setUp() {
   helper.setUp();
 }
コード例 #17
0
 @Before
 public void setupGuestBookServlet() {
   helper.setUp();
   guestbookServlet = new GuestbookServlet();
 }
コード例 #18
0
 @Before
 public void setUp() throws Exception {
   helper.setUp();
   user = new User(EMAIL, "gmail.com", USER_ID);
   conferenceApi = new ConferenceApi();
 }
コード例 #19
0
 @After
 public void tearDown() throws Exception {
   ofy().clear();
   helper.tearDown();
 }
コード例 #20
0
ファイル: TestAuthenticatorImpl.java プロジェクト: CRBS/cws
 @Before
 public void setUp() {
   _helper.setUp();
   ofy().clear();
 }
コード例 #21
0
ファイル: TestAuthenticatorImpl.java プロジェクト: CRBS/cws
 @After
 public void tearDown() {
   _helper.tearDown();
 }
コード例 #22
0
 @Override
 public void tearDown() throws Exception {
   helper.tearDown();
   super.tearDown();
 }
コード例 #23
0
 @Before
 public void setUp() {
   testHelper.setUp();
   alunoRepository =
       new AlunoRepositoryDatastoreImpl(DatastoreServiceFactory.getDatastoreService());
 }
コード例 #24
0
 @After
 public void tearDown() {
   testHelper.tearDown();
 }
コード例 #25
0
 @Override
 protected void tearDown() throws Exception {
   helper.tearDown();
   server.stop();
 }
コード例 #26
0
 @Before
 public void setUp() {
   datastoreHelper.setUp();
   ObjectifyFilter.complete();
 }
コード例 #27
0
 @After
 public void tearDown() {
   ObjectifyFilter.complete();
   datastoreHelper.tearDown();
 }
 @Override
 @Before
 public void setUp() throws Exception {
   helper.setUp();
 }
コード例 #29
0
 /** @throws java.lang.Exception */
 @After
 public void tearDown() throws Exception {
   helper.tearDown();
 }
 @Override
 @After
 public void tearDown() {
   helper.tearDown();
 }