当前位置: 首页>>代码示例>>Java>>正文


Java Method类代码示例

本文整理汇总了Java中org.glassfish.grizzly.http.Method的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Method类属于org.glassfish.grizzly.http包,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRps

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void testRps() {
    whenHttp(stubServer)
            .match(get("/"))
            .then(ok());

    int returnCode = runGatling(new String[]{
            "-r", "2",
            "-d", "3",
            "-u", "http://localhost:" + stubServer.getPort()
    });

    assertEquals(0, returnCode);

    // 1 automatic warm-up request
    // 6 gatling load request
    verifyHttp(stubServer).times(1 + 6,
            method(Method.GET),
            uri("/")
    );
}
 
开发者ID:scw1109,项目名称:jet-gatling,代码行数:22,代码来源:JetGatlingTest.java

示例2: testRps_withRamp

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void testRps_withRamp() {
    whenHttp(stubServer)
            .match(get("/"))
            .then(ok());

    int returnCode = runGatling(new String[]{
            "-r", "2",
            "-R", "5",
            "-d", "3",
            "-u", "http://localhost:" + stubServer.getPort()
    });

    assertEquals(0, returnCode);

    // 1 automatic warm-up request
    // 5+ ramp up request
    // 6 gatling load request
    verifyHttp(stubServer).atLeast(1 + 5 + 6,
            method(Method.GET),
            uri("/")
    );
}
 
开发者ID:scw1109,项目名称:jet-gatling,代码行数:24,代码来源:JetGatlingTest.java

示例3: testSuccessWithoutRetrying

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void testSuccessWithoutRetrying() throws Exception {

    whenHttp(server)
            .match(get("/v2/keys/foo"))
            .then(SUCCESS);

    try (EtcdClient etcd = new EtcdClient(serverURI)) {

        EtcdResponsePromise<EtcdKeysResponse> promise = etcd.get("foo")
                .setRetryPolicy(new RetryNTimes(1, 10))
                .send();

        EtcdKeysResponse resp = promise.get();

        assertThat(resp.node.value).isEqualTo("bar");
        assertThat(promise.getException()).isNull();

    }

    verifyHttp(server).once(
            method(Method.GET),
            uri("/v2/keys/foo")
    );
}
 
开发者ID:jurmous,项目名称:etcd4j,代码行数:26,代码来源:EtcdClientRetryPolicyTest.java

示例4: testSuccessAfterRetrying

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void testSuccessAfterRetrying() throws Exception {

    whenHttp(server)
            .match(get("/v2/keys/foo"))
            .then(sequence(FAILURE, SUCCESS));

    try (EtcdClient etcd = new EtcdClient(serverURI)) {

        EtcdResponsePromise<EtcdKeysResponse> promise = etcd.get("foo")
                .setRetryPolicy(new RetryNTimes(1, 10))
                .send();

        EtcdKeysResponse resp = promise.get();

        assertThat(resp.node.value).isEqualTo("bar");
        assertThat(promise.getException()).isNull();

    }

    verifyHttp(server).times(2,
            method(Method.GET),
            uri("/v2/keys/foo")
    );
}
 
开发者ID:jurmous,项目名称:etcd4j,代码行数:26,代码来源:EtcdClientRetryPolicyTest.java

示例5: createWps

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void createWps() throws Exception {
    whenHttp(server).match(put("/geoserver/rest/scripts/wps/buffer.groovy")).then(stringContent("true"), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    ScriptCommands commands = new ScriptCommands();
    commands.setGeoserver(geoserver);

    File file = File.createTempFile("buffer", ".groovy");
    FileWriter writer = new FileWriter(file);
    writer.write(getResourceString("script.groovy"));
    writer.close();

    boolean result = commands.createWps("buffer.groovy", file);
    assertTrue(result);

    verifyHttp(server).once(method(Method.PUT), uri("/geoserver/rest/scripts/wps/buffer.groovy"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:19,代码来源:ScriptCommandsTest.java

示例6: listLocalSettings

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void listLocalSettings() throws Exception {
    String url = "/geoserver/rest/workspaces/topp/settings.xml";
    whenHttp(server).match(get(url)).then(stringContent(getResourceString("localSettings.xml")), status(HttpStatus.OK_200));
    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    SettingsCommands commands = new SettingsCommands();
    commands.setGeoserver(geoserver);
    String actual = commands.listLocal("topp");
    String expected = "Settings" + OsUtils.LINE_SEPARATOR +
            "   Charset: UTF-8" + OsUtils.LINE_SEPARATOR +
            "   Number of Decimals: 4" + OsUtils.LINE_SEPARATOR +
            "   Online Resource: null" + OsUtils.LINE_SEPARATOR +
            "   Verbose: false" + OsUtils.LINE_SEPARATOR +
            "   Verbose Exceptions: false" + OsUtils.LINE_SEPARATOR +
            "" + OsUtils.LINE_SEPARATOR +
            "Contact" + OsUtils.LINE_SEPARATOR +
            "   City: null" + OsUtils.LINE_SEPARATOR +
            "   Country: null" + OsUtils.LINE_SEPARATOR +
            "   Type: work" + OsUtils.LINE_SEPARATOR +
            "   Email: null" + OsUtils.LINE_SEPARATOR +
            "   Organization: Work" + OsUtils.LINE_SEPARATOR +
            "   Name: John Doe" + OsUtils.LINE_SEPARATOR +
            "   Position: null" + OsUtils.LINE_SEPARATOR;
    assertEquals(expected, actual);
    verifyHttp(server).once(method(Method.GET), uri(url));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:27,代码来源:SettingsCommandsTest.java

示例7: createFunction

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void createFunction() throws Exception {
    whenHttp(server).match(put("/geoserver/rest/scripts/function/buffer.groovy")).then(stringContent("true"), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    ScriptCommands commands = new ScriptCommands();
    commands.setGeoserver(geoserver);

    File file = File.createTempFile("buffer", ".groovy");
    FileWriter writer = new FileWriter(file);
    writer.write(getResourceString("script.groovy"));
    writer.close();

    boolean result = commands.createFunction("buffer.groovy", file);
    assertTrue(result);

    verifyHttp(server).once(method(Method.PUT), uri("/geoserver/rest/scripts/function/buffer.groovy"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:19,代码来源:ScriptCommandsTest.java

示例8: modifyFunction

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void modifyFunction() throws Exception {
    whenHttp(server).match(put("/geoserver/rest/scripts/function/buffer.groovy")).then(stringContent("true"), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    ScriptCommands commands = new ScriptCommands();
    commands.setGeoserver(geoserver);

    File file = File.createTempFile("buffer", ".groovy");
    FileWriter writer = new FileWriter(file);
    writer.write(getResourceString("script.groovy"));
    writer.close();

    boolean result = commands.modifyFunction("buffer.groovy", file);
    assertTrue(result);

    verifyHttp(server).once(method(Method.PUT), uri("/geoserver/rest/scripts/function/buffer.groovy"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:19,代码来源:ScriptCommandsTest.java

示例9: manifestGet

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void manifestGet() throws Exception {
    whenHttp(server).match(get("/geoserver/rest/about/manifests.xml")).then(stringContent(getResourceString("manifests.xml")), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    AboutCommands commands = new AboutCommands();
    commands.setGeoserver(geoserver);
    String actual = commands.manifestGet("gt-xsd-ows-9.1");
    String expected = "gt-xsd-ows-9.1" + OsUtils.LINE_SEPARATOR +
            "   Manifest-Version: 1.0" + OsUtils.LINE_SEPARATOR +
            "   Archiver-Version: Plexus Archiver" + OsUtils.LINE_SEPARATOR +
            "   Built-By: jetty" + OsUtils.LINE_SEPARATOR +
            "   Build-Timestamp: 20-Apr-2013 11:03" + OsUtils.LINE_SEPARATOR +
            "   Git-Revision: f25b08094d1bf7e0949994f4971bc21fb117d37b" + OsUtils.LINE_SEPARATOR +
            "   Build-Jdk: 1.6.0_22" + OsUtils.LINE_SEPARATOR +
            "   Project-Version: 9.1" + OsUtils.LINE_SEPARATOR +
            "   Created-By: Apache Maven" + OsUtils.LINE_SEPARATOR;
    assertEquals(expected, actual);

    verifyHttp(server).once(method(Method.GET), uri("/geoserver/rest/about/manifests.xml"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:22,代码来源:AboutCommandsTest.java

示例10: createApp

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void createApp() throws Exception {
    whenHttp(server).match(put("/geoserver/rest/scripts/apps/buffer/main.groovy")).then(stringContent("true"), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    ScriptCommands commands = new ScriptCommands();
    commands.setGeoserver(geoserver);

    File file = File.createTempFile("buffer", ".groovy");
    FileWriter writer = new FileWriter(file);
    writer.write(getResourceString("script.groovy"));
    writer.close();

    boolean result = commands.createApp("buffer", "groovy", file);
    assertTrue(result);

    verifyHttp(server).once(method(Method.PUT), uri("/geoserver/rest/scripts/apps/buffer/main.groovy"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:19,代码来源:ScriptCommandsTest.java

示例11: modifyApp

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void modifyApp() throws Exception {
    whenHttp(server).match(put("/geoserver/rest/scripts/apps/buffer/main.groovy")).then(stringContent("true"), status(HttpStatus.OK_200));

    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    ScriptCommands commands = new ScriptCommands();
    commands.setGeoserver(geoserver);

    File file = File.createTempFile("buffer", "groovy");
    FileWriter writer = new FileWriter(file);
    writer.write(getResourceString("script.groovy"));
    writer.close();

    boolean result = commands.modifyApp("buffer", "groovy", file);
    assertTrue(result);

    verifyHttp(server).once(method(Method.PUT), uri("/geoserver/rest/scripts/apps/buffer/main.groovy"));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:19,代码来源:ScriptCommandsTest.java

示例12: createLayerGroup

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void createLayerGroup() throws Exception {
    String url = "/geoserver/rest/layergroups.xml";
    whenHttp(server).match(post(url)).then(stringContent("true"), status(HttpStatus.OK_200));
    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    LayerGroupCommands commands = new LayerGroupCommands();
    commands.setGeoserver(geoserver);
    String name = "census";
    String layers = "tracts,block groups,blocks";
    String styles = "";
    String workspace = null;
    boolean result = commands.create(name, layers, styles, workspace);
    assertTrue(result);
    String actual = server.getCalls().get(0).getPostBody();
    String expected = "<layerGroup><name>census</name><layers><layer>tracts</layer><layer>block groups</layer>" +
            "<layer>blocks</layer></layers><styles></styles></layerGroup>";
    assertEquals(expected, actual);
    verifyHttp(server).once(method(Method.POST), uri(url));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:20,代码来源:LayerGroupCommandsTest.java

示例13: createLayerGroupWithWorspace

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void createLayerGroupWithWorspace() throws Exception {
    String url = "/geoserver/rest/workspaces/topp/layergroups.xml";
    whenHttp(server).match(post(url)).then(stringContent("true"), status(HttpStatus.OK_200));
    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    LayerGroupCommands commands = new LayerGroupCommands();
    commands.setGeoserver(geoserver);
    String name = "census";
    String layers = "tracts,block groups,blocks";
    String styles = "tracts,block groups, blocks";
    String workspace = "topp";
    boolean result = commands.create(name, layers, styles, workspace);
    assertTrue(result);
    String actual = server.getCalls().get(0).getPostBody();
    String expected = "<layerGroup><name>census</name><layers><layer>tracts</layer><layer>block groups</layer>" +
            "<layer>blocks</layer></layers><styles><style>tracts</style><style>block groups</style>" +
            "<style>blocks</style></styles></layerGroup>";
    assertEquals(expected, actual);
    verifyHttp(server).once(method(Method.POST), uri(url));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:21,代码来源:LayerGroupCommandsTest.java

示例14: modifyLayerGroupWithWorkspace

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void modifyLayerGroupWithWorkspace() throws Exception {
    String url = "/geoserver/rest/workspaces/topp/layergroups/census.xml";
    whenHttp(server).match(put(url)).then(stringContent("true"), status(HttpStatus.OK_200));
    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    LayerGroupCommands commands = new LayerGroupCommands();
    commands.setGeoserver(geoserver);
    String name = "census";
    String layers = "tracts,block groups,blocks";
    String styles = "tracts,block groups,blocks";
    String workspace = "topp";
    boolean result = commands.modify(name, layers, styles, workspace);
    assertTrue(result);
    String actual = server.getCalls().get(0).getPostBody();
    String expected = "<layerGroup><name>census</name><layers><layer>tracts</layer><layer>block groups</layer>" +
            "<layer>blocks</layer></layers><styles><style>tracts</style><style>block groups</style>" +
            "<style>blocks</style></styles></layerGroup>";
    assertEquals(expected, actual);
    verifyHttp(server).once(method(Method.PUT), uri(url));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:21,代码来源:LayerGroupCommandsTest.java

示例15: getLayer

import org.glassfish.grizzly.http.Method; //导入依赖的package包/类
@Test
public void getLayer() throws Exception {
    String url = "/geoserver/rest/layers/streams.xml";
    whenHttp(server).match(get(url)).then(stringContent(getResourceString("layer.xml")), status(HttpStatus.OK_200));
    Geoserver geoserver = new Geoserver("http://00.0.0.0:8888/geoserver", "admin", "geoserver");
    LayerCommands commands = new LayerCommands();
    commands.setGeoserver(geoserver);
    String actual = commands.get("streams");
    String expected = "streams" + OsUtils.LINE_SEPARATOR +
            "   Title: null" + OsUtils.LINE_SEPARATOR +
            "   Type: VECTOR" + OsUtils.LINE_SEPARATOR +
            "   Abstract: null" + OsUtils.LINE_SEPARATOR +
            "   Default Style: simple_streams" + OsUtils.LINE_SEPARATOR +
            "   Namespace:    Type String: VECTOR" + OsUtils.LINE_SEPARATOR;
    assertEquals(expected, actual);
    verifyHttp(server).once(method(Method.GET), uri(url));
}
 
开发者ID:jericks,项目名称:geoserver-shell,代码行数:18,代码来源:LayerCommandsTest.java


注:本文中的org.glassfish.grizzly.http.Method类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。