@After public void tearDownHelper() throws IOException { if (closeable != null) { closeable.close(); // Objectify } helper.tearDown(); }
@Test public void noGreenlist() throws Exception { helper.setEnvEmail(BAD_USER).setUp(); assertFalse(isGreenlistActive()); FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN); assertTrue(SC_UNAUTHORIZED != RESPONSE.getStatus()); }
@Override protected void setUp() throws Exception { super.setUp(); helper.setUp(); taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue(); StubMapper.fakeSetUp(); }
@Before public void setupSignGuestBookServlet() { helper.setUp(); OfyHelper.register(); // Needed for Objectify closeable = ObjectifyService.begin(); // Objectify signGuestbookServlet = new SignGuestbookServlet(); }
@Test public void inGreenlist() throws Exception { helper.setEnvEmail(GOOD_USER).setUp(); setupGreenlist(); FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN); assertTrue(SC_UNAUTHORIZED != RESPONSE.getStatus()); }
@Test public void notLoggedIn() throws Exception { helper.setEnvIsLoggedIn(false).setUp(); setupGreenlist(); FILTER.doFilter(REQUEST, RESPONSE, FILTER_CHAIN); assertTrue(SC_UNAUTHORIZED == RESPONSE.getStatus()); }
@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(); }
@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); }
@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(); }
@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(); }
@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() + " ---"); }
/** @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); }
@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(); }
@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(); } }
@After public void tearDownHelper() { helper.tearDown(); }
@Before public void setUp() { helper.setUp(); }
@Before public void setupGuestBookServlet() { helper.setUp(); guestbookServlet = new GuestbookServlet(); }
@Before public void setUp() throws Exception { helper.setUp(); user = new User(EMAIL, "gmail.com", USER_ID); conferenceApi = new ConferenceApi(); }
@After public void tearDown() throws Exception { ofy().clear(); helper.tearDown(); }
@Before public void setUp() { _helper.setUp(); ofy().clear(); }
@After public void tearDown() { _helper.tearDown(); }
@Override public void tearDown() throws Exception { helper.tearDown(); super.tearDown(); }
@Before public void setUp() { testHelper.setUp(); alunoRepository = new AlunoRepositoryDatastoreImpl(DatastoreServiceFactory.getDatastoreService()); }
@After public void tearDown() { testHelper.tearDown(); }
@Override protected void tearDown() throws Exception { helper.tearDown(); server.stop(); }
@Before public void setUp() { datastoreHelper.setUp(); ObjectifyFilter.complete(); }
@After public void tearDown() { ObjectifyFilter.complete(); datastoreHelper.tearDown(); }
@Override @Before public void setUp() throws Exception { helper.setUp(); }
/** @throws java.lang.Exception */ @After public void tearDown() throws Exception { helper.tearDown(); }
@Override @After public void tearDown() { helper.tearDown(); }