本文整理汇总了Java中com.github.tomakehurst.wiremock.common.SingleRootFileSource类的典型用法代码示例。如果您正苦于以下问题:Java SingleRootFileSource类的具体用法?Java SingleRootFileSource怎么用?Java SingleRootFileSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleRootFileSource类属于com.github.tomakehurst.wiremock.common包,在下文中一共展示了SingleRootFileSource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServers
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@PostConstruct
public void startServers() throws IOException {
WireMockConfiguration eurekaServerConfig = wireMockConfig()
.notifier(new ConsoleNotifier(true))
.port(HTTP_PORT)
.fileSource(new SingleRootFileSource("src/test/resources/mocks/default/eureka"));
eurekaServer = new WireMockServer(eurekaServerConfig);
eurekaServer.start();
WireMockConfiguration secureConfig = wireMockConfig()
.notifier(new ConsoleNotifier(true))
.httpsPort(HTTPS_PORT)
.fileSource(new SingleRootFileSource("src/test/resources/mocks/default/secure"));
secureServer = new WireMockServer(secureConfig);
secureServer.start();
}
示例2: main
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
public static void main(String[] args){
try {
int port = 8099;
WireMockServer server = new WireMockServer(
wireMockConfig().port(port).notifier(new ConsoleNotifier(true))
);
Path m = Paths.get("target/wiremock/mappings");
Path f = Paths.get("target/wiremock/files");
Files.createDirectories(m);
Files.createDirectories(f);
FileSource mappings = new SingleRootFileSource(m.toFile().getAbsolutePath());
FileSource files = new SingleRootFileSource(m.toFile().getAbsolutePath());
server.enableRecordMappings(mappings,files);
server.start();
NASDAQQuotesSoap soap = WsProvider.getNASDAQQuotesSoap("localhost:" + port);
server.stubFor(post(urlMatching(".*")).
willReturn(aResponse().proxiedFrom("http://" + WsProvider.NASDAQ_ADDRESS)));
for (MarketCenter mc : soap.listMarketCenters().getMarketCenter()) {
System.out.println(mc.getName());
}
server.stop();
} catch (Exception e){
e.printStackTrace();
} finally {
System.exit(0);
}
}
示例3: startServers
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@PostConstruct
public void startServers() throws IOException {
WireMockConfiguration eurekaServerConfig = wireMockConfig().port(HTTP_PORT).fileSource(new SingleRootFileSource("src/test/resources/mocks/forwardauthheader/eureka"));
eurekaServer = new WireMockServer(eurekaServerConfig);
eurekaServer.start();
WireMockConfiguration secureConfig = wireMockConfig().port(HTTPS_HTTP_PORT).httpsPort(HTTPS_PORT).fileSource(new SingleRootFileSource("src/test/resources/mocks/forwardauthheader/secure"));
secureServer = new WireMockServer(secureConfig);
secureServer.start();
}
开发者ID:ordina-jworks,项目名称:microservices-dashboard-server,代码行数:11,代码来源:InMemoryForwardInboundAuthHeaderWireMock.java
示例4: startServers
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@PostConstruct
public void startServers() throws IOException {
WireMockConfiguration eurekaServerConfig = wireMockConfig().port(HTTP_PORT).fileSource(new SingleRootFileSource("src/test/resources/mocks/forwardoauth2token/eureka"));
eurekaServer = new WireMockServer(eurekaServerConfig);
eurekaServer.start();
WireMockConfiguration secureConfig = wireMockConfig().port(HTTPS_HTTP_PORT).httpsPort(HTTPS_PORT).fileSource(new SingleRootFileSource("src/test/resources/mocks/forwardoauth2token/secure"));
secureServer = new WireMockServer(secureConfig);
secureServer.start();
}
开发者ID:ordina-jworks,项目名称:microservices-dashboard-server,代码行数:11,代码来源:InMemoryForwardOAuth2TokenWireMock.java
示例5: setUpReplay
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@BeforeMethod(groups = {"standAloneTest"})
public void setUpReplay() throws Exception {
/*Generate these replay files by doing this
wget http://repo1.maven.org/maven2/com/github/tomakehurst/wiremock/1.42/wiremock-1.42-standalone.jar
java -jar wiremock-1.42-standalone.jar --proxy-all="http://achernar:7880/" --record-mappings --verbose
Do the test you need to get the recording
Stop the recording server with Ctrl-C when you have sufficient material
It will generate two folders, mapping and __files. Copy these to src/test/resources/fedoraIteratorReplay
*/
if (replay) {
File file = new File(
Thread.currentThread().getContextClassLoader().getResource("ITconfig.properties").toURI());
File srcTestResources = file.getParentFile();
File fedoraIteratorReplay = new File(srcTestResources, "fedoraIteratorReplay");
File mappings = new File(fedoraIteratorReplay, "mappings");
wireMockServer = new WireMockServer(8089, new SingleRootFileSource(fedoraIteratorReplay), false);
wireMockServer.start();
wireMockServer.loadMappingsUsing(
new JsonFileMappingsLoader(
new SingleRootFileSource(
mappings.getAbsolutePath())));
WireMock.configureFor("localhost", wireMockServer.port());
}
}
开发者ID:statsbiblioteket,项目名称:newspaper-batch-event-framework,代码行数:31,代码来源:IteratorForFedora3TestWireMocked.java
示例6: FakeServer
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
FakeServer(int port, String pathToLoad) {
this.wireMockServer =
new WireMockServer(port,
new SingleRootFileSource(Config.ROOT_PATH + pathToLoad),
false);
}
示例7: startWireMock
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@PostConstruct
public void startWireMock() throws IOException {
wireMockServer = new WireMockServer(wireMockConfig().port(8089).fileSource(new SingleRootFileSource("src/main/resources/mocks")));
wireMockServer.start();
}
示例8: setupServer
import com.github.tomakehurst.wiremock.common.SingleRootFileSource; //导入依赖的package包/类
@BeforeClass
public static void setupServer() {
buildWireMock(wireMockConfig());
wireMockServer.loadMappingsUsing(new JsonFileMappingsLoader(
new SingleRootFileSource("src/test/resources/mappings")));
}