本文整理汇总了Java中org.takes.facets.fork.TkFork类的典型用法代码示例。如果您正苦于以下问题:Java TkFork类的具体用法?Java TkFork怎么用?Java TkFork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TkFork类属于org.takes.facets.fork包,在下文中一共展示了TkFork类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: TkRefresh
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Ctor.
* @param path Path
* @throws IOException If fails
*/
public TkRefresh(final File path) throws IOException {
this.take = new TkFork(
new FkHitRefresh(
path,
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
开发者ID:yegor256,项目名称:rehttp,代码行数:21,代码来源:TkRefresh.java
示例2: refresh
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Ctor.
* @param path Path of files
* @return Take
* @throws IOException If fails
*/
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
开发者ID:yegor256,项目名称:threecopies,代码行数:22,代码来源:TkApp.java
示例3: TkRefresh
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Ctor.
* @param path Path of files
* @throws IOException If fails
*/
TkRefresh(final String path) throws IOException {
super(
new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
)
);
}
开发者ID:yegor256,项目名称:jare,代码行数:23,代码来源:TkRefresh.java
示例4: refresh
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Hit refresh fork.
* @param path Path of files
* @return Fork
* @throws IOException If fails
*/
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
开发者ID:yegor256,项目名称:wring,代码行数:22,代码来源:TkApp.java
示例5: justWorks
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* FtBasic can work.
* @throws Exception If some problem inside
*/
@Test
public void justWorks() throws Exception {
new FtRemote(
new TkFork(new FkRegex(FtBasicTest.ROOT_PATH, "hello, world!"))
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
new JdkRequest(home)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.assertBody(Matchers.startsWith("hello"));
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:22,代码来源:FtBasicTest.java
示例6: returnsProperResponseCodeOnInvalidUrl
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* BkBasic can return HTTP status 404 when accessing invalid URL.
*
* @throws IOException if any I/O error occurs.
*/
@Test
public void returnsProperResponseCodeOnInvalidUrl() throws IOException {
new FtRemote(
new TkFork(
new FkRegex("/path/a", new TkText("a")),
new FkRegex("/path/b", new TkText("b"))
)
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
new JdkRequest(String.format("%s/path/c", home))
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_NOT_FOUND);
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:25,代码来源:BkBasicTest.java
示例7: justWorks
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* TkProxy can just work.
* @throws Exception If some problem inside
*/
@Test
public void justWorks() throws Exception {
new FtRemote(
new TkFork(
new FkMethods(this.method, new TkFixed(this.expected))
)
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
MatcherAssert.assertThat(
new RsPrint(
new TkProxy(home).act(
new RqFake(TkProxyTest.this.method)
)
).print(),
Matchers.containsString(
TkProxyTest.this.expected
)
);
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:29,代码来源:TkProxyTest.java
示例8: refresh
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Hit refresh fork.
* @param path Path of files
* @return Fork
* @throws IOException If fails
*/
@SuppressWarnings("PMD.DoNotUseThreads")
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
new Runnable() {
@Override
public void run() {
new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout();
}
},
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:28,代码来源:TkApp.java
示例9: make
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
private static Take make(Base base) {
return new TkAppFallback(
new TkSlf4j(
new TkForward(
new TkFork(
new FkRegex("/", "try /categories"),
new FkRegex("/categories", new TkFork(
new FkMethods("GET", new TkCategories(base)),
new FkMethods("POST,PUT", new TkCategoryAdd(base))
)),
new FkRegex("/categories/(?<number>[^/]+)", new TkFork(
new FkMethods("GET", new TkCategory(base)),
new FkMethods("POST,PUT", new TkCategoryUpdate(base)),
new FkMethods("DELETE", new TkCategoryDelete(base))
)),
new FkRegex("/products", new TkFork(
new FkMethods("GET", new TkProducts(base)),
new FkMethods("POST,PUT", new TkProductAdd(base))
)),
new FkRegex("/products/(?<number>[^/]+)", new TkFork(
new FkMethods("GET", new TkProduct(base)),
new FkMethods("POST,PUT", new TkProductUpdate(base)),
new FkMethods("DELETE", new TkProductDelete(base))
)),
new FkRegex("/categories/(?<number>[^/]+)/products", new TkFork(
new FkMethods("GET", new TkCategoryProducts(base)),
new FkMethods("POST,PUT", new TkCategoryProductsAdd(base))
)),
new FkRegex("/categories/(?<ctgId>[^/]+)/products/(?<prdId>[^/]+)", new TkFork(
new FkMethods("POST,PUT", new TkCategoryProductAdd(base)),
new FkMethods("DELETE", new TkCategoryProductDelete(base))
))
)
)
)
);
}
开发者ID:yaroska,项目名称:true_oop,代码行数:38,代码来源:TkApp.java
示例10: sendsRequestThroughToHome
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* TkRelay can send the request through.
* @throws Exception If some problem inside
*/
@Test
public void sendsRequestThroughToHome() throws Exception {
final Take target = new TkFork(
new FkRegex(
"/alpha/.*",
(Take) req -> new RsText(
new RqHref.Base(req).href().toString()
)
)
);
new FtRemote(target).exec(
home -> MatcherAssert.assertThat(
new RsPrint(
new TkRelay(new FkBase()).act(
TkRelayTest.fake(
home, "/alpha/%D0%B4%D0%B0?abc=cde"
)
)
).printBody(),
Matchers.equalTo(
String.format(
"%s/alpha/%%D0%%B4%%D0%%B0?abc=cde",
home
)
)
)
);
}
开发者ID:yegor256,项目名称:jare,代码行数:33,代码来源:TkRelayTest.java
示例11: TkRoot
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
public TkRoot(final Services services) {
super(
new TkSlf4j(
new TkFallback(
new TkFork(
new FkRegex("/health", new TkHealth()),
new FkRegex("/service(/.*)?", new TkServices(services))
),
new FbFixed(new RsWithStatus(new RsText("404 Not Found"), HttpURLConnection.HTTP_NOT_FOUND))
)
)
);
}
开发者ID:aliceice,项目名称:roster,代码行数:14,代码来源:TkRoot.java
示例12: act
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
@Override
public Response act(final RqRegex req) throws IOException {
String name = req.matcher().group("name");
String environment = req.matcher().group("environment");
return new TkFork(
new FkMethods("GET", getEndpoint(name, environment)),
new FkMethods("POST,PUT", register(name, environment)),
new FkMethods("DELETE", unregister(name, environment))
).act(req);
}
开发者ID:aliceice,项目名称:roster,代码行数:11,代码来源:TkServiceRequest.java
示例13: TkServices
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
public TkServices(final Services services) {
super(
new TkFork(
new FkRegex("/service/(?<name>.*)/(?<environment>.*)", new TkServiceRequest(services)),
new FkFixed(new TkAllServices(services))
)
);
}
开发者ID:aliceice,项目名称:roster,代码行数:9,代码来源:TkServices.java
示例14: act
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
return new TkFork(
new FkRegex("/", new TkRedirect("/f")),
new FkRegex(
"/about",
new TkHtml(App.class.getResource("about.html"))
),
new FkRegex("/robots.txt", ""),
new FkRegex("/f(.*)", new TkDir(this.home))
).act(request);
}
开发者ID:yegor256,项目名称:takes,代码行数:13,代码来源:App.java
示例15: logins
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* PsLinkedin can login.
* @throws IOException If some problem inside
*/
@Test
public void logins() throws IOException {
final String tokenpath = "/uas/oauth2/accessToken";
final String firstname = "firstName";
final String lastname = "lastName";
final String frodo = "Frodo";
final String baggins = "Baggins";
// @checkstyle MagicNumber (4 lines)
final String code = RandomStringUtils.randomAlphanumeric(10);
final String lapp = RandomStringUtils.randomAlphanumeric(10);
final String lkey = RandomStringUtils.randomAlphanumeric(10);
final String identifier = RandomStringUtils.randomAlphanumeric(10);
final Take take = new TkFork(
new FkRegex(
tokenpath,
new TokenTake(code, lapp, lkey, tokenpath)
),
new FkRegex(
"/v1/people",
new PeopleTake(identifier, firstname, lastname, frodo, baggins)
)
);
new FtRemote(take).exec(
new LinkedinScript(
code, lapp, lkey, identifier,
firstname, lastname, frodo, baggins
)
);
}
开发者ID:yegor256,项目名称:takes,代码行数:34,代码来源:PsLinkedinTest.java
示例16: consumesTwiceInputStreamWithRsText
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* FtBasic can consume twice the input stream in case of a RsText.
* @throws IOException If some problem inside
*/
@Test
public void consumesTwiceInputStreamWithRsText() throws IOException {
final String result = "Hello RsText!";
new FtRemote(
new TkFork(
new FkRegex(
FtBasicTest.ROOT_PATH,
new RsText(
new ByteArrayInputStream(
new Utf8String(result).bytes()
)
)
)
)
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
new JdkRequest(home)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.assertBody(Matchers.equalTo(result));
new JdkRequest(home)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.assertBody(Matchers.equalTo(result));
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:37,代码来源:FtBasicTest.java
示例17: consumesTwiceInputStreamWithRsHtml
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* FtBasic can consume twice the input stream in case of a RsHTML.
* @throws IOException If some problem inside
*/
@Test
public void consumesTwiceInputStreamWithRsHtml() throws IOException {
final String result = "Hello RsHTML!";
new FtRemote(
new TkFork(
new FkRegex(
FtBasicTest.ROOT_PATH,
new RsHtml(
new ByteArrayInputStream(
new Utf8String(result).bytes()
)
)
)
)
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
new JdkRequest(home)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.assertBody(Matchers.equalTo(result));
new JdkRequest(home)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.assertBody(Matchers.equalTo(result));
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:37,代码来源:FtBasicTest.java
示例18: correctlyMapsPathString
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* TkProxy can correctly maps path string.
* @throws Exception If some problem inside
* @checkstyle AnonInnerLengthCheck (100 lines)
*/
@Test
public void correctlyMapsPathString() throws Exception {
final Take take = new Take() {
@Override
public Response act(final Request req) throws IOException {
return new RsText(new RqHref.Base(req).href().toString());
}
};
new FtRemote(
new TkFork(
new FkMethods(this.method, take)
)
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
MatcherAssert.assertThat(
new RsPrint(
new TkProxy(home).act(
new RqFake(
TkProxyTest.this.method,
"/a/%D0%B0/c?%D0%B0=1#%D0%B0"
)
)
).printBody(),
Matchers.equalTo(
String.format(
"http://%s:%d/a/%%D0%%B0/c?%%D0%%B0=1",
home.getHost(), home.getPort()
)
)
);
}
}
);
}
开发者ID:yegor256,项目名称:takes,代码行数:42,代码来源:TkProxyTest.java
示例19: act
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
return new TkFork(
new FkRegex("/doc/read", new TkRead(this.base)),
new FkRegex("/doc/delete", new TkDelete(this.base)),
new FkRegex("/doc/write", new TkWrite(this.base)),
new FkRegex("/doc/add-friend", new TkAddFriend(this.base)),
new FkRegex("/doc/eject-friend", new TkEjectFriend(this.base)),
new FkRegex("/doc/set-visibility", new TkSetVisibility(this.base))
).act(req);
}
开发者ID:libreio,项目名称:libre,代码行数:12,代码来源:TkDoc.java
示例20: make
import org.takes.facets.fork.TkFork; //导入依赖的package包/类
/**
* Ctor.
* @param base Base
* @return Take
*/
private static Take make(final Base base) {
return new TkFork(
new FkDeck("", new TkIndex(base)),
new FkDeck("/help", new TkHelp(base)),
new FkDeck("/delete", new TkDelete(base)),
new FkDeck("/command", new TkCommand(base))
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:14,代码来源:TkDeck.java
注:本文中的org.takes.facets.fork.TkFork类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论