WebClient
usable to access the API.
- *
- * @param vertx The Vertx
instance to start and access the server
- * @param testContext The TestContext
to create a new Server and WebClient
- * @param mongoDatabase The Mongo database to store the test data to
- * @param resultHandler The handler called after this server has finished starting
- * @param verticleClassName The name of the {@code ApiVerticle} to deploy
- * @throws IOException If the server port could not be opened
- */
- @SuppressWarnings("unused") // Part of the API
- public void start(final Vertx vertx, final VertxTestContext testContext, final TestMongoDatabase mongoDatabase,
- final String verticleClassName, final HandlerWebClient
usable to access the API.
- *
- * @param vertx The Vertx
instance to start and access the server
- * @param testContext The TestContext
to create a new Server and WebClient
- * @param mongoDatabase The Mongo database to store the test data to
- * @param resultHandler The handler called after this server has finished starting
- * @param verticleClassName The name of the {@code ApiVerticle} to deploy
- * @param config A {@code JsonObject} which contains custom config parameters to be used when deploying the verticle
- * @throws IOException If the server port could not be opened
- */
- public void start(final Vertx vertx, final VertxTestContext testContext, final TestMongoDatabase mongoDatabase,
- final String verticleClassName, final JsonObject config,
- final HandlerWebClient
to use
- * @param endpoint The service endpoint to call to get some data
- * @param testContext The VertxTextContext
provided by the current test case
- * @param headers Additional headers to add to the request.
- * @param resultHandler A handler provided with the result of the get request
- */
- @SuppressWarnings("unused") // Part of the API
- public void get(final WebClient client, final String endpoint, final VertxTestContext testContext,
- final MultiMap headers, final HandlerWebClient
to use
- * @param endpoint The service endpoint to call to get some data
- * @param body The body to post
- * @param testContext The VertxTextContext
provided by the current test case
- * @param resultHandler A handler provided with the result of the get request
- */
- @SuppressWarnings("unused") // Part of the API
- public void postUnauthorized(final WebClient client, final String endpoint, final JsonObject body,
- final VertxTestContext testContext, final HandlerWebClient
to use
- * @param endpoint The service endpoint to call to get some data
- * @param testContext The VertxTextContext
provided by the current test case
- * @param resultHandler A handler provided with the result of the get request
- */
- @SuppressWarnings("unused") // Part of the API
- public void getUnauthorized(final WebClient client, final String endpoint, final VertxTestContext testContext,
- final HandlerWebClient
to simulate client requests.
- */
- private WebClient webClient;
-
- /**
- * Create a new object of this class and starting the simulated server.
- * To do anything meaningful with it, you need to add some test data via
- * {@link #insertFixture(TestFixture)}.
- * ATTENTION: Do not forget to call {@link #shutdown()} after you finished using this object, for example in
- * an org.junit.jupiter.api.AfterEach
method.
- *
- * @param vertx A Vertx
instance to set up the test environment
- * @param testContext The Vertx-JUnit test context used to synchronize the JUnit lifecycle with Vertx
- * @param resultHandler Called after the environment has finished setting up
- * @param verticleClassName The name of the {@code ApiVerticle} to deploy
- * @param httpEndpointParameterKey The parameter key required to be passed to the {@code Config} of the test
- * {@code ApiVerticle}.
- * @param httpEndpoint The endpoint on which the test {@code ApiVerticle} listens to.
- * @throws IOException If the temporary Mongo database fails to start
- */
- @SuppressWarnings("unused") // Part of the API
- public TestEnvironment(final Vertx vertx, final VertxTestContext testContext,
- final Handlerorg.junit.jupiter.api.AfterEach
method.
- *
- * @param vertx A Vertx
instance to set up the test environment
- * @param testContext The Vertx-JUnit test context used to synchronize the JUnit lifecycle with Vertx
- * @param resultHandler Called after the environment has finished setting up
- * @param verticleClassName The name of the {@code ApiVerticle} to deploy
- * @param httpEndpointParameterKey The parameter key required to be passed to the {@code Config} of the test
- * {@code ApiVerticle}.
- * @param httpEndpoint The endpoint on which the test {@code ApiVerticle} listens to.
- * @param config A {@code JsonObject} which contains custom config parameters to be used when deploying the verticle
- * @throws IOException If the temporary Mongo database fails to start
- */
- public TestEnvironment(final Vertx vertx, final VertxTestContext testContext,
- final HandlerAfterEach
method.
- */
- @SuppressWarnings("unused") // API
- public void shutdown() {
- testMongoDatabase.stop();
- }
-
- /**
- * @return A handle to the Cyface exporter server running within this environment
- */
- @SuppressWarnings("unused") // API
- public ApiServer getApiServer() {
- return apiServer;
- }
-
- /**
- * @return The WebClient
to simulate client requests
- */
- @SuppressWarnings("unused") // API
- public WebClient getWebClient() {
- return webClient;
- }
-
- /**
- * @return The client to be used to access the test Mongo database.
- */
- public MongoClient getMongoClient() {
- return mongoClient;
- }
-}
diff --git a/api-test-environment/src/main/java/de/cyface/apitestutils/TestMongoDatabase.java b/api-test-environment/src/main/java/de/cyface/apitestutils/TestMongoDatabase.java
deleted file mode 100644
index 5b794f7..0000000
--- a/api-test-environment/src/main/java/de/cyface/apitestutils/TestMongoDatabase.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 20180-2022 Cyface GmbH
- *
- * This file is part of the Cyface API Library.
- *
- * The Cyface API Library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The Cyface API Library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with the Cyface API Library. If not, see MongodProcess
. This must be shut down after finishing this Mongo database
- * run.
- */
- private MongodExecutable mongodExecutable;
- /**
- * The host at which the mongo database is to be started.
- */
- static final String MONGO_HOST = "localhost";
- /**
- * The name of the test Mongo database to create.
- */
- static final String MONGO_DATABASE = "cyface";
- /**
- * The port to run the test Mongo database under.
- */
- private int port;
-
- /**
- * Sets up the Mongo database used for the test instance.
- *
- * @throws IOException Fails the test if anything unexpected goes wrong
- */
- public void start() throws IOException {
- final var socket = new ServerSocket(0);
- port = socket.getLocalPort();
- socket.close();
- final var starter = MongodStarter.getDefaultInstance();
- final var mongodConfig = MongodConfig.builder().version(Version.Main.PRODUCTION)
- .net(new Net(MONGO_HOST, port, Network.localhostIsIPv6())).build();
- mongodExecutable = starter.prepare(mongodConfig);
- mongo = mongodExecutable.start();
- }
-
- /**
- * Provides the database configuration as required by Vertx.
- *
- * @return The database configuration
- */
- public JsonObject config() {
- final JsonObject ret = new JsonObject();
- ret.put("connection_string", "mongodb://" + MONGO_HOST + ":" + port).put("db_name", MONGO_DATABASE);
- return ret;
- }
-
- /**
- * Stops the test Mongo database after all tests have been finished and waits a little so that a new test may
- * restart the database, without interference.
- */
- public void stop() {
- mongo.stop();
- mongodExecutable.stop();
- }
-}
diff --git a/api-test-environment/src/main/java/de/cyface/apitestutils/TestParameters.java b/api-test-environment/src/main/java/de/cyface/apitestutils/TestParameters.java
deleted file mode 100644
index 030468f..0000000
--- a/api-test-environment/src/main/java/de/cyface/apitestutils/TestParameters.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2019-2022 Cyface GmbH
- *
- * This file is part of the Cyface API Library.
- *
- * The Cyface API Library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The Cyface API Library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with the Cyface API Library. If not, see - * The current semantic of the manager role is the following: - * The users with the role "myGroup_manager" can access data of all users with role - * "myGroup"+{@code #USER_GROUP_ROLE_PREFIX} - */ - public static final String GROUP_MANAGER_ROLE_SUFFIX = "_manager"; - /** - * The prefix for user roles which define a user "group" as there is no such thing in the vertx mongo auth provider. - *
- * The current semantic of the user role is the following:
- * The user data of all users with the role "myGroup_user" can be accessed by users with role
- * "myGroup"+{@code #GROUP_MANAGER_ROLE_PREFIX}
- */
- public static final String USER_GROUP_ROLE_SUFFIX = "_user";
- /**
- * The database collection name.
- */
- public static final String COLLECTION_FILES = "fs.files";
- /**
- * The database collection name.
- */
- public static final String COLLECTION_CHUNKS = "fs.chunks";
- /**
- * The database field name used to annotate the owner of data by its user id.
- */
- public static final String USER_ID_FIELD = "userId";
- /**
- * The database field name.
- */
- public static final String METADATA_FIELD = "metaData";
- /**
- * The database field name.
- */
- public static final String METADATA_DEVICE_ID_FIELD = "deviceId";
- /**
- * The database field name used to annotate the device type in the metadata.
- */
- public static final String METADATA_DEVICE_TYPE_FIELD = "deviceType";
- /**
- * The database field name used to annotate the os version in the metadata.
- */
- public static final String METADATA_OS_VERSION_FIELD = "osVersion";
- /**
- * The database field name used to annotate the app version in the metadata.
- */
- public static final String METADATA_APP_VERSION_FIELD = "appVersion";
- /**
- * The database field name used to annotate the length of the measurement in the metadata.
- */
- public static final String METADATA_LENGTH_FIELD = "length";
- /**
- * The database field name used to annotate the version of the metadata format.
- */
- public static final String METADATA_VERSION_FIELD = "version";
- /**
- * The database field name.
- */
- public static final String METADATA_MEASUREMENT_ID_FIELD = "measurementId";
- /**
- * The database field name used to annotate the track bucket of a measurement in the deserialized collection.
- */
- public static final String DESERIALIZED_TRACK_FIELD = "track";
- /**
- * The database field name.
- */
- public static final String ID_FIELD = "_id";
- /**
- * The database field name.
- */
- public static final String CHUNKS_FILES_ID_FIELD = "files_id";
- /**
- * The database field name.
- */
- public static final String CHUNKS_DATA_FIELD = "data";
- /**
- * The database field name.
- */
- public static final String CHUNKS_DATA_BINARY_FIELD = "$binary";
- /**
- * The file extension of Compressed Cyface "Events" binary files.
- */
- public static final String METADATA_FILE_TYPE_CCYF = "ccyf";
-}
diff --git a/api-test-environment/src/main/java/de/cyface/apitestutils/fixture/GeoLocationTestFixture.java b/api-test-environment/src/main/java/de/cyface/apitestutils/fixture/GeoLocationTestFixture.java
deleted file mode 100644
index f8abb8b..0000000
--- a/api-test-environment/src/main/java/de/cyface/apitestutils/fixture/GeoLocationTestFixture.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2020-2023 Cyface GmbH
- *
- * This file is part of the Cyface API Library.
- *
- * The Cyface API Library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The Cyface API Library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with the Cyface API Library. If not, see
- * Inserts a test {@link DatabaseConstants#GROUP_MANAGER_ROLE_SUFFIX} user and a test - * {@link DatabaseConstants#USER_GROUP_ROLE_SUFFIX} user and references the group user as data owner in the created - * data fixtures. - *
- * {@link #insertTestData(MongoClient)} returns the user identifier of that data owner.
- *
- * @author Klemens Muthmann
- * @author Armin Schnabel
- * @version 5.0.0
- * @since 1.0.0
- */
-@SuppressWarnings("unused") // API
-public final class GeoLocationTestFixture implements TestFixture {
- /**
- * The name of the test group to export test data of.
- */
- private static final String TEST_GROUP = "testGroup";
- /**
- * The name of the user to add test data for in group-data accessing tests.
- */
- public static final String TEST_GROUP_USER_USERNAME = TEST_GROUP + "1";
- /**
- * The user which is used for authentication in the test.
- */
- public static final String TEST_USER_NAME = "admin";
- /**
- * The identifiers of the measurements to be used during the test.
- */
- private final ListresultHandler
after completion.
- *
- * @param mongoClient The client to use to insert the data into the Mongo database
- * @return a {@code FuturemongoClient
.
- *
- * @param mongoClient The client to access the Mongo database hosting the test data
- * @return A {@code Future} which is resolved after inserting the data has completed
- */
- Future