Compare commits
No commits in common. "47ba0cadb650540c39a807d5c816444899843980" and "bc099ada40000096bcfd96db6e1517cdad290187" have entirely different histories.
47ba0cadb6
...
bc099ada40
@ -95,7 +95,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
||||
return new JsonTemplate(jsonTemplate);
|
||||
}
|
||||
|
||||
public final void obtain(
|
||||
public final void keep(
|
||||
final String alias,
|
||||
final Supplier<HttpResponse> http,
|
||||
final Function<HttpResponse, String> extractor,
|
||||
@ -106,7 +106,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
||||
});
|
||||
}
|
||||
|
||||
public final void obtain(final String alias, final Supplier<HttpResponse> http, final String... extraInfo) {
|
||||
public final void keep(final String alias, final Supplier<HttpResponse> http, final String... extraInfo) {
|
||||
withTitle(ScenarioTest.resolve(alias), () -> {
|
||||
http.get().keep();
|
||||
Arrays.stream(extraInfo).forEach(testReport::printPara);
|
||||
|
@ -20,27 +20,27 @@ public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebit
|
||||
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
obtain("BankAccount: Billing GmbH - refund bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Billing GmbH - refund bank account",
|
||||
"iban": "DE02120300000000202051",
|
||||
"bic": "BYLADEM1001"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
keep("BankAccount: Billing GmbH - refund bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Billing GmbH - refund bank account",
|
||||
"iban": "DE02120300000000202051",
|
||||
"bic": "BYLADEM1001"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
obtain("Contact: Billing GmbH - Test AG billing", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "Billing GmbH, billing for Test AG",
|
||||
"emailAddresses": {
|
||||
"main": "test-ag@billing-GmbH.example.com"
|
||||
keep("Contact: Billing GmbH - Test AG billing", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "Billing GmbH, billing for Test AG",
|
||||
"emailAddresses": {
|
||||
"main": "test-ag@billing-GmbH.example.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
return httpPost("/api/hs/office/debitors", usingJsonBody("""
|
||||
|
@ -15,7 +15,7 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
||||
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
obtain("partnerPersonUuid", () ->
|
||||
keep("partnerPersonUuid", () ->
|
||||
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].holder.uuid"),
|
||||
@ -23,27 +23,27 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
||||
"**HINT**: With production data, you might get multiple results and have to decide which is the right one."
|
||||
);
|
||||
|
||||
obtain("BankAccount: Test AG - refund bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Test AG - refund bank account",
|
||||
"iban": "DE88100900001234567892",
|
||||
"bic": "BEVODEBB"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
keep("BankAccount: Test AG - refund bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Test AG - refund bank account",
|
||||
"iban": "DE88100900001234567892",
|
||||
"bic": "BEVODEBB"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
obtain("Contact: Test AG - billing department", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": ${billingContactCaption},
|
||||
"emailAddresses": {
|
||||
"main": ${billingContactEmailAddress}
|
||||
keep("Contact: Test AG - billing department", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": ${billingContactCaption},
|
||||
"emailAddresses": {
|
||||
"main": ${billingContactEmailAddress}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
return httpPost("/api/hs/office/debitors", usingJsonBody("""
|
||||
|
@ -14,15 +14,15 @@ public class CreateSepaMandataForDebitor extends UseCase<CreateSepaMandataForDeb
|
||||
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
obtain("BankAccount: Test AG - debit bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Test AG - debit bank account",
|
||||
"iban": "DE02701500000000594937",
|
||||
"bic": "SSKMDEMM"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
keep("BankAccount: Test AG - debit bank account", () ->
|
||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||
{
|
||||
"holder": "Test AG - debit bank account",
|
||||
"iban": "DE02701500000000594937",
|
||||
"bic": "SSKMDEMM"
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
return httpPost("/api/hs/office/sepamandates", usingJsonBody("""
|
||||
|
@ -13,7 +13,7 @@ public class CreateMembership extends UseCase<CreateMembership> {
|
||||
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
obtain("Membership: %{partnerName} 00", () ->
|
||||
keep("Membership: %{partnerName} 00", () ->
|
||||
httpPost("/api/hs/office/memberships", usingJsonBody("""
|
||||
{
|
||||
"partnerUuid": ${Partner: Test AG},
|
||||
|
@ -18,14 +18,14 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
obtain("Person: %{partnerPersonTradeName}", () ->
|
||||
keep("Person: %{partnerPersonTradeName}", () ->
|
||||
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
|
||||
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
|
||||
);
|
||||
|
||||
obtain("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
|
||||
keep("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
|
||||
() ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
{
|
||||
@ -39,19 +39,19 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
|
||||
"**HINT**: operations contacts are always connected to a partner-person, thus a person which is a holder of a partner-relation."
|
||||
);
|
||||
|
||||
obtain("Contact: %{operationsContactGivenName} %{operationsContactFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{operationsContactGivenName} %{operationsContactFamilyName}",
|
||||
"phoneNumbers": {
|
||||
"main": ${operationsContactPhoneNumber}
|
||||
},
|
||||
"emailAddresses": {
|
||||
"main": ${operationsContactEMailAddress}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON),
|
||||
keep("Contact: %{operationsContactGivenName} %{operationsContactFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{operationsContactGivenName} %{operationsContactFamilyName}",
|
||||
"phoneNumbers": {
|
||||
"main": ${operationsContactPhoneNumber}
|
||||
},
|
||||
"emailAddresses": {
|
||||
"main": ${operationsContactEMailAddress}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON),
|
||||
"Please check first if that contact already exists, if so, use it's UUID below."
|
||||
);
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.hostsharing.hsadminng.hs.office.scenarios.partner;
|
||||
|
||||
import io.restassured.http.ContentType;
|
||||
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
|
||||
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
|
||||
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import static io.restassured.http.ContentType.JSON;
|
||||
@ -18,40 +18,40 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
obtain("Person: %{partnerPersonTradeName}", () ->
|
||||
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
keep("Person: %{partnerPersonTradeName}", () ->
|
||||
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
|
||||
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
|
||||
);
|
||||
|
||||
obtain("Person: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
{
|
||||
"personType": "NATURAL_PERSON",
|
||||
"familyName": ${representativeFamilyName},
|
||||
"givenName": ${representativeGivenName}
|
||||
}
|
||||
"""))
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON),
|
||||
"Please check first if that person already exists, if so, use it's UUID below.",
|
||||
"**HINT**: A representative is always a natural person and represents a non-natural-person."
|
||||
keep("Person: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
{
|
||||
"personType": "NATURAL_PERSON",
|
||||
"familyName": ${representativeFamilyName},
|
||||
"givenName": ${representativeGivenName}
|
||||
}
|
||||
"""))
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON),
|
||||
"Please check first if that person already exists, if so, use it's UUID below.",
|
||||
"**HINT**: A representative is always a natural person and represents a non-natural-person."
|
||||
);
|
||||
|
||||
obtain("Contact: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{representativeGivenName} %{representativeFamilyName}",
|
||||
"postalAddress": ${representativePostalAddress},
|
||||
"phoneNumbers": {
|
||||
"main": ${representativePhoneNumber}
|
||||
},
|
||||
"emailAddresses": {
|
||||
"main": ${representativeEMailAddress}
|
||||
keep("Contact: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{representativeGivenName} %{representativeFamilyName}",
|
||||
"postalAddress": ${representativePostalAddress},
|
||||
"phoneNumbers": {
|
||||
"main": ${representativePhoneNumber}
|
||||
},
|
||||
"emailAddresses": {
|
||||
"main": ${representativeEMailAddress}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON),
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON),
|
||||
"Please check first if that contact already exists, if so, use it's UUID below."
|
||||
);
|
||||
|
||||
|
@ -21,14 +21,14 @@ public class CreatePartner extends UseCase<CreatePartner> {
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
obtain("Person: Hostsharing eG", () ->
|
||||
keep("Person: Hostsharing eG", () ->
|
||||
httpGet("/api/hs/office/persons?name=Hostsharing+eG")
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
|
||||
"Even in production data we expect this query to return just a single result." // TODO.impl: add constraint?
|
||||
);
|
||||
|
||||
obtain("Person: %{tradeName}", () ->
|
||||
keep("Person: %{tradeName}", () ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
{
|
||||
"personType": ${personType},
|
||||
@ -38,7 +38,7 @@ public class CreatePartner extends UseCase<CreatePartner> {
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||
);
|
||||
|
||||
obtain("Contact: %{tradeName} - Board of Directors", () ->
|
||||
keep("Contact: %{tradeName} - Board of Directors", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": ${contactCaption},
|
||||
|
@ -16,7 +16,7 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
obtain("Operations-Contact: %{operationsContactPerson}", () ->
|
||||
keep("Operations-Contact: %{operationsContactPerson}", () ->
|
||||
httpGet("/api/hs/office/relations?relationType=OPERATIONS&name=" + uriEncoded("%{operationsContactPerson}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
|
||||
|
@ -16,8 +16,8 @@ public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
|
||||
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
obtain("Person: %{subscriberGivenName} %{subscriberFamilyName}", () ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
keep("Person: %{subscriberGivenName} %{subscriberFamilyName}", () ->
|
||||
httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
{
|
||||
"personType": "NATURAL_PERSON",
|
||||
"familyName": ${subscriberFamilyName},
|
||||
@ -27,16 +27,16 @@ public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||
);
|
||||
|
||||
obtain("Contact: %{subscriberGivenName} %{subscriberFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{subscriberGivenName} %{subscriberFamilyName}",
|
||||
"emailAddresses": {
|
||||
"main": ${subscriberEMailAddress}
|
||||
keep("Contact: %{subscriberGivenName} %{subscriberFamilyName}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
"caption": "%{subscriberGivenName} %{subscriberFamilyName}",
|
||||
"emailAddresses": {
|
||||
"main": ${subscriberEMailAddress}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
return httpPost("/api/hs/office/relations", usingJsonBody("""
|
||||
|
Loading…
Reference in New Issue
Block a user