@Before public void setUp() throws Exception { this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction(); final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>(); idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator()); final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager( Collections.<AuthenticationHandler, PrincipalResolver>singletonMap( new PrincipalBearingCredentialsAuthenticationHandler(), new PrincipalBearingPrincipalResolver())); final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl( new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(), idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(), mock(ServicesManager.class), mock(LogoutManager.class)); this.action.setCentralAuthenticationService(centralAuthenticationService); }
@Before public void setUp() throws InterruptedException { super.setUp(); HashMap testMap = new <String, Object> HashMap(); testMap.put("testComponet", "AG_Border"); testMap.put("testChildCaseInit", "AG_Border_Text_Border_Left_Color"); testMap.put("step1",new HashMap(){ { put("click", "#FF0000"); put("screenshot", "AG_Border_Text_Border_Left_Color_01_#FF0000"); } }); testMap.put("step2",new HashMap(){ { put("click", "#00FFFF"); put("screenshot", "AG_Border_Text_Border_Left_Color_02_#00FFFF"); } }); super.setTestMap(testMap); }
@Before public void init() throws Exception { MobileEngageExperimental.enableFeature(MobileEngageFeature.IN_APP_MESSAGING); application = (Application) InstrumentationRegistry.getTargetContext().getApplicationContext(); coreCompletionHandler = mock(MobileEngageCoreCompletionHandler.class); mobileEngageInternal = mock(MobileEngageInternal.class); inboxInternal = mock(InboxInternal.class); baseConfig = new MobileEngageConfig.Builder() .application(application) .credentials(appID, appSecret) .disableDefaultChannel() .build(); MobileEngage.inboxInstance = inboxInternal; MobileEngage.instance = mobileEngageInternal; MobileEngage.completionHandler = coreCompletionHandler; ConnectivityWatchdogTestUtils.resetCurrentActivityWatchdog(); }
@Before public void setup() { // set up mock objects request = mock(Request.class); session = mock(Session.class); when(request.session()).thenReturn(session); engine = mock(TemplateEngine.class); // set up friendly objects playerLobby = new PlayerLobby(); playerLobby.addPlayer(new Player("inuse")); gameLobby = new GameLobby(); gameCenter = new GameCenter(playerLobby, gameLobby); CuT = new PostSigninRoute(engine, gameCenter); }
@Before public void setup() throws Exception { TEST_UTIL.startMiniZKCluster(); Configuration conf = TEST_UTIL.getConfiguration(); zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(), "split-log-worker-tests", null); ds = new DummyServer(zkw, conf); ZKUtil.deleteChildrenRecursively(zkw, zkw.baseZNode); ZKUtil.createAndFailSilent(zkw, zkw.baseZNode); assertThat(ZKUtil.checkExists(zkw, zkw.baseZNode), not (is(-1))); LOG.debug(zkw.baseZNode + " created"); ZKUtil.createAndFailSilent(zkw, zkw.splitLogZNode); assertThat(ZKUtil.checkExists(zkw, zkw.splitLogZNode), not (is(-1))); LOG.debug(zkw.splitLogZNode + " created"); ZKUtil.createAndFailSilent(zkw, zkw.rsZNode); assertThat(ZKUtil.checkExists(zkw, zkw.rsZNode), not (is(-1))); SplitLogCounters.resetCounters(); executorService = new ExecutorService("TestSplitLogWorker"); executorService.startExecutorService(ExecutorType.RS_LOG_REPLAY_OPS, 10); this.mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ? RecoveryMode.LOG_REPLAY : RecoveryMode.LOG_SPLITTING); }
@Before public void setUp() throws InterruptedException { super.setUp(); HashMap testMap = new <String, Object> HashMap(); testMap.put("testComponet", "AG_Border"); testMap.put("testChildCaseInit", "AG_Border_Image_Border_Right_Color"); testMap.put("step1",new HashMap(){ { put("click", "#FF0000"); put("screenshot", "AG_Border_Image_Border_Right_Color_01_#FF0000"); } }); testMap.put("step2",new HashMap(){ { put("click", "#00FFFF"); put("screenshot", "AG_Border_Image_Border_Right_Color_02_#00FFFF"); } }); super.setTestMap(testMap); }
@Before public void setupCoordinator() { this.mockTime = new MockTime(); this.mockClient = new MockClient(mockTime); Metadata metadata = new Metadata(100L, 60 * 60 * 1000L, true); this.consumerClient = new ConsumerNetworkClient(mockClient, metadata, mockTime, RETRY_BACKOFF_MS, REQUEST_TIMEOUT_MS); Metrics metrics = new Metrics(); Cluster cluster = TestUtils.singletonCluster("topic", 1); metadata.update(cluster, Collections.<String>emptySet(), mockTime.milliseconds()); this.node = cluster.nodes().get(0); mockClient.setNode(node); this.coordinatorNode = new Node(Integer.MAX_VALUE - node.id(), node.host(), node.port()); this.coordinator = new DummyCoordinator(consumerClient, metrics, mockTime); }
@Before public void setUp() throws Exception { points = new Point[6][2]; graph = new DijkstraGraph(); for(int y = 0; y < 2; y++) { for(int x = 0; x < 6; x++) { points[x][y] = new Point(1.0); graph.addPoint(points[x][y]); if(y != 0) { graph.addConnection(points[x][y], points[x][y - 1]); } if(x != 0) { graph.addConnection(points[x][y], points[x - 1][y]); } } } points[0][1].entryCost = 2.0; points[2][0].entryCost = 4.0; points[4][1].entryCost = 4.0; }
@Before public void before() { stubProviderOne = new StateStoreProviderStub(false); stubProviderTwo = new StateStoreProviderStub(false); underlyingWindowStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE); stubProviderOne.addStore(storeName, underlyingWindowStore); otherUnderlyingStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE); stubProviderOne.addStore("other-window-store", otherUnderlyingStore); windowStore = new CompositeReadOnlyWindowStore<>( new WrappingStoreProvider(Arrays.<StateStoreProvider>asList(stubProviderOne, stubProviderTwo)), QueryableStoreTypes.<String, String>windowStore(), storeName); }
@Before public void setUp() throws InterruptedException { super.setUp(); HashMap testMap = new <String, Object> HashMap(); testMap.put("testComponet", "AG_Input"); testMap.put("testChildCaseInit", "AG_Input_Input_Font_Style"); testMap.put("step1",new HashMap(){ { put("click", "normal"); put("screenshot", "AG_Input_Input_Font_Style_01_normal"); } }); testMap.put("step2",new HashMap(){ { put("click", "italic"); put("screenshot", "AG_Input_Input_Font_Style_02_italic"); } }); super.setTestMap(testMap); }
@Before public void setUp() { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new StringConverterFactory()) .addCallAdapterFactory(ScalaCallAdapterFactory.create()) .build(); service = retrofit.create(Service.class); }
@Before public void setUp() { groupAnswersControllerModel = new GroupAnswersControllerModel(identifiableAnswersByTypeFinder, model); groupController1 = mock(GroupAnswersController.class); groupController2 = mock(GroupAnswersController.class); groupControllers = Lists.newArrayList(groupController1, groupController2); groupAnswersControllerModel.setGroupChoicesControllers(groupControllers); }
@Before public void setUp() throws Exception { idpEntityId = "idpEntityId"; rpEntityId = "rpEntityId"; translatedAuthnRequest = SamlResponseWithAuthnRequestInformationDtoBuilder.aSamlResponseWithAuthnRequestInformationDto().withIssuer(rpEntityId).build(); rpSamlRequest = SamlAuthnRequestContainerDtoBuilder.aSamlAuthnRequestContainerDto().build(); idpSsoUri = UriBuilder.fromPath("idpSsoUri").build(); configStub.reset(); configStub.setupStubForEnabledIdps(asList(idpEntityId)); configStub.setUpStubForLevelsOfAssurance(rpEntityId); configStub.setUpStubForMatchingServiceEntityId(rpEntityId, msEntityId); configStub.setupStubForEidasEnabledForTransaction(rpEntityId, false); eventSinkStub.setupStubForLogging(); }
@Before public void setup() throws Exception { emptyLogsFolder(); configServiceMock = setupConfigurationMockForLogging(); listener = new LoggerInitListener() { @Override ConfigurationService getConfigurationService() { return configServiceMock; } }; logger = LoggerFactory.getLogger(this.getClass()); }
@Before public void setUp() { operations.dropCollection(Image.class); operations.insert(new Image("1", "learning-spring-boot-cover.jpg")); operations.insert(new Image("2", "learning-spring-boot-2nd-edition-cover.jpg")); operations.insert(new Image("3", "bazinga.png")); }
@Before public void setup() throws Exception { debugSession = DebugSessionFactory.getDebugSession(PROJECT_NAME, "VariableTest"); if (staticBreakpointEvent == null) { staticBreakpointEvent = waitForBreakPointEvent("VariableTest", 60); } }
@Before public void setUp() throws Exception { stubSamlEngineTranslationLOAForCountry(LevelOfAssurance.LEVEL_2, NETHERLANDS); stubSamlEngineGenerationOfAQR(); configStub.reset(); configStub.setUpStubForMatchingServiceRequest(RP_ENTITY_ID, MS_ENTITY_ID, true); configStub.setupStubForEnabledIdps(asList(IDP_ENTITY_ID)); configStub.setUpStubForLevelsOfAssurance(RP_ENTITY_ID); configStub.setupStubForEidasEnabledForTransaction(RP_ENTITY_ID, false); enableCountriesForRp(RP_ENTITY_ID, NETHERLANDS, SPAIN); configStub.setupStubForEidasCountries(EIDAS_COUNTRIES); eventSinkStub.reset(); eventSinkStub.setupStubForLogging(); }
@Before public void init() { AppExecutors appExecutors = useRealExecutors ? countingAppExecutors.getAppExecutors() : new InstantAppExecutors(); networkBoundResource = new NetworkBoundResource<Foo, Foo>(appExecutors) { @Override protected void saveCallResult(@NonNull Foo item) { saveCallResult.apply(item); } @Override protected boolean shouldFetch(@Nullable Foo data) { // since test methods don't handle repetitive fetching, call it only once return shouldFetch.apply(data) && fetchedOnce.compareAndSet(false, true); } @NonNull @Override protected LiveData<Foo> loadFromDb() { return dbData; } @NonNull @Override protected LiveData<ApiResponse<Foo>> createCall() { return createCall.apply(null); } }; }
@Before public void setUp() { localePersistor = mock(LocalePersistor.class); localeResolver = mock(LocaleResolver.class); defaultLocalePair = mock(DefaultResolvedLocalePair.class); doReturn(defaultLocalePair).when(localeResolver).resolveDefault(); appLocaleChanger = mock(AppLocaleChanger.class); sut = new LocaleChangerDelegate(localePersistor, localeResolver, appLocaleChanger); }
@Before public void setUp() { //init the test values ActionClassOne.ACTION_VALUE = 0; ActionClassTwo.ACTION_VALUE = 0; }
@Before public void setUp() throws Exception { block1 = new PolyBlockImpl(); block2 = new PolyBlockImpl(); block3 = new PolyBlockImpl(); block4 = new PolyBlockImpl(); block5 = new PolyBlockImpl(); }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); HttpParams httpParams = new BasicHttpParams(); when(mockHttpClientFactory.create()).thenReturn(mockHttpClient); when(mockHttpClient.getParams()).thenReturn(httpParams); when(mockHttpClient.getConnectionManager()).thenReturn(mockClientConnectionManager); when(mockClientConnectionManager.getSchemeRegistry()).thenReturn(mockSchemeRegistry); }
@Before public void setUp() throws Exception { LOG.info("Setup test"); realAdapter = (RealAdapter) adapterLoader.getAdapter("helionSwiftReal.properties"); prov = realAdapter.getProvider(); session = new SessionImpl("sessionOne", sessionManager.getInterval()); aggregationManager.createSession(session); stitcher.createSession(session); // this triggers the data collection adapterManager.userConnected(session, prov, creds); }
@Before public void setup() { MockitoAnnotations.initMocks(this); AuditEventService auditEventService = new AuditEventService(auditEventRepository, auditEventConverter); AuditResource auditResource = new AuditResource(auditEventService); this.restAuditMockMvc = MockMvcBuilders.standaloneSetup(auditResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setConversionService(formattingConversionService) .setMessageConverters(jacksonMessageConverter).build(); }
@Before public void setUp(){ Properties properties = new Properties(); try { properties.load(new FileInputStream("./cfg/sandbox.properties")); } catch (IOException e) { e.printStackTrace(); } this.goodApiService = new ApiService(StarlingBankEnvironment.SANDBOX, properties.getProperty("starling.access.token")); }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); vServerProcessor = spy(new VServerProcessorBean()); vServerProcessor.vserverComm = mock(VServerCommunication.class); vServerProcessor.vsysComm = mock(VSystemCommunication.class); vServerProcessor.fwComm = mock(FWCommunication.class); vServerProcessor.vdiskInfo = mock(VDiskCommunication.class); platformService = mock(APPlatformService.class); doReturn("RUNNING").when(vServerProcessor.fwComm).getFirewallStatus( any(PropertyHandler.class)); doReturn(Boolean.TRUE).when(platformService).lockServiceInstance( anyString(), anyString(), any(PasswordAuthentication.class)); doNothing().when(platformService).unlockServiceInstance(anyString(), anyString(), any(PasswordAuthentication.class)); doNothing().when(platformService).sendMail(anyListOf(String.class), subject.capture(), text.capture()); User user = new User(); user.setLocale("de"); doReturn(user).when(platformService).authenticate(anyString(), any(PasswordAuthentication.class)); vServerProcessor.setPlatformService(platformService); parameters = new HashMap<>(); configSettings = new HashMap<>(); settings = new ProvisioningSettings(parameters, configSettings, "en"); settings.setSubscriptionId("subId"); paramHandler = new PropertyHandler(settings); }
@Before public void setup() throws Exception { RaftProperties properties = new RaftProperties(); storageDir = getTestDir(); RaftServerConfigKeys.setStorageDir(properties, storageDir); this.segmentMaxSize = RaftServerConfigKeys.Log.segmentSizeMax(properties).getSize(); this.preallocatedSize = RaftServerConfigKeys.Log.preallocatedSize(properties).getSize(); this.bufferSize = RaftServerConfigKeys.Log.writeBufferSize(properties).getSizeInt(); }
/** * Setup your test fixture with a fake task id. The {@link TaskDetailActivity} is started with * a particular task id, which is then loaded from the service API. * * <p> * Note that this test runs hermetically and is fully isolated using a fake implementation of * the service API. This is a great way to make your tests more reliable and faster at the same * time, since they are isolated from any outside dependencies. */ @Before public void intentWithStubbedTaskId() { // Given some tasks TasksRepository.destroyInstance(); TasksRepository repository = Injection.provideTasksRepository(InstrumentationRegistry.getContext()); repository.saveTask(new Task("Title1", "", false)); repository.saveTask(new Task("Title2", "", true)); // Lazily start the Activity from the ActivityTestRule Intent startIntent = new Intent(); mStatisticsActivityTestRule.launchActivity(startIntent); }
@Before public void setUp() throws Exception { initMocks(this); Mockito.when(mURL.openConnection()).thenReturn(mConnection); Mockito.when(mURL.openConnection(mProxy)).thenReturn(mConnection); }
@Before public void setup() { this.rest = WebTestClient .bindToServer() .responseTimeout(Duration.ofDays(1)) .baseUrl("http://localhost:" + this.port) .build(); }
@Before public void initialize() { MockitoAnnotations.initMocks(this); when(mockedLargeImg.getSize()).thenReturn(ImageSizePreset.FULL.getSize()); when(mockedIconImg.getSize()).thenReturn(ImageSizePreset.ICON.getSize()); when(mockedMainImg.getSize()).thenReturn(ImageSizePreset.MAIN_IMAGE.getSize()); when(mockedPreviewImg.getSize()).thenReturn(ImageSizePreset.PREVIEW.getSize()); }
@Override @Before public void setUp() throws JsonIOException, IOException, IntegrationException { final List<BlackDuckFortifyMapperGroup> blackDuckFortifyMappers = mappingParser .createMapping(propertyConstants.getMappingJsonPath()); HUB_PROJECT_NAME_1 = blackDuckFortifyMappers.get(0).getHubProjectVersion().get(0).getHubProject(); HUB_PROJECT_VERSION_NAME_1 = blackDuckFortifyMappers.get(0).getHubProjectVersion().get(0).getHubProjectVersion(); HUB_PROJECT_NAME_2 = blackDuckFortifyMappers.get(1).getHubProjectVersion().get(0).getHubProject(); HUB_PROJECT_VERSION_NAME_2 = blackDuckFortifyMappers.get(1).getHubProjectVersion().get(0).getHubProjectVersion(); }
@Before public void setUp() { RealmConfiguration config = configFactory.createConfiguration(); sharedRealm = OsSharedRealm.getInstance(config); sharedRealm.beginTransaction(); table = sharedRealm.createTable("test_table"); }
@Before public void setup(){ filenum = 4; // pick 1, 2, 3 or 4 int numofmolecules = NIST_nmol[filenum-1]; double boxlength = NIST_boxl[filenum -1]; double kcut = Math.sqrt(26.999)*2*Math.PI/boxlength; double rCutRealES = 10; Space space = Space.getInstance(3); box = new Box(space); SpeciesWater3P species = new SpeciesWater3P(space,false); ChargeAgentSourceSPCE agentSource = new ChargeAgentSourceSPCE(species); AtomLeafAgentManager<EwaldSummation.MyCharge> atomAgentManager = new AtomLeafAgentManager<EwaldSummation.MyCharge>(agentSource, box); sim = new Simulation(space); sim.addSpecies(species); sim.addBox(box); box.setNMolecules(species,numofmolecules); box.getBoundary().setBoxSize(new Vector3D(boxlength,boxlength,boxlength)); es = new EwaldSummation(box,atomAgentManager,space,kcut,rCutRealES); es.setAlpha(5.6/boxlength); Configuration config = new ConfigurationResourceFile( String.format("etomica/potential/spce"+String.valueOf(filenum)+".pos"), EwaldSummationTest.class ); config.initializeCoordinates(box); }
@Before public void setUp() throws Exception { parameters = new HashMap<>(); configSettings = new HashMap<>(); settings = new ProvisioningSettings(parameters, configSettings, "en"); propertyHandler = new PropertyHandler(settings); }
@Before public void setup() throws IOException { conf = new Configuration(); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCKSIZE); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(REPLICATION) .build(); cluster.waitActive(); }
@Before public void setUp() { context = InstrumentationRegistry.getInstrumentation().getContext(); RealmConfiguration realmConfig = configFactory.createConfiguration(); realm = Realm.getInstance(realmConfig); }
@Before public void initGraph() { _graph = new GraphBuilder().build(); _graph.connect(new Callback<Boolean>() { @Override public void on(Boolean result) { Node root = _graph.newNode(0, 0); root.set("name", Type.STRING, "root"); Node n1 = _graph.newNode(0, 0); n1.set("name", Type.STRING, "n1"); Node n2 = _graph.newNode(0, 0); n2.set("name", Type.STRING, "n2"); Node n3 = _graph.newNode(0, 0); n3.set("name", Type.STRING, "n3"); root.addToRelation("child", n1); root.addToRelation("child", n2); root.addToRelation("child", n3); _graph.declareIndex(0, "rootIndex", rootIndex -> { rootIndex.update(root); }, "name"); } }); }
@Before public void before() throws Throwable { restoreSystemProperties.before(); temporaryFolder.create(); Invoke.invokeInEveryVM("Stop each VM", this::stopServerOrLocatorInThisVM); members = new ArrayList<>(4); }