本文整理汇总了Java中org.everrest.assured.EverrestJetty类的典型用法代码示例。如果您正苦于以下问题:Java EverrestJetty类的具体用法?Java EverrestJetty怎么用?Java EverrestJetty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EverrestJetty类属于org.everrest.assured包,在下文中一共展示了EverrestJetty类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.everrest.assured.EverrestJetty; //导入依赖的package包/类
@BeforeMethod
public void setUp(ITestContext context) throws Exception {
installer = TestInstallerFactory.createInstaller("id_0", "1.0.0");
installerKey = InstallerFqn.of(installer).toKey();
LocalInstallerRegistry localInstallerRegistry =
new LocalInstallerRegistry(
Collections.singleton(installer), new MapBasedInstallerDao(), new InstallerValidator());
registryService = new InstallerRegistryService(localInstallerRegistry);
Integer port = (Integer) context.getAttribute(EverrestJetty.JETTY_PORT);
registry =
new RemoteInstallerRegistry(
"http://localhost:" + port + "/rest", new DefaultHttpJsonRequestFactory());
}
示例2: linksHeaderShouldBeCorrectlyGenerated
import org.everrest.assured.EverrestJetty; //导入依赖的package包/类
@Test
public void linksHeaderShouldBeCorrectlyGenerated(ITestContext ctx) throws Exception {
final Response response =
given()
.auth()
.basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD)
.contentType("application/json")
.when()
.get(SECURE_PATH + "/test/paging/test-path-param?query-param=test-query-param");
assertEquals(response.getStatusCode(), 200);
final String headerValue = response.getHeader("Link");
assertNotNull(headerValue, "Link header is missing in the response");
final Map<String, String> relToLinkMap = PagingUtil.parseLinkHeader(headerValue);
final Set<String> expectedRels = new HashSet<>(asList("first", "last", "prev", "next"));
assertEquals(
relToLinkMap.keySet(),
expectedRels,
"Rels are different " + symmetricDifference(expectedRels, relToLinkMap.keySet()));
final String expectedUri =
"http://localhost:"
+ ctx.getAttribute(EverrestJetty.JETTY_PORT)
+ "/rest/private/test/paging/test-path-param";
for (String link : relToLinkMap.values()) {
final URI uri = URI.create(link);
final Map<String, List<String>> params = getQueryParameters(uri.toURL());
assertEquals(params.size(), 3);
assertNotNull(params.get("skipCount"));
assertNotNull(params.get("maxItems"));
assertEquals(params.get("query-param").get(0), "test-query-param");
assertEquals(link, expectedUri + '?' + uri.getQuery());
}
}
示例3: getUrl
import org.everrest.assured.EverrestJetty; //导入依赖的package包/类
private String getUrl(ITestContext ctx) {
return "http://localhost:" + ctx.getAttribute(EverrestJetty.JETTY_PORT) + "/rest/test";
}
示例4: getServerUrl
import org.everrest.assured.EverrestJetty; //导入依赖的package包/类
private String getServerUrl(ITestContext ctx) {
return "http://localhost:" + ctx.getAttribute(EverrestJetty.JETTY_PORT) + "/rest";
}