javax.servlet.http.PushBuilder#org.junit.Before源码实例Demo

下面列出了javax.servlet.http.PushBuilder#org.junit.Before 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: airsonic-advanced   文件: StatusServiceTestCase.java
@Before
public void setUp() {
    doReturn(new MediaFile()).when(mediaFileService).getMediaFile(any(Path.class));
    doReturn(settings).when(settingsService).getUserSettings(any(String.class));
    doReturn(true).when(settings).getNowPlayingAllowed();
    service = new StatusService();
    service.setMessagingTemplate(messagingTemplate);
    service.setMediaFileService(mediaFileService);
    service.setSettingsService(settingsService);
    player1 = new Player();
    player1.setId(1);
    player1.setUsername("p1");
    player2 = new Player();
    player2.setId(2);
    player2.setUsername("p2");
}
 
源代码2 项目: flink   文件: SimplifyTest.java
@Before
@Override
public void setup() throws Exception{
	super.setup();

	Object[][] edges = new Object[][]{
		new Object[]{0, 0},
		new Object[]{0, 1},
		new Object[]{0, 1},
		new Object[]{0, 2},
		new Object[]{0, 2},
		new Object[]{1, 0},
		new Object[]{2, 2},
	};

	List<Edge<IntValue, NullValue>> edgeList = new LinkedList<>();

	for (Object[] edge : edges) {
		edgeList.add(new Edge<>(new IntValue((int) edge[0]), new IntValue((int) edge[1]), NullValue.getInstance()));
	}

	graph = Graph.fromCollection(edgeList, env);
}
 
源代码3 项目: data-highway   文件: PaverServiceImplTest.java
@Before
public void before() {
  road.setName(ROAD_NAME);
  road.setContactEmail("[email protected]");
  road.setDescription("road description");
  road.setTeamName("awesome team");
  road.setAuthorisation(new Authorisation());
  road.getAuthorisation().setOnramp(new Onramp());
  road.getAuthorisation().getOnramp().setCidrBlocks(emptyList());
  road.getAuthorisation().getOnramp().setAuthorities(emptyList());
  road.getAuthorisation().setOfframp(new Offramp());
  road.getAuthorisation().getOfframp().setAuthorities(emptyMap());
  road.setDeleted(false);
  underTest = new PaverServiceImpl(roadAdminClient, schemaStoreClient, cidrBlockValidator, mappings,
      notificationHandler, true, clock);
}
 
@Before
public void setUp() throws InterruptedException {
	super.setUp();
	TreeMap testMap = new <String, Object> TreeMap();
	testMap.put("testComponet", "AG_Switch");
	testMap.put("testChildCaseInit", "AG_Switch_Switch_Checked");
	testMap.put("step1",new TreeMap(){
		{
			put("click", "true");
			put("screenshot", "AG_Switch_Switch_Checked_01_true");
		}
	});
	testMap.put("step2",new TreeMap(){
		{
			put("click", "false");
			put("screenshot", "AG_Switch_Switch_Checked_02_false");
		}
	});
	super.setTestMap(testMap);
}
 
源代码5 项目: hop   文件: DatabaseJoinTest.java
@Before
public void setUp() {

  TransformMeta mockTransformMeta = mock( TransformMeta.class );
  PipelineMeta mockPipelineMeta = mock( PipelineMeta.class );
  Pipeline mockPipeline = mock( Pipeline.class );
  TransformPartitioningMeta mockTransformPartitioningMeta = mock( TransformPartitioningMeta.class );

  when( mockTransformMeta.getName() ).thenReturn( "MockTransform" );
  when( mockPipelineMeta.findTransform( anyString() ) ).thenReturn( mockTransformMeta );
  when( mockTransformMeta.getTargetTransformPartitioningMeta() ).thenReturn( mockTransformPartitioningMeta );

  mockITransform = mock( DatabaseJoinMeta.class, withSettings().extraInterfaces( ITransform.class ) );
  mockTransformDataInterface = mock( DatabaseJoinData.class, withSettings().extraInterfaces( ITransform.class ) );
  mockTransformDataInterface.db = mock( Database.class );
  mockTransformDataInterface.pstmt = mock( PreparedStatement.class );
  mockDatabaseJoin = spy( new DatabaseJoin( mockTransformMeta, mockTransformDataInterface, 1, mockPipelineMeta, mockPipeline ) );
}
 
@Before
public void before() throws Exception {
    MockitoAnnotations.initMocks(this);

    pipeline = new FakeChannelPipeline();

    when(tlsTcpListener.getTls()).thenReturn(tls);
    when(ssl.getSslHandler(any(SocketChannel.class), any(Tls.class))).thenReturn(sslHandler);
    when(sslHandler.handshakeFuture()).thenReturn(future);
    when(socketChannel.pipeline()).thenReturn(pipeline);
    when(socketChannel.attr(any(AttributeKey.class))).thenReturn(attribute);
    when(channelDependencies.getConfigurationService()).thenReturn(fullConfigurationService);

    tlstcpChannelInitializer = new TlsTcpChannelInitializer(channelDependencies, tlsTcpListener, ssl, eventLog);

}
 
源代码7 项目: das   文件: TableDaoShardByDbTest.java
@Before
public void setup() throws Exception {
    for (int i = 0; i < DB_MODE; i++) {
        String[] statements = new String[TABLE_MODE];
        for (int j = 0; j < TABLE_MODE; j++) {
            statements[j] = String.format("INSERT INTO person(PeopleID, Name, CountryID, CityID, ProvinceID) VALUES(%d, 'test', %d, %d, 1)", j + 1, i, j);
        }

        if(!allowInsertWithId())
            statements = DbSetupUtil.handle("Person", statements);

        BatchUpdateBuilder builder = new BatchUpdateBuilder(statements);
        builder.hints().inShard(i);
        super.dao.batchUpdate(builder);
    }
}
 
@Before
public void init() {
    try {
        transactionTemplate.execute((TransactionCallback<Void>) transactionStatus -> {
            Tag hibernate = new Tag();
            hibernate.setName("hibernate");
            entityManager.persist(hibernate);

            Tag jpa = new Tag();
            jpa.setName("jpa");
            entityManager.persist(jpa);
            return null;
        });
    } catch (TransactionException e) {
        LOGGER.error("Failure", e);
    }

}
 
源代码9 项目: hop   文件: BlockUntilStepsFinishMetaTest.java
@Before
public void setUpLoadSave() throws Exception {
  PluginRegistry.init( false );
  List<String> attributes =
    Arrays.asList( "transformName", "transformCopyNr" );

  Map<String, String> getterMap = new HashMap<>();
  Map<String, String> setterMap = new HashMap<>();
  FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 );

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "transformName", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "transformCopyNr", stringArrayLoadSaveValidator );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
    new LoadSaveTester<>( testMetaClass, attributes, new ArrayList<>(),
      getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
源代码10 项目: kareldb   文件: ClusterTestHarness.java
@Before
public void setUp() throws Exception {
    zookeeper = new EmbeddedZookeeper();
    zkConnect = String.format("localhost:%d", zookeeper.port());

    configs = new Vector<>();
    servers = new Vector<>();
    for (int i = 0; i < numBrokers; i++) {
        KafkaConfig config = getKafkaConfig(i);
        configs.add(config);

        KafkaServer server = TestUtils.createServer(config, Time.SYSTEM);
        servers.add(server);
    }

    String[] serverUrls = new String[servers.size()];
    ListenerName listenerType = ListenerName.forSecurityProtocol(getSecurityProtocol());
    for (int i = 0; i < servers.size(); i++) {
        serverUrls[i] =
            Utils.formatAddress(
                servers.get(i).config().advertisedListeners().head().host(),
                servers.get(i).boundPort(listenerType)
            );
    }
    bootstrapServers = Utils.join(serverUrls, ",");
}
 
@Before
public void setup() {
	ByteArrayHttpMessageConverter emptyBodyConverter = new ByteArrayHttpMessageConverter();
	emptyBodyConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));

	List<HttpMessageConverter<?>> converters = new ArrayList<>(3);
	converters.add(emptyBodyConverter);
	converters.add(new ByteArrayHttpMessageConverter());
	converters.add(new ResourceHttpMessageConverter());
	converters.add(new MappingJackson2HttpMessageConverter());

	AllEncompassingFormHttpMessageConverter converter = new AllEncompassingFormHttpMessageConverter();
	converter.setPartConverters(converters);

	restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
	restTemplate.setMessageConverters(Collections.singletonList(converter));
}
 
源代码12 项目: flink   文件: IncrementalSSSPITCase.java
@Before
public void before() throws Exception {
	resultPath = tempFolder.newFile().toURI().toString();
	File verticesFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(verticesFile, IncrementalSSSPData.VERTICES);

	File edgesFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(edgesFile, IncrementalSSSPData.EDGES);

	File edgesInSSSPFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(edgesInSSSPFile, IncrementalSSSPData.EDGES_IN_SSSP);

	verticesPath = verticesFile.toURI().toString();
	edgesPath = edgesFile.toURI().toString();
	edgesInSSSPPath = edgesInSSSPFile.toURI().toString();
}
 
源代码13 项目: Tomcat8-Source-Read   文件: TestContextName.java
@Before
public void setUp() throws Exception {
    cn1 = new ContextName(null, null);
    cn2 = new ContextName("", null);
    cn3 = new ContextName("/", null);
    cn4 = new ContextName("/foo", null);
    cn5 = new ContextName("/foo/bar", null);
    cn6 = new ContextName(null, "A");
    cn7 = new ContextName("", "B");
    cn8 = new ContextName("/", "C");
    cn9 = new ContextName("/foo", "D");
    cn10 = new ContextName("/foo/bar", "E");
    cn11 = new ContextName("ROOT", false);
    cn12 = new ContextName("foo", false);
    cn13 = new ContextName("foo#bar", false);
    cn14 = new ContextName("ROOT##A", false);
    cn15 = new ContextName("foo##D", false);
    cn16 = new ContextName("foo#bar##E", false);
    cn17 = new ContextName("/ROOT", null);
    cn18 = new ContextName("/ROOT#bar", false);
    cn19 = new ContextName("/ROOT#bar##A", false);
    cn20 = new ContextName("/ROOT##A", false);
    cn21 = new ContextName("foo.war", false);
    cn22 = new ContextName("foo.war", true);
}
 
源代码14 项目: NeurophFramework   文件: AndTest.java
@Before
public void setUp() {
    instance = new And();
    inputNeurons = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        inputNeurons.add(new InputNeuron());
    }
           
    Neuron toNeuron = new Neuron();

    inputConnections = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        inputConnections.add(new Connection(inputNeurons.get(i), toNeuron, 1));
        toNeuron.addInputConnection(inputConnections.get(i));
    }
}
 
@Before
public void setUp()
        throws Exception
{
    logger.info("{}: enter", testName.getMethodName());

    when(mockFactory.getOrCreateConn(eq(decodedEndpoint))).thenReturn(mockClient);

    handler = new RedisMetadataHandler(mockGlue, new LocalKeyFactory(), mockSecretsManager, mockAthena, mockFactory, "bucket", "prefix");
    allocator = new BlockAllocatorImpl();

    when(mockSecretsManager.getSecretValue(any(GetSecretValueRequest.class)))
            .thenAnswer((InvocationOnMock invocation) -> {
                GetSecretValueRequest request = invocation.getArgumentAt(0, GetSecretValueRequest.class);
                if ("endpoint".equalsIgnoreCase(request.getSecretId())) {
                    return new GetSecretValueResult().withSecretString(decodedEndpoint);
                }
                throw new RuntimeException("Unknown secret " + request.getSecretId());
            });
}
 
源代码16 项目: besu   文件: RevertOperationTest.java
@Before
public void setUp() {
  when(messageFrame.popStackItem())
      .thenReturn(Bytes32.fromHexString("0x00"))
      .thenReturn(Bytes32.fromHexString("0x0e"));
  when(messageFrame.readMemory(UInt256.ZERO, UInt256.valueOf(0x0e)))
      .thenReturn(revertReasonBytes);
}
 
@Before
public void setUp() {
    given(mockRoutingContext.response()).willReturn(mockHttpServerResponse);
    given(mockHttpServerResponse.headers()).willReturn(new VertxHttpHeaders());

    bufferConverter = new BufferConverter();
    response = new VertxServerHttpResponse(mockRoutingContext, bufferConverter);
}
 
源代码18 项目: huobi_Java   文件: TestGetOpenOrders.java
@Before
public void Initialize() {
  impl = new RestApiRequestImpl("12345", "67890", new RequestOptions());
  testAccount1.setType(AccountType.SPOT);
  testAccount1.setId(123L);
  testAccount2.setType(AccountType.MARGIN);
  testAccount2.setId(456L);
  List<Account> accountList = new LinkedList<>();
  accountList.add(testAccount1);
  accountList.add(testAccount2);
  testUser.setAccounts(accountList);
}
 
@Before
public void setUp() {
    printSeperator();
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
}
 
源代码20 项目: hop   文件: ExcelInputMetaTest.java
@Before
public void setUp() throws Exception {
  HopEnvironment.init();

  meta = new ExcelInputMeta();
  meta.setFileName( new String[] { "1", "2", "3" } );
  meta.setSheetName( new String[] { "1", "2", "3", "4" } );
  meta.setField( new ExcelInputField[] {
    new ExcelInputField( "1", 1, 1 ),
    new ExcelInputField( "2", 2, 2 ) } );
  meta.normilizeAllocation();
}
 
源代码21 项目: Moss   文件: AdminApplicationDiscoveryTest.java
@Before
public void setUp() {
    instance = new SpringApplicationBuilder().sources(TestAdminApplication.class)
                                             .web(WebApplicationType.REACTIVE)
                                             .run("--server.port=0", "--management.endpoints.web.base-path=/mgmt",
                                                 "--endpoints.health.enabled=true", "--info.test=foobar",
                                                 "--eureka.client.enabled=false");

    simpleDiscovery = instance.getBean(SimpleDiscoveryProperties.class);

    this.port = instance.getEnvironment().getProperty("local.server.port", Integer.class, 0);
    this.webClient = createWebClient(this.port);
}
 
源代码22 项目: ghidra   文件: DefinedDataIteratorTest.java
@Before
public void setUp() throws Exception {

	builder = new ToyProgramBuilder("DefinedDataIteratorTests", false);
	program = builder.getProgram();
	dtm = program.getDataTypeManager();

	intDT = AbstractIntegerDataType.getSignedDataType(4, dtm);
	intTD = new TypedefDataType("int_typedef", intDT);
	stringDT = StringDataType.dataType;
	charDT = new CharDataType(dtm);
	charArray = new ArrayDataType(charDT, 20, charDT.getLength());

	struct1DT = new StructureDataType("struct1", 100);
	struct1DT.replaceAtOffset(0, intDT, intDT.getLength(), "f1", null);
	struct1DT.replaceAtOffset(10, charArray, charArray.getLength(), "f2", null);
	struct1DT.replaceAtOffset(50, stringDT, 10, "f3", null);

	structArray = new ArrayDataType(struct1DT, 10, struct1DT.getLength());

	struct2DT = new StructureDataType("struct2", 200);
	struct2DT.replaceAtOffset(0, intDT, intDT.getLength(), "f1", null);
	struct2DT.replaceAtOffset(10, struct1DT, intDT.getLength(), "f2", null);

	builder.createMemory("test", "0x0", 0x2000);
	program = builder.getProgram();
}
 
/**
 * Create an empty pointcut, populating instance variables.
 */
@Before
public void setup() {
	ProxyFactory pf = new ProxyFactory(new SerializablePerson());
	nop = new SerializableNopInterceptor();
	pc = new NameMatchMethodPointcut();
	pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
	proxied = (Person) pf.getProxy();
}
 
@Before
public void before()
{
    allocator = new BlockAllocatorImpl("test-allocator-id");
    mapper = VersionedObjectMapperFactory.create(allocator);
    mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
 
源代码25 项目: hop   文件: WorkflowEntryWriteToLogTest.java
@Before
public void setUp() throws Exception {
  parentWorkflow = mock( Workflow.class );
  doReturn( false ).when( parentWorkflow ).isStopped();

  action = new ActionWriteToLog();
  action = spy( action );
}
 
源代码26 项目: hadoop-ozone   文件: TestObjectHead.java
@Before
public void setup() throws IOException {
  //Create client stub and object store stub.
  OzoneClient clientStub = new OzoneClientStub();

  // Create volume and bucket
  clientStub.getObjectStore().createS3Bucket(bucketName);

  bucket = clientStub.getObjectStore().getS3Bucket(bucketName);

  // Create HeadBucket and setClient to OzoneClientStub
  keyEndpoint = new ObjectEndpoint();
  keyEndpoint.setClient(clientStub);
}
 
源代码27 项目: mr-hashemi   文件: PassItselfBackViaContextTest.java
@Before
public void prepareSystem() {
    myObj = new MyObj();
    context = Context.newBuilder().allowPolyglotAccess(PolyglotAccess.ALL).build();
    context.getPolyglotBindings().putMember("myObj", myObj);
    context.eval("hashemi", "bebin azinja() {\n" + "  bede import(\"myObj\");\n" + "}\n");
    myObjWrapped = context.getBindings("hashemi").getMember("azinja").execute();
    assertFalse(myObjWrapped.isNull());
    myObjCall = myObjWrapped.as(CallWithValue.class);
}
 
源代码28 项目: hop   文件: CloneRowTest.java
@Before
public void setup() {
  transformMockHelper =
    new TransformMockHelper<CloneRowMeta, CloneRowData>( "Test CloneRow", CloneRowMeta.class, CloneRowData.class );
  when( transformMockHelper.logChannelFactory.create( any(), any( ILoggingObject.class ) ) )
    .thenReturn( transformMockHelper.logChannelInterface );
  when( transformMockHelper.pipeline.isRunning() ).thenReturn( true );
}
 
@Override
@Before
public void setUp() throws Exception {
   super.setUp();
   driver = factory.load(driverFile);
   context = new PlatformDeviceDriverContext(createDevice(driver), driver, mockPopulationCacheMgr);
}
 
源代码30 项目: besu   文件: RewardTraceGeneratorTest.java
@Before
public void setUp() {
  final BlockBody blockBody = new BlockBody(Collections.emptyList(), List.of(ommerHeader));
  final BlockHeader blockHeader =
      gen.header(0x0A, blockBody, new BlockDataGenerator.BlockOptions());
  block = new Block(blockHeader, blockBody);
  when(protocolSchedule.getByBlockNumber(block.getHeader().getNumber())).thenReturn(protocolSpec);
  when(protocolSpec.getBlockReward()).thenReturn(blockReward);
  when(protocolSpec.getMiningBeneficiaryCalculator()).thenReturn(miningBeneficiaryCalculator);
  when(miningBeneficiaryCalculator.calculateBeneficiary(block.getHeader()))
      .thenReturn(blockBeneficiary);
  when(miningBeneficiaryCalculator.calculateBeneficiary(ommerHeader))
      .thenReturn(ommerBeneficiary);
}