项目:springboot-shiro-cas-mybatis
文件:PrincipalFromrequestRemoteUserNonInteractiveCredentialsActionTests.java
@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(),mock(ServicesManager.class),mock(logoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
项目:weex-3d-map
文件:AG_Border_Text_Border_Left_Color.java
@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","#00FFFF");
put("screenshot","AG_Border_Text_Border_Left_Color_02_#00FFFF");
}
});
super.setTestMap(testMap);
}
项目:android-mobile-engage-sdk
文件:MobileEngageTest.java
@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();
}
项目:Webcheckers
文件:PostSigninRouteTest.java
@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);
}
项目:ditb
文件:TestSplitLogWorker.java
@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);
}
项目:weex-3d-map
文件:AG_Border_Image_Border_Right_Color.java
@Before
public void setUp() throws InterruptedException {
super.setUp();
HashMap testMap = new <String,"AG_Border_Image_Border_Right_Color");
testMap.put("step1","AG_Border_Image_Border_Right_Color_01_#FF0000");
}
});
testMap.put("step2","AG_Border_Image_Border_Right_Color_02_#00FFFF");
}
});
super.setTestMap(testMap);
}
项目:kafka-0.11.0.0-src-with-comment
文件:AbstractCoordinatorTest.java
@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);
}
项目:DijkstraAlgorithm-Java
文件:testDijkstraGraph.java
@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;
}
项目:kafka-0.11.0.0-src-with-comment
文件:CompositeReadOnlyWindowStoreTest.java
@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);
}
项目:weex-3d-map
文件:AG_Input_Input_Font_Style.java
@Before
public void setUp() throws InterruptedException {
super.setUp();
HashMap testMap = new <String,"AG_Input");
testMap.put("testChildCaseInit","AG_Input_Input_Font_Style");
testMap.put("step1","normal");
put("screenshot","AG_Input_Input_Font_Style_01_normal");
}
});
testMap.put("step2","italic");
put("screenshot","AG_Input_Input_Font_Style_02_italic");
}
});
super.setTestMap(testMap);
}
项目:GitHub
文件:FutureTest.java
@Before public void setUp() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(server.url("/"))
.addConverterFactory(new StringConverterFactory())
.addCallAdapterFactory(ScalaCallAdapterFactory.create())
.build();
service = retrofit.create(Service.class);
}
项目:empiria.player
文件:GroupAnswersControllerModelTest.java
@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);
}
项目:verify-hub
文件:SessionResourceIntegrationTest.java
@Before
public void setUp() throws Exception {
idpEntityId = "idpEntityId";
rpEntityId = "rpEntityId";
translatedAuthnRequest = SamlResponseWithAuthnRequest@R_306_404[email protected]@R_306_4045@ionDto().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();
}
项目:oscm
文件:LoggerInitListenerTest.java
@Before
public void setup() throws Exception {
emptyLogsFolder();
configServiceMock = setupConfigurationMockForLogging();
listener = new LoggerInitListener() {
@Override
ConfigurationService getConfigurationService() {
return configServiceMock;
}
};
logger = LoggerFactory.getLogger(this.getClass());
}
项目:Learning-Spring-Boot-2.0-Second-Edition
文件:ImageServiceTests.java
@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);
}
}
项目:verify-hub
文件:EidasSessionResourceIntegrationTest.java
@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();
}
项目:android-architecture-components
文件:NetworkBoundResourceTest.java
@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);
}
};
}
项目:LocaleChanger
文件:LocaleChangerDelegateTest.java
@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);
}
项目:ats-framework
文件:Test_ActionHandler.java
@Before
public void setUp() {
//init the test values
ActionClassOne.ACTION_VALUE = 0;
ActionClasstwo.ACTION_VALUE = 0;
}
项目:q-mail
文件:WebDavStoreTest.java
@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);
}
项目:loom
文件:SwiftRealAdapterTestLocalOnly.java
@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);
}
项目:spring-io
文件:AuditResourceIntTest.java
@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();
}
项目:jarling
文件:StarlingExceptionTests.java
@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"));
}
项目:oscm
文件:VServerProcessorBeanTest.java
@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(),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);
}
项目:incubator-ratis
文件:TestRaftLogSegment.java
@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();
}
项目:GitHub
文件:StatisticsScreenTest.java
/**
* 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);
}
项目:FileDownloader-master
文件:FileDownloadUrlConnectionTest.java
@Before
public void setUp() throws Exception {
initMocks(this);
Mockito.when(mURL.openConnection()).thenReturn(mConnection);
Mockito.when(mURL.openConnection(mProxy)).thenReturn(mConnection);
}
项目:spring-reactive-sample
文件:IntegrationTests.java
@Before
public void setup() {
this.rest = WebTestClient
.bindToServer()
.responseTimeout(Duration.ofDays(1))
.baseUrl("http://localhost:" + this.port)
.build();
}
项目:Pet-Supply-Store
文件:TestStoreLargeImages.java
@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());
}
项目:hub-fortify-ssc-integration-service
文件:VulnerabilityUtilTest.java
@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();
}
项目:GitHub
文件:SortDescriptorTests.java
@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);
}
项目:oscm
文件:PropertyHandlerTest.java
项目:hadoop
文件:TestAddBlock.java
项目:GitHub
文件:LinkingObjectsManagedTests.java
@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","n1");
Node n2 = _graph.newNode(0,0);
n2.set("name","n2");
Node n3 = _graph.newNode(0,0);
n3.set("name","n3");
root.addToRelation("child",n1);
root.addToRelation("child",n2);
root.addToRelation("child",n3);
_graph.declareIndex(0,"rootIndex",rootIndex -> {
rootIndex.update(root);
},"name");
}
});
}
项目:monarch
文件:LocatorServerStartupRule.java
@Before
public void before() throws Throwable {
restoreSystemProperties.before();
temporaryFolder.create();
Invoke.invokeInEveryVM("Stop each VM",this::stopServerOrLocatorInThisVM);
members = new ArrayList<>(4);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。