Compare commits

..

No commits in common. "68172195534c1e264cce666af5e8e53387dedd5f" and "84a0799065102a882325c3a5ca266c40f471ecdb" have entirely different histories.

7 changed files with 55 additions and 31 deletions

View File

@ -3,8 +3,8 @@ package net.hostsharing.hsadminng.hs.office.scenarios;
import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.HsadminNgApplication;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandataForDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandataForDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership;
@ -172,7 +172,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Requires("Debitor: Test AG - main debitor") @Requires("Debitor: Test AG - main debitor")
@Produces("SEPA-Mandate: Test AG") @Produces("SEPA-Mandate: Test AG")
void shouldCreateSepaMandateForDebitor() { void shouldCreateSepaMandateForDebitor() {
new CreateSepaMandateForDebitor(this) new CreateSepaMandataForDebitor(this)
.given("debitor", "Test AG") .given("debitor", "Test AG")
.given("memberNumberSuffix", "00") .given("memberNumberSuffix", "00")
.given("validFrom", "2024-10-15") .given("validFrom", "2024-10-15")
@ -195,7 +195,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Order(3109) @Order(3109)
@Requires("SEPA-Mandate: Test AG") @Requires("SEPA-Mandate: Test AG")
void shouldDeleteSepaMandateForDebitor() { void shouldDeleteSepaMandateForDebitor() {
new DeleteSepaMandateForDebitor(this) new DeleteSepaMandataForDebitor(this)
.given("sepaMandateUuid", "%{SEPA-Mandate: Test AG}") .given("sepaMandateUuid", "%{SEPA-Mandate: Test AG}")
.doRun(); .doRun();
} }
@ -233,8 +233,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Requires("Subscription: Michael Miller to operations-announce") @Requires("Subscription: Michael Miller to operations-announce")
void shouldUnsubscribeNewPersonAndContactToMailinglist() { void shouldUnsubscribeNewPersonAndContactToMailinglist() {
new UnsubscribeFromMailinglist(this) new UnsubscribeFromMailinglist(this)
.given("mailingList", "operations-announce") .given("subscriptionUuid", "%{Subscription: Michael Miller to operations-announce}")
.given("subscriberEMailAddress", "michael.miller@example.org")
.doRun(); .doRun();
} }
} }

View File

@ -0,0 +1,34 @@
package net.hostsharing.hsadminng.hs.office.scenarios;
import java.lang.invoke.SerializedLambda;
import java.lang.reflect.Method;
import java.util.function.Consumer;
public class MethodReferenceExample {
public static void myMethod(String input) {
System.out.println("Hello from myMethod, input: " + input);
}
public static void main(String[] args) {
// Create a method reference
Consumer<String> methodRef = MethodReferenceExample::myMethod;
// Use reflection to retrieve method reference info
try {
// Step 1: Get the method 'writeReplace' via reflection
Method writeReplace = methodRef.getClass().getDeclaredMethod("writeReplace");
writeReplace.setAccessible(true);
// Step 2: Invoke 'writeReplace' to get a SerializedLambda
SerializedLambda serializedLambda = (SerializedLambda) writeReplace.invoke(methodRef);
// Step 3: Get the method name using the SerializedLambda
String methodName = serializedLambda.getImplMethodName();
System.out.println("Original method name: " + methodName);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -86,6 +86,7 @@ public class TemplateResolver {
throw new IllegalStateException("no more characters. resolved so far: " + resolved); throw new IllegalStateException("no more characters. resolved so far: " + resolved);
} }
final var currentChar = currentChar(); final var currentChar = currentChar();
//System.out.println("fetched #" + position + ": " + currentChar);
++position; ++position;
return currentChar; return currentChar;
} }

View File

@ -6,9 +6,9 @@ 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 CreateSepaMandateForDebitor extends UseCase<CreateSepaMandateForDebitor> { public class CreateSepaMandataForDebitor extends UseCase<CreateSepaMandataForDebitor> {
public CreateSepaMandateForDebitor(final ScenarioTest testSuite) { public CreateSepaMandataForDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -5,9 +5,9 @@ import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
public class DeleteSepaMandateForDebitor extends UseCase<DeleteSepaMandateForDebitor> { public class DeleteSepaMandataForDebitor extends UseCase<DeleteSepaMandataForDebitor> {
public DeleteSepaMandateForDebitor(final ScenarioTest testSuite) { public DeleteSepaMandataForDebitor(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }

View File

@ -25,15 +25,16 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one." "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}", () -> obtain("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
httpPost("/api/hs/office/persons", usingJsonBody(""" () ->
{ httpPost("/api/hs/office/persons", usingJsonBody("""
"personType": "NATURAL_PERSON", {
"familyName": ${operationsContactFamilyName}, "personType": "NATURAL_PERSON",
"givenName": ${operationsContactGivenName} "familyName": ${operationsContactFamilyName},
} "givenName": ${operationsContactGivenName}
""")) }
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON), """))
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON),
"Please check first if that person already exists, if so, use it's UUID below.", "Please check first if that person already exists, if so, use it's UUID below.",
"**HINT**: operations contacts are always connected to a partner-person, thus a person which is a holder of a partner-relation." "**HINT**: operations contacts are always connected to a partner-person, thus a person which is a holder of a partner-relation."
); );

View File

@ -3,9 +3,7 @@ package net.hostsharing.hsadminng.hs.office.scenarios.subscription;
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.NO_CONTENT;
import static org.springframework.http.HttpStatus.OK;
public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailinglist> { public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailinglist> {
@ -16,16 +14,7 @@ public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailingli
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
obtain("Subscription: %{subscriberEMailAddress}", () -> return httpDelete("/api/hs/office/relations/" + uuid("subscriptionUuid"))
httpGet("/api/hs/office/relations?relationType=SUBSCRIBER" +
"&mark=" + uriEncoded("%{mailingList}") +
"&contactData=" + uriEncoded("%{subscriberEMailAddress}"))
.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."
);
return httpDelete("/api/hs/office/relations/" + uuid("Subscription: %{subscriberEMailAddress}"))
.expecting(NO_CONTENT); .expecting(NO_CONTENT);
} }
} }