小编Cha*_*cer的帖子

哪里可以获得Elasticsearch盾牌?

当我开始kibana时,我得到以下异常:

LicenseExpiredException[license expired for feature [shield]]
Run Code Online (Sandbox Code Playgroud)

我检查了文件,发现:

第一次启动节点时,将自动创建30天的试用许可证,这将使Shield能够完全运行.在这30天内,您将能够将另一个试用许可证替换为将在购买时提供给您的试用许可证.

盾不是免费软件吗?我在哪里可以购买许可证?我在文件中找不到它.

elasticsearch

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

在try-with-resources声明期间抛出异常

假设我在Java中有以下try-with-resources语句:

try (MyResource myResource1 = new MyResource(); MyResource myResource2 = new MyResource()) {
    // do stuff...
}
Run Code Online (Sandbox Code Playgroud)

如果MyResource myResource2 = new MyResource()抛出异常,是否可以保证myResource1.close()将被调用?

java try-with-resources

6
推荐指数
1
解决办法
1867
查看次数

如何创建接受来自其他匹配器的参数的自定义 ArgumentMatcher?

我目前正在在ActionEvent内部使用大量's的代码库上编写单元测试,并且由于ActionEvent没有覆盖equals(),我正在创建一个自定义ArgumentMatcher来匹配ActionEvent's。

ArgumentMatcher目前看起来像这样:

public class ActionEventMatcher extends ArgumentMatcher<ActionEvent> {
    private Object source;
    private int id;
    private String actionCommand;

    public ActionEventMatcher(Object source, int id, String actionCommand) {
        this.source = source;
        this.id = id;
        this.actionCommand = actionCommand;
    }

    @Override
    public boolean matches(Object argument) {
        if (!(argument instanceof ActionEvent))
            return false;
        ActionEvent e = (ActionEvent)argument;

        return source.equals(e.getSource()) &&
            id == e.getId() && actionCommand.equals(e.getActionCommand());
    }
}
Run Code Online (Sandbox Code Playgroud)

我想知道是否可以更改我的ArgumentMatcher以便它接受从其他匹配器创建的参数。例如,如果我调用了actionEvent()一个返回匹配器的方法,我希望能够执行以下操作:

verify(mock).fireEvent(argThat(actionEvent(same(source), anyInt(), …
Run Code Online (Sandbox Code Playgroud)

java mockito

6
推荐指数
1
解决办法
7995
查看次数

标签 统计

java ×2

elasticsearch ×1

mockito ×1

try-with-resources ×1