Search in sources :

Example 1 with Q2

use of org.jpos.q2.Q2 in project jPOS by jpos.

the class TransactionManagerTestCase method setUp.

public void setUp() throws Exception {
    sp = SpaceFactory.getSpace("tspace:txnmgrtest");
    q2 = new Q2("build/resources/test/org/jpos/transaction");
    q2.start();
}
Also used : Q2(org.jpos.q2.Q2)

Example 2 with Q2

use of org.jpos.q2.Q2 in project jPOS by jpos.

the class Q2Test method testQEntryIsQBean1.

@Test
public void testQEntryIsQBean1() throws Throwable {
    Q2.QEntry qEntry = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2"));
    qEntry.setObject(new SystemMonitor());
    boolean result = qEntry.isQBean();
    assertTrue(result, "result");
}
Also used : SystemMonitor(org.jpos.q2.qbean.SystemMonitor) ObjectInstance(javax.management.ObjectInstance) ObjectName(javax.management.ObjectName)

Example 3 with Q2

use of org.jpos.q2.Q2 in project jPOS by jpos.

the class QFactory2Test method testDestroyQBeanThrowsNullPointerException1.

@Test
public void testDestroyQBeanThrowsNullPointerException1() throws Throwable {
    String[] args = new String[0];
    String keyParam = "testString";
    String valueParam = "testString";
    Q2 q2 = new Q2(args);
    try {
        new QFactory(ObjectName.getInstance("testQFactoryParam1", keyParam, valueParam), null).destroyQBean(q2, new ObjectName("testQFactoryParam1", "testQFactoryParam2", "testQFactoryParam3"), new ChannelAdaptor());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"javax.management.MBeanServer.invoke(javax.management.ObjectName, String, Object[], String[])\" because \"mserver\" is null", ex.getMessage(), "ex.getMessage()");
        }
    } finally {
        q2.stop();
    }
}
Also used : ObjectName(javax.management.ObjectName) ChannelAdaptor(org.jpos.q2.iso.ChannelAdaptor) Test(org.junit.jupiter.api.Test)

Example 4 with Q2

use of org.jpos.q2.Q2 in project jPOS by jpos.

the class QMUXTestCase method setUp.

@BeforeAll
public static void setUp(@TempDir Path deployDir) throws IOException {
    sp = SpaceFactory.getSpace();
    Files.walk(Paths.get("build/resources/test/org/jpos/q2/iso")).forEach(s -> {
        if (Files.isRegularFile(s)) {
            try {
                Files.copy(s, deployDir.resolve(s.getFileName()), REPLACE_EXISTING);
            } catch (IOException e) {
                fail();
            }
        }
    });
    q2 = new Q2(deployDir.toString());
    q2.start();
    mux = NameRegistrar.get("mux.mux", 10000L);
    assertNotNull(mux);
    receivedHandback = null;
}
Also used : Q2(org.jpos.q2.Q2) IOException(java.io.IOException)

Example 5 with Q2

use of org.jpos.q2.Q2 in project jPOS by jpos.

the class LIST method exec.

@Override
public void exec(CLIContext ctx, String[] args) throws Exception {
    Q2 q2 = ctx.getCLI().getQ2();
    File deployDir = q2.getDeployDir();
    ctx.println(printDirectoryTree(deployDir));
    return;
}
Also used : Q2(org.jpos.q2.Q2) File(java.io.File)

Aggregations

Q2 (org.jpos.q2.Q2)9 IOException (java.io.IOException)3 File (java.io.File)2 ObjectName (javax.management.ObjectName)2 ArmoredInputStream (org.bouncycastle.bcpg.ArmoredInputStream)2 Test (org.junit.jupiter.api.Test)2 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Mac (javax.crypto.Mac)1 SecretKeySpec (javax.crypto.spec.SecretKeySpec)1 ObjectInstance (javax.management.ObjectInstance)1 JcaPGPContentVerifierBuilderProvider (org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider)1 ChannelAdaptor (org.jpos.q2.iso.ChannelAdaptor)1 SystemMonitor (org.jpos.q2.qbean.SystemMonitor)1 NameRegistrar (org.jpos.util.NameRegistrar)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1