README and refactoring to scenario and Spring REST client

This commit is contained in:
Michael Hoennig 2024-10-24 16:04:55 +02:00
parent f7661b25dd
commit fde50a0454
24 changed files with 216 additions and 148 deletions

View File

@ -55,7 +55,7 @@ public class ArchitectureTest {
"..hs.office.coopshares", "..hs.office.coopshares",
"..hs.office.debitor", "..hs.office.debitor",
"..hs.office.membership", "..hs.office.membership",
"..hs.office.usecases..", "..hs.office.scenarios..",
"..hs.migration", "..hs.migration",
"..hs.office.partner", "..hs.office.partner",
"..hs.office.person", "..hs.office.person",
@ -98,7 +98,7 @@ public class ArchitectureTest {
public static final ArchRule testClassesAreProperlyNamed = classes() public static final ArchRule testClassesAreProperlyNamed = classes()
.that().haveSimpleNameEndingWith("Test") .that().haveSimpleNameEndingWith("Test")
.and().doNotHaveModifier(ABSTRACT) .and().doNotHaveModifier(ABSTRACT)
.should().haveNameMatching(".*(UnitTest|RestTest|IntegrationTest|AcceptanceTest|UseCasesTest|ArchitectureTest)$"); .should().haveNameMatching(".*(UnitTest|RestTest|IntegrationTest|AcceptanceTest|ScenarioTest|ArchitectureTest)$");
@ArchTest @ArchTest
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -1,20 +1,20 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.HsadminNgApplication;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateExternalDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateSelfDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateSepaMandataForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandataForDebitor;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteSepaMandataForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandataForDebitor;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.InvalidateSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor;
import net.hostsharing.hsadminng.hs.office.usecases.membership.CreateMembership; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership;
import net.hostsharing.hsadminng.hs.office.usecases.partner.AddOperationsContactToPartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddOperationsContactToPartner;
import net.hostsharing.hsadminng.hs.office.usecases.partner.CreatePartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteDebitor;
import net.hostsharing.hsadminng.hs.office.usecases.partner.DeletePartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.DeletePartner;
import net.hostsharing.hsadminng.hs.office.usecases.partner.AddRepresentativeToPartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddRepresentativeToPartner;
import net.hostsharing.hsadminng.hs.office.usecases.subscription.RemoveOperationsContactFromPartner; import net.hostsharing.hsadminng.hs.office.scenarios.subscription.RemoveOperationsContactFromPartner;
import net.hostsharing.hsadminng.hs.office.usecases.subscription.SubscribeToMailinglist; import net.hostsharing.hsadminng.hs.office.scenarios.subscription.SubscribeToMailinglist;
import net.hostsharing.hsadminng.hs.office.usecases.subscription.UnsubscribeFromMailinglist; import net.hostsharing.hsadminng.hs.office.scenarios.subscription.UnsubscribeFromMailinglist;
import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Order;
@ -29,7 +29,7 @@ import org.springframework.boot.test.context.SpringBootTest;
) )
@Tag("useCaseTest") @Tag("useCaseTest")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class HsOfficeUseCasesTest extends UseCaseTest { class HsOfficeScenarioTests extends ScenarioTest {
@Test @Test
@Order(1010) @Order(1010)

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import java.lang.invoke.SerializedLambda; import java.lang.invoke.SerializedLambda;
import java.lang.reflect.Method; import java.lang.reflect.Method;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;

View File

@ -0,0 +1,66 @@
# UseCase-Tests
We define UseCase-tests as test for business-scenarios.
They test positive (successful) scenarios by using the REST-API.
Running these tests also creates test-reports which can be used as documentation about the necessary REST-calls for each scenario.
Clarification: Acceptance tests also test at the REST-API level but are more technical and also test negative (error-) scenarios.
## ... extends ScenarioTest
Each test-method in subclasses of ScenarioTest describes a business-scenario,
each utilizing a main-use-case and given example data for the scenario.
To reduce the number of API-calls, intermediate results can be re-used.
This is controlled by two annotations:
### @Produces(....)
This annotation tells the test-runner that this scenario produces certain business object for re-use.
The UUID of the new business objects are stored in a key-value map using the provided keys.
There are two variants of this annotation:
#### A Single Business Object
```
@Produces("key")
```
This variant is used when there is just a single business-object produced by the use-case.
#### Multiple Business Objects
```
@Produces(explicitly = "main-key", implicitly = {"other-key", ...})
```
This variant is used when multiple business-objects are produced by the use-case,
e.g. a Relation, a Person and a Contact.
The UUID of the business-object produced by the main-use-case gets stored as the key after "explicitly",
the others are listed after "implicitly";
if there is just one, leave out the surrounding braces.
### @Requires(...)
This annotation tells the test-runner that which business objects are required before this scenario can run.
Each subset must be produced by the same producer-method.
## ... extends UseCase
These classes consist of two parts:
### Prerequisites of the Use-Case
The constructor may create prerequisites via `required(...)`.
These do not really belong to the use-case itself,
e.g. create business objects which, in the context of that use-case, would already exist.
This is similar to @Requires(...) just that no other test scenario produces this prerequisite.
Here, use-cases can be re-used, usually with different data.
### The Use-Case Itself
The use-case

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -32,7 +32,7 @@ import static java.util.Arrays.asList;
import static java.util.Optional.ofNullable; import static java.util.Optional.ofNullable;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
public abstract class UseCaseTest extends ContextBasedTest { public abstract class ScenarioTest extends ContextBasedTest {
final static String RUN_AS_USER = "superuser-alex@hostsharing.net"; // TODO.test: use global:AGENT when implemented final static String RUN_AS_USER = "superuser-alex@hostsharing.net"; // TODO.test: use global:AGENT when implemented
//String producesAlias; //String producesAlias;
@ -75,7 +75,7 @@ public abstract class UseCaseTest extends ContextBasedTest {
void print(final String output) { void print(final String output) {
// for tests executed due to @Requires/@Produces there is no markdownFile yet // for tests executed due to @Requires/@Produces there is no markdownFile yet
if (markdownFile != null) { if (markdownFile != null) {
markdownFile.println(output); markdownFile.print(output);
} }
} }
@ -108,7 +108,7 @@ public abstract class UseCaseTest extends ContextBasedTest {
final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow(); final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow();
final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow(); final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow();
markdownFile = new PrintWriter(new FileWriter(testMethodOrder + "-" + testMethodName + ".md")); markdownFile = new PrintWriter(new FileWriter(testMethodOrder + "-" + testMethodName + ".md"));
print("## Testcase: " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2")); print("## Scenario: " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2"));
} }
@SneakyThrows @SneakyThrows
@ -178,13 +178,13 @@ public abstract class UseCaseTest extends ContextBasedTest {
static Map<String, Object> knowVariables() { static Map<String, Object> knowVariables() {
final var map = new LinkedHashMap<String, Object>(); final var map = new LinkedHashMap<String, Object>();
UseCaseTest.aliases.forEach((key, value) -> map.put(key, value.uuid())); ScenarioTest.aliases.forEach((key, value) -> map.put(key, value.uuid()));
map.putAll(UseCaseTest.properties); map.putAll(ScenarioTest.properties);
return map; return map;
} }
static String resolve(final String text) { static String resolve(final String text) {
final var resolved = new TemplateResolver(text, UseCaseTest.knowVariables()).resolve(); final var resolved = new TemplateResolver(text, ScenarioTest.knowVariables()).resolve();
return resolved; return resolved;
} }

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import java.util.Map; import java.util.Map;

View File

@ -1,9 +1,6 @@
package net.hostsharing.hsadminng.hs.office.usecases; package net.hostsharing.hsadminng.hs.office.scenarios;
import io.restassured.RestAssured;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import io.restassured.response.Response;
import io.restassured.response.ValidatableResponse;
import net.hostsharing.hsadminng.reflection.AnnotationFinder; import net.hostsharing.hsadminng.reflection.AnnotationFinder;
import org.apache.commons.collections4.map.LinkedMap; import org.apache.commons.collections4.map.LinkedMap;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
@ -11,6 +8,9 @@ import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestClient;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -19,55 +19,53 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.platform.commons.util.StringUtils.isBlank; import static org.junit.platform.commons.util.StringUtils.isBlank;
import static org.junit.platform.commons.util.StringUtils.isNotBlank; import static org.junit.platform.commons.util.StringUtils.isNotBlank;
import static org.springframework.http.MediaType.APPLICATION_JSON;
public abstract class UseCase<T extends UseCase<?>> { public abstract class UseCase<T extends UseCase<?>> {
private final UseCaseTest testSuite; private static final RestClient restClient = RestClient.create();
private final ScenarioTest testSuite;
private final Map<String, Function<String, UseCase<?>>> requirements = new LinkedMap<>(); private final Map<String, Function<String, UseCase<?>>> requirements = new LinkedMap<>();
private final String resultAlias; private final String resultAlias;
private final Map<String, Object> givenProperties = new LinkedHashMap<>(); private final Map<String, Object> givenProperties = new LinkedHashMap<>();
private String nextTitle; // FIXME: ugly private String nextTitle; // FIXME: ugly
public UseCase(final UseCaseTest testSuite) { public UseCase(final ScenarioTest testSuite) {
this(testSuite, getResultAliasFromProducesAnnotationInCallStack()); this(testSuite, getResultAliasFromProducesAnnotationInCallStack());
} }
public UseCase(final UseCaseTest testSuite, final String resultAlias) { public UseCase(final ScenarioTest testSuite, final String resultAlias) {
this.testSuite = testSuite; this.testSuite = testSuite;
this.resultAlias = resultAlias; this.resultAlias = resultAlias;
if (resultAlias != null) { if (resultAlias != null) {
printLine("### UseCase: " + resultAlias); printPara("### UseCase " + title(resultAlias));
} }
} }
public final void requires(final String alias, final Function<String, UseCase<?>> useCaseFactory) { public final void requires(final String alias, final Function<String, UseCase<?>> useCaseFactory) {
if (!UseCaseTest.containsAlias(alias)) { if (!ScenarioTest.containsAlias(alias)) {
requirements.put(alias, useCaseFactory); requirements.put(alias, useCaseFactory);
} }
} }
public final HttpResponse doRun() { public final HttpResponse doRun() {
printLine("### Given Properties"); printPara("### Given Properties");
printLine(""" printLine("""
| name | value | | name | value |
|------|-------| |------|-------|""");
""".trim());
givenProperties.forEach((key, value) -> printLine("| " + key + " | " + value.toString().replace("\n", "<br>") + " |")); givenProperties.forEach((key, value) -> printLine("| " + key + " | " + value.toString().replace("\n", "<br>") + " |"));
printLine(""); printLine("");
requirements.forEach((alias, factory) -> factory.apply(alias).run().keep()); requirements.forEach((alias, factory) -> factory.apply(alias).run().keep());
// final var testMethodProduct = testInfo.getTestMethod().map(m -> m.getAnnotation(Produces.class).value()).orElseThrow();
return run(); return run();
} }
protected abstract HttpResponse run(); protected abstract HttpResponse run();
public final UseCase<T> given(final String propName, final Object propValue) { public final UseCase<T> given(final String propName, final Object propValue) {
givenProperties.put(propName, propValue); givenProperties.put(propName, propValue);
UseCaseTest.putProperty(propName, propValue); ScenarioTest.putProperty(propName, propValue);
return this; return this;
} }
@ -76,45 +74,43 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public final void keep(final String alias, final Supplier<HttpResponse> http) { public final void keep(final String alias, final Supplier<HttpResponse> http) {
this.nextTitle = UseCaseTest.resolve(alias); this.nextTitle = ScenarioTest.resolve(alias);
http.get().keep(); http.get().keep();
this.nextTitle = null; this.nextTitle = null;
} }
public final HttpResponse httpPost(final String uriPath, final JsonTemplate bodyJsonTemplate) { public final HttpResponse httpPost(final String uriPath, final JsonTemplate bodyJsonTemplate) {
final var body = bodyJsonTemplate.resolvePlaceholders(); final var body = bodyJsonTemplate.resolvePlaceholders();
final var uri = "http://localhost" + uriPath; final var response = restClient.post()
final var response = RestAssured.given() .uri("http://localhost:" + testSuite.port + uriPath)
.header("current-subject", UseCaseTest.RUN_AS_USER) .header("current-subject", ScenarioTest.RUN_AS_USER)
.contentType(ContentType.JSON) .contentType(APPLICATION_JSON)
.body(body) .body(body)
.port(testSuite.port) .retrieve();
.when().post(uri);
return new HttpResponse(HttpMethod.POST, uriPath, body, response); return new HttpResponse(HttpMethod.POST, uriPath, body, response);
} }
public final HttpResponse httpPatch(final String uriPath, final JsonTemplate bodyJsonTemplate) { public final HttpResponse httpPatch(final String uriPath, final JsonTemplate bodyJsonTemplate) {
final var body = bodyJsonTemplate.resolvePlaceholders(); final var body = bodyJsonTemplate.resolvePlaceholders();
final var uri = "http://localhost" + uriPath; final var response = restClient.patch()
final var response = RestAssured.given() .uri("http://localhost:" + testSuite.port + uriPath)
.header("current-subject", UseCaseTest.RUN_AS_USER) .header("current-subject", ScenarioTest.RUN_AS_USER)
.contentType(ContentType.JSON) .contentType(APPLICATION_JSON)
.body(body) .body(body)
.port(testSuite.port) .retrieve();
.when().patch(uri);
return new HttpResponse(HttpMethod.PATCH, uriPath, body, response); return new HttpResponse(HttpMethod.PATCH, uriPath, body, response);
} }
public final HttpResponse httpDelete(final String uriPath) { public final HttpResponse httpDelete(final String uriPath) {
final var response = RestAssured.given() final var response = restClient.delete()
.header("current-subject", UseCaseTest.RUN_AS_USER) .uri("http://localhost:" + testSuite.port + uriPath)
.port(testSuite.port) .header("current-subject", ScenarioTest.RUN_AS_USER)
.when().delete("http://localhost" + uriPath); .retrieve();
return new HttpResponse(HttpMethod.DELETE, uriPath, null, response); return new HttpResponse(HttpMethod.DELETE, uriPath, null, response);
} }
public final UUID uuid(final String alias) { public final UUID uuid(final String alias) {
return UseCaseTest.uuid(alias); return ScenarioTest.uuid(alias);
} }
public static class JsonTemplate { public static class JsonTemplate {
@ -126,63 +122,65 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
String resolvePlaceholders() { String resolvePlaceholders() {
return UseCaseTest.resolve(template); return ScenarioTest.resolve(template);
} }
} }
public class HttpResponse { public class HttpResponse {
private final ValidatableResponse response; private final ResponseEntity<String> response;
private final HttpStatus status; private final HttpStatusCode status;
private UUID locationUuid; private UUID locationUuid;
public HttpResponse( public HttpResponse(
final HttpMethod httpMethod, final HttpMethod httpMethod,
final String uri, final String uri,
final String requestBody, final String requestBody,
final Response response final RestClient.ResponseSpec responseSpec
) { ) {
final var validatableResponse = response.then(); response = responseSpec.toEntity(String.class);
this.response = validatableResponse.log().all().assertThat(); status = this.response.getStatusCode();
this.status = HttpStatus.valueOf(response.statusCode()); if (this.status.value() == HttpStatus.CREATED.value()) {
if (response.statusCode() == HttpStatus.CREATED.value()) { final var location = response.getHeaders().getLocation().toString();
final var location = validatableResponse.header("Location", startsWith("http://localhost")) assertThat(location).startsWith("http://localhost:");
.extract().header("Location");
locationUuid = UUID.fromString(location.substring(location.lastIndexOf('/') + 1)); locationUuid = UUID.fromString(location.substring(location.lastIndexOf('/') + 1));
} }
if (nextTitle != null) { if (nextTitle != null) {
print("\n### " + nextTitle + "\n"); printLine("\n### " + nextTitle + "\n");
} else if (resultAlias != null) { } else if (resultAlias != null) {
print("\n### " + resultAlias + "\n"); printLine("\n### " + resultAlias + "\n");
} }
print("```"); printLine("```");
print(httpMethod.name() + " " + uri); printLine(httpMethod.name() + " " + uri);
print(requestBody + "=> status: " + status + " " + printLine(requestBody + "=> status: " + status + " " +
(locationUuid != null ? locationUuid : "")); (locationUuid != null ? locationUuid : ""));
if (!status.is2xxSuccessful()) { if (!status.is2xxSuccessful()) {
print(response.getBody().prettyPrint()); printLine(responseSpec.body(String.class)); // FIXME: prettyPrint
} }
print("```"); printLine("```");
print(""); printLine("");
} }
public HttpResponse expecting(final HttpStatus httpStatus) { public HttpResponse expecting(final HttpStatus httpStatus) {
response.statusCode(httpStatus.value()); assertThat(HttpStatus.valueOf(response.getStatusCode().value())).isEqualTo(httpStatus);
return this; return this;
} }
public HttpResponse expecting(final ContentType contentType) { public HttpResponse expecting(final ContentType contentType) {
response.contentType(contentType); assertThat(response.getHeaders().getContentType())
.isNotNull()
.extracting(Object::toString)
.isEqualTo(contentType.toString());
return this; return this;
} }
public void keep() { public void keep() {
final var alias = nextTitle != null ? nextTitle : resultAlias; final var alias = nextTitle != null ? nextTitle : resultAlias;
assertThat(alias).as("cannot keep result, no alias found").isNotNull(); assertThat(alias).as("cannot keep result, no alias found").isNotNull();
UseCaseTest.putAlias( ScenarioTest.putAlias(
alias, alias,
new UseCaseTest.Alias<>(UseCase.this.getClass(), locationUuid)); new ScenarioTest.Alias<>(UseCase.this.getClass(), locationUuid));
} }
} }
@ -217,4 +215,8 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
throw new AssertionFailure("exactly one value required, but got '" + one + "' and '" + another + "'"); throw new AssertionFailure("exactly one value required, but got '" + one + "' and '" + another + "'");
} }
private final String title(String resultAlias) {
return getClass().getSimpleName().replaceAll("([a-z])([A-Z]+)", "$1 $2") + " => " + resultAlias;
}
} }

View File

@ -1,15 +1,15 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import net.hostsharing.hsadminng.hs.office.usecases.person.CreatePerson; import net.hostsharing.hsadminng.hs.office.scenarios.person.CreatePerson;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebitorForPartner> { public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebitorForPartner> {
public CreateExternalDebitorForPartner(final UseCaseTest testSuite) { public CreateExternalDebitorForPartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
requires("Person: Billing GmbH", alias -> new CreatePerson(testSuite, alias) requires("Person: Billing GmbH", alias -> new CreatePerson(testSuite, alias)

View File

@ -1,14 +1,14 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPartner> { public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPartner> {
public CreateSelfDebitorForPartner(final UseCaseTest testSuite, final String resultAlias) { public CreateSelfDebitorForPartner(final ScenarioTest testSuite, final String resultAlias) {
super(testSuite, resultAlias); super(testSuite, resultAlias);
} }

View File

@ -1,14 +1,14 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
public class CreateSepaMandataForDebitor extends UseCase<CreateSepaMandataForDebitor> { public class CreateSepaMandataForDebitor extends UseCase<CreateSepaMandataForDebitor> {
public CreateSepaMandataForDebitor(final UseCaseTest testSuite) { public CreateSepaMandataForDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,12 +1,12 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class DeleteDebitor extends UseCase<DeleteDebitor> { public class DeleteDebitor extends UseCase<DeleteDebitor> {
public DeleteDebitor(final UseCaseTest testSuite) { public DeleteDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite, alias) requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite, alias)

View File

@ -1,13 +1,13 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class DeleteSepaMandataForDebitor extends UseCase<DeleteSepaMandataForDebitor> { public class DeleteSepaMandataForDebitor extends UseCase<DeleteSepaMandataForDebitor> {
public DeleteSepaMandataForDebitor(final UseCaseTest testSuite) { public DeleteSepaMandataForDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,14 +1,14 @@
package net.hostsharing.hsadminng.hs.office.usecases.debitor; package net.hostsharing.hsadminng.hs.office.scenarios.debitor;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
public class InvalidateSepaMandateForDebitor extends UseCase<InvalidateSepaMandateForDebitor> { public class InvalidateSepaMandateForDebitor extends UseCase<InvalidateSepaMandateForDebitor> {
public InvalidateSepaMandateForDebitor(final UseCaseTest testSuite) { public InvalidateSepaMandateForDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,13 +1,13 @@
package net.hostsharing.hsadminng.hs.office.usecases.membership; package net.hostsharing.hsadminng.hs.office.scenarios.membership;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class CreateMembership extends UseCase<CreateMembership> { public class CreateMembership extends UseCase<CreateMembership> {
public CreateMembership(final UseCaseTest testSuite) { public CreateMembership(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.hs.office.usecases.partner; package net.hostsharing.hsadminng.hs.office.scenarios.partner;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED;
public class AddOperationsContactToPartner extends UseCase<AddOperationsContactToPartner> { public class AddOperationsContactToPartner extends UseCase<AddOperationsContactToPartner> {
public AddOperationsContactToPartner(final UseCaseTest testSuite) { public AddOperationsContactToPartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.hs.office.usecases.partner; package net.hostsharing.hsadminng.hs.office.scenarios.partner;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED;
public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartner> { public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartner> {
public AddRepresentativeToPartner(final UseCaseTest testSuite) { public AddRepresentativeToPartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,17 +1,17 @@
package net.hostsharing.hsadminng.hs.office.usecases.partner; package net.hostsharing.hsadminng.hs.office.scenarios.partner;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class CreatePartner extends UseCase<CreatePartner> { public class CreatePartner extends UseCase<CreatePartner> {
public CreatePartner(final UseCaseTest testSuite, final String resultAlias) { public CreatePartner(final ScenarioTest testSuite, final String resultAlias) {
super(testSuite, resultAlias); super(testSuite, resultAlias);
} }
public CreatePartner(final UseCaseTest testSuite) { public CreatePartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,12 +1,12 @@
package net.hostsharing.hsadminng.hs.office.usecases.partner; package net.hostsharing.hsadminng.hs.office.scenarios.partner;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class DeletePartner extends UseCase<DeletePartner> { public class DeletePartner extends UseCase<DeletePartner> {
public DeletePartner(final UseCaseTest testSuite) { public DeletePartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
requires("Partner: Delete AG", alias -> new CreatePartner(testSuite, alias) requires("Partner: Delete AG", alias -> new CreatePartner(testSuite, alias)

View File

@ -1,13 +1,13 @@
package net.hostsharing.hsadminng.hs.office.usecases.person; package net.hostsharing.hsadminng.hs.office.scenarios.person;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class CreatePerson extends UseCase<CreatePerson> { public class CreatePerson extends UseCase<CreatePerson> {
public CreatePerson(final UseCaseTest testSuite, final String resultAlias) { public CreatePerson(final ScenarioTest testSuite, final String resultAlias) {
super(testSuite, resultAlias); super(testSuite, resultAlias);
} }

View File

@ -1,13 +1,13 @@
package net.hostsharing.hsadminng.hs.office.usecases.subscription; package net.hostsharing.hsadminng.hs.office.scenarios.subscription;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.NO_CONTENT;
public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperationsContactFromPartner> { public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperationsContactFromPartner> {
public RemoveOperationsContactFromPartner(final UseCaseTest testSuite) { public RemoveOperationsContactFromPartner(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.hs.office.usecases.subscription; package net.hostsharing.hsadminng.hs.office.scenarios.subscription;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED;
public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> { public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
public SubscribeToMailinglist(final UseCaseTest testSuite) { public SubscribeToMailinglist(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -1,13 +1,13 @@
package net.hostsharing.hsadminng.hs.office.usecases.subscription; package net.hostsharing.hsadminng.hs.office.scenarios.subscription;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.NO_CONTENT;
public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailinglist> { public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailinglist> {
public UnsubscribeFromMailinglist(final UseCaseTest testSuite) { public UnsubscribeFromMailinglist(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }