<commit_before>package com.progressoft.brix.domino.test.api;

import com.progressoft.brix.domino.api.server.DominoLoader;
import com.progressoft.brix.domino.api.server.RouterConfigurator;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.Router;
import org.junit.rules.ExternalResource;

public class DominoServerRule extends ExternalResource{

    private final Vertx vertx;
    private int actualPort;
    private Router router;
    private JsonObject config;

    public DominoServerRule(Vertx vertx) {
        this.vertx = vertx;
    }

    public void onBeforeDominoLoad(Router router, JsonObject config){
        //can be implemented by the test case if needed
    }

    @Override
    protected void before() throws Throwable {
        RouterConfigurator routerConfigurator=new RouterConfigurator(vertx);
        router = routerConfigurator.configuredRouter();
        config = new JsonObject().put("http.port", 0);
        onBeforeDominoLoad(router, config);
        new DominoLoader(vertx, router, config).start(server -> actualPort=server.result().actualPort());
        onAfterDominoLoad(router, config);
    }

    public void onAfterDominoLoad(Router router, JsonObject config){
        //can be implemented by the test case if needed
    }

    public Vertx getVertx() {
        return vertx;
    }

    public Router getRouter() {
        return router;
    }

    public JsonObject getConfig() {
        return config;<commit_msg>compose domino rule with vertx rule<commit_after>package com.progressoft.brix.domino.test.api;

import com.progressoft.brix.domino.api.server.DominoLoader;
import com.progressoft.brix.domino.api.server.RouterConfigurator;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.unit.junit.RunTestOnContext;
import io.vertx.ext.web.Router;
import org.junit.rules.ExternalResource;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

public class DominoServerRule extends ExternalResource{

    private int actualPort;
    private Router router;
    private JsonObject config;
    private final RunTestOnContext vertxRule;

    public DominoServerRule(RunTestOnContext vertxRule) {
        this.vertxRule = vertxRule;
    }

    @Override
    public Statement apply(Statement base, Description description) {
        return super.apply(base, description);
    }

    public void onBeforeDominoLoad(Router router, JsonObject config){
        //can be implemented by the test case if needed
    }

    @Override
    protected void before() throws Throwable {
        RouterConfigurator routerConfigurator=new RouterConfigurator(vertxRule.vertx());
        router = routerConfigurator.configuredRouter();
        config = new JsonObject().put("http.port", 0);
        onBeforeDominoLoad(router, config);
        new DominoLoader(vertxRule.vertx(), router, config).start(server -> actualPort=server.result().actualPort());
        onAfterDominoLoad(router, config);
    }

    public void onAfterDominoLoad(Router router, JsonObject config){
        //can be implemented by the test case if needed
    }

    public Vertx getVertx() {
        return vertxRule.vertx();
    }

    public Router getRouter() {
        return router;
    }

    public JsonObject getConfig() {
        return config;
{'fraction_non_alphanumeric': 0.08908218356328734, 'fraction_numerical': 0.0005998800239952009, 'mean_word_length': 3.4885598923283982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4945734', 'n_tokens_mistral': 964, 'n_tokens_neox': 939, 'n_words': 232}