小编soh*_*ail的帖子

Kendo Grid在创建后不会使用新创建的id更新网格

我正在尝试构建一个非常简单的Kendo CRUD网格,其中一个表只有两列:ID和Name.我已经使用serverside分页和服务器端过滤配置了网格.

一切似乎都按预期运行,但在创建新记录后,网格显示新记录但没有ID字段.在创建时,请求的ID为null,但我在创建后发送id和完整对象的值.在示例网格中,网格使用新值进行更新.我需要更改/添加什么来确保新创建的记录的ID也显示在Grid中?

以下是JSP:

        <script>


        $(function() {
            var dataSource =  new kendo.data.DataSource({
                transport: {
                    read: {
                        url:"http://localhost:8181/baseweb/countrylist",
                        dataType: "jsonp"
                    },
                    update: {
                        url: "http://localhost:8181/baseweb/countryupdate",
                        dataType: "jsonp"
                    },    
                    destroy: {
                        url: "http://localhost:8181/baseweb/countrydelete",
                        dataType: "jsonp"
                    }, 
                    create: {
                        url: "http://localhost:8181/baseweb/countrycreate",
                        dataType: "jsonp"
                    },                        
                    parameterMap: function(data, operation) {
                        if (operation !== "read" && data.models) {
                            return {grid_options: kendo.stringify(data.models)};
                        }
                        return {grid_options: kendo.stringify(data)};
                    }                       
                },
                serverPaging: true,
                serverFiltering: true,
                pageSize: 10,
                schema: {
                    data: "data",        
                    total: "total",                     
                    model: {
                        id: "id",
                        fields: {
                            id: …
Run Code Online (Sandbox Code Playgroud)

kendo-ui kendo-grid

11
推荐指数
2
解决办法
1万
查看次数

在 Junit 测试中将 RestAssured 日志记录到 Log4J

我们正在使用 REST Assured 来测试一些 REST 服务。我们需要将请求和响应日志记录重定向到 Log4j 日志。我们有以下代码来尝试测试日志重定向:

public class RestTest {
    private static RequestSpecification spec;
    private static Logger logger = LogManager.getLogger(RestTest.class);
    @Rule
    public TestWatcher watcher = new Log4JWatcher();

    @BeforeClass
    public static void initSpec(){
    PrintStream logStream = IoBuilder.forLogger(logger).buildPrintStream();
    RestAssuredConfig restAssuredConfig = new RestAssuredConfig();
    LogConfig logConfig = restAssuredConfig.getLogConfig(); 
    logConfig
        .defaultStream(logStream)
        .enablePrettyPrinting(true);

    spec = new RequestSpecBuilder()
        .setContentType(ContentType.JSON)
            .setBaseUri("http://jsonplaceholder.typicode.com/")
            .addFilter(new ResponseLoggingFilter())
            .addFilter(new RequestLoggingFilter())
            .setConfig(restAssuredConfig)
            .build();
    
}

@Test
public void useSpec(){
    given()
        .spec(spec)
        .param("limit", 20)
        .when()
        .get("posts")
        .then()
        .statusCode(200);
    }
}
Run Code Online (Sandbox Code Playgroud)

我们将以下日志输出到 log4j 文件中: …

logging log4j rest-assured

3
推荐指数
1
解决办法
6666
查看次数

ChromeDriver 无法在 Selenium Java 中添加性能日志记录

我查看了 stackoverflow 上有关此主题的网络搜索结果和答案,但找不到任何人有相同的问题。以下是我正在使用的启用性能日志记录的代码:

    ChromeOptions options = new ChromeOptions();

    // options.addArguments("--headless");
    options.addArguments("--remote-debugging-port=9222");
    options.addArguments("--no-sandbox");
    options.addArguments("--disable-application-cache");
    options.addArguments("--disable-notifications");
    options.addArguments("--disable-dev-shm-usage");
    options.addArguments("--disable-extensions");
    options.addArguments("--test-type");
    options.addArguments("start-maximized");
    options.addArguments("disable-infobars");
    //options.addArguments("user-data-dir=C:\\apps\\selenium\\chrome\\data");
    options.setExperimentalOption("useAutomationExtension", false);
    options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));

    // add Network logging
    LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
    options.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);

    Map<String, Object> perfLogPrefs = new HashMap<String, Object>();
    perfLogPrefs.put("enableNetwork", true);
    perfLogPrefs.put("traceCategories", "devtools.network");
    options.setExperimentalOption("perfLoggingPrefs", perfLogPrefs);

    webDriver = new ChromeDriver(options);

    webDriver.manage().deleteAllCookies();
    webDriver.manage().window().maximize();
Run Code Online (Sandbox Code Playgroud)

执行时,出现如下错误:

    Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 27252
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to …
Run Code Online (Sandbox Code Playgroud)

java selenium-chromedriver

3
推荐指数
1
解决办法
5187
查看次数