Search in sources :

Example 6 with ImplementerOption

use of net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption in project styx by petafuel.

the class STYX02UnitTest method testApplyNotRequired.

@Test
void testApplyNotRequired() throws ImplementerOptionException {
    styx02Option.setOptions(Collections.singletonMap("required", false));
    aspsp.getConfig().setImplementerOptions(new HashMap<>());
    aspsp.getConfig().getImplementerOptions().put("STYX02", styx02Option);
    ImplementerOption io6 = new ImplementerOption();
    io6.setId("IO6");
    io6.setOptions(Collections.singletonMap("required", false));
    aspsp.getConfig().getImplementerOptions().put("IO6", io6);
    IOParser ioParser = new IOParser(aspsp);
    STYX02 styx02 = new STYX02(ioParser);
    Assertions.assertEquals(IOOrder.POST_CREATION, styx02.order());
    Assertions.assertFalse(styx02.apply(null, null, null));
}
Also used : IOParser(net.petafuel.styx.core.ioprocessing.IOParser) ImplementerOption(net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption) Test(org.junit.jupiter.api.Test)

Example 7 with ImplementerOption

use of net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption in project styx by petafuel.

the class STYX08UnitTest method setup.

@BeforeAll
static void setup() {
    styx08Option = new ImplementerOption();
    styx08Option.setId("STYX08");
    uniCredit = new Aspsp();
    uniCredit.setConfig(new Config());
    uniCredit.setBic(TEST_BIC);
}
Also used : Aspsp(net.petafuel.styx.core.banklookup.sad.entities.Aspsp) Config(net.petafuel.styx.core.banklookup.sad.entities.Config) ImplementerOption(net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 8 with ImplementerOption

use of net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption in project styx by petafuel.

the class IO2UnitTest method setup.

@BeforeAll
static void setup() {
    io2Option = new ImplementerOption();
    io2Option.setId("IO2");
    aspsp = new Aspsp();
    aspsp.setConfig(new Config());
    aspsp.setBic(TEST_BIC);
}
Also used : Aspsp(net.petafuel.styx.core.banklookup.sad.entities.Aspsp) Config(net.petafuel.styx.core.banklookup.sad.entities.Config) ImplementerOption(net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 9 with ImplementerOption

use of net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption in project styx by petafuel.

the class ApplicableIOTest method testExecutionContext.

@Test
void testExecutionContext() throws ImplementerOptionException {
    class TEST1 extends ApplicableImplementerOption {

        protected TEST1(IOParser ioParser) {
            super(ioParser);
        // TODO Auto-generated constructor stub
        }

        @Override
        public boolean apply(XS2AFactoryInput xs2aFactoryInput, XS2ARequest xs2aRequest, XS2AResponse xs2aResponse) throws ImplementerOptionException {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public IOOrder order() {
            // TODO Auto-generated method stub
            return null;
        }
    }
    ;
    ImplementerOption test1 = new ImplementerOption();
    test1.setId("TEST1");
    Aspsp aspsp = new Aspsp();
    aspsp.setConfig(new Config());
    aspsp.setBic("TEST7999");
    test1.setOptions(Collections.singletonMap("KEEP_ALIVE", true));
    aspsp.getConfig().setImplementerOptions(Collections.singletonMap("TEST1", test1));
    IOParser ioParser = new IOParser(aspsp);
    TEST1 aio = new TEST1(ioParser);
    assertTrue(aio.shouldExecute(StyxExecutionContext.API));
    assertTrue(aio.shouldExecute(StyxExecutionContext.KEEP_ALIVE));
    aspsp.getConfig().getImplementerOptions().get("TEST1").setOptions(Collections.singletonMap("KEEP_ALIVE", false));
    assertTrue(aio.shouldExecute(StyxExecutionContext.API));
    assertFalse(aio.shouldExecute(StyxExecutionContext.KEEP_ALIVE));
    aspsp.getConfig().getImplementerOptions().get("TEST1").setOptions(Collections.singletonMap("required", false));
    assertTrue(aio.shouldExecute(StyxExecutionContext.API));
    assertFalse(aio.shouldExecute(StyxExecutionContext.KEEP_ALIVE));
    assertFalse(aio.shouldExecute(TestEC.SOME));
    aspsp.getConfig().setImplementerOptions(Collections.emptyMap());
    ioParser = new IOParser(aspsp);
    assertTrue(aio.shouldExecute(StyxExecutionContext.API));
    assertFalse(aio.shouldExecute(StyxExecutionContext.KEEP_ALIVE));
    assertFalse(aio.shouldExecute(TestEC.SOME));
}
Also used : Aspsp(net.petafuel.styx.core.banklookup.sad.entities.Aspsp) Config(net.petafuel.styx.core.banklookup.sad.entities.Config) XS2AFactoryInput(net.petafuel.styx.core.xs2a.factory.XS2AFactoryInput) XS2ARequest(net.petafuel.styx.core.xs2a.contracts.XS2ARequest) XS2AResponse(net.petafuel.styx.core.xs2a.entities.XS2AResponse) ImplementerOption(net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption) Test(org.junit.jupiter.api.Test)

Example 10 with ImplementerOption

use of net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption in project styx by petafuel.

the class IOParserUnitTest method setup.

@BeforeAll
static void setup() {
    styx04Option = new ImplementerOption();
    styx04Option.setId("STYX04");
    styx04Option.setOptions(Collections.singletonMap("required", false));
    sparda = new Aspsp();
    sparda.setConfig(new Config());
    sparda.setBic(TEST_BIC);
    sparda.getConfig().setImplementerOptions(Collections.singletonMap("STYX04", styx04Option));
    ioParser = new IOParser(sparda);
}
Also used : Aspsp(net.petafuel.styx.core.banklookup.sad.entities.Aspsp) Config(net.petafuel.styx.core.banklookup.sad.entities.Config) ImplementerOption(net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ImplementerOption (net.petafuel.styx.core.banklookup.sad.entities.ImplementerOption)15 Aspsp (net.petafuel.styx.core.banklookup.sad.entities.Aspsp)10 Config (net.petafuel.styx.core.banklookup.sad.entities.Config)8 BeforeAll (org.junit.jupiter.api.BeforeAll)6 JsonObject (javax.json.JsonObject)2 BankLookupFailedException (net.petafuel.styx.core.banklookup.exceptions.BankLookupFailedException)2 BankNotFoundException (net.petafuel.styx.core.banklookup.exceptions.BankNotFoundException)2 IOParser (net.petafuel.styx.core.ioprocessing.IOParser)2 Test (org.junit.jupiter.api.Test)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 UUID (java.util.UUID)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 Jsonb (javax.json.bind.Jsonb)1 Invocation (javax.ws.rs.client.Invocation)1 Response (javax.ws.rs.core.Response)1 IntegrationTest (net.petafuel.styx.api.IntegrationTest)1 StyxRESTTest (net.petafuel.styx.api.StyxRESTTest)1 ResponseCategory (net.petafuel.styx.api.exception.ResponseCategory)1