Search in sources :

Example 1 with InfinispanServerTestMethodRule

use of org.infinispan.server.test.junit4.InfinispanServerTestMethodRule in project infinispan by infinispan.

the class AbstractAuthorization method testScriptUpload.

@Test
public void testScriptUpload() {
    SkipJunit.skipSinceJDK(16);
    InfinispanServerTestMethodRule serverTest = getServerTest();
    for (TestUser user : EnumSet.of(TestUser.ADMIN, TestUser.DEPLOYER)) {
        RemoteCacheManager remoteCacheManager = serverTest.hotrod().withClientConfiguration(hotRodBuilders.get(user)).createRemoteCacheManager();
        serverTest.addScript(remoteCacheManager, "scripts/test.js");
    }
    for (TestUser user : EnumSet.of(TestUser.MONITOR, TestUser.APPLICATION, TestUser.OBSERVER, TestUser.WRITER)) {
        RemoteCacheManager remoteCacheManager = serverTest.hotrod().withClientConfiguration(hotRodBuilders.get(user)).createRemoteCacheManager();
        Exceptions.expectException(HotRodClientException.class, "(?s).*ISPN000287.*", () -> serverTest.addScript(remoteCacheManager, "scripts/test.js"));
    }
}
Also used : RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) InfinispanServerTestMethodRule(org.infinispan.server.test.junit4.InfinispanServerTestMethodRule) TestUser(org.infinispan.server.test.api.TestUser) Test(org.junit.Test)

Example 2 with InfinispanServerTestMethodRule

use of org.infinispan.server.test.junit4.InfinispanServerTestMethodRule in project infinispan by infinispan.

the class AbstractAuthorization method testExecScripts.

@Test
public void testExecScripts() {
    SkipJunit.skipSinceJDK(16);
    InfinispanServerTestMethodRule serverTest = getServerTest();
    RemoteCache cache = serverTest.hotrod().withClientConfiguration(hotRodBuilders.get(TestUser.ADMIN)).create();
    String scriptName = serverTest.addScript(cache.getRemoteCacheManager(), "scripts/test.js");
    Map params = new HashMap<>();
    params.put("key", "k");
    params.put("value", "v");
    for (TestUser user : EnumSet.of(TestUser.ADMIN, TestUser.APPLICATION, TestUser.DEPLOYER)) {
        RemoteCache cacheExec = serverTest.hotrod().withClientConfiguration(hotRodBuilders.get(user)).get();
        cacheExec.execute(scriptName, params);
    }
    for (TestUser user : EnumSet.of(TestUser.MONITOR, TestUser.OBSERVER, TestUser.WRITER)) {
        RemoteCache cacheExec = serverTest.hotrod().withClientConfiguration(hotRodBuilders.get(user)).get();
        Exceptions.expectException(HotRodClientException.class, "(?s).*ISPN000287.*", () -> {
            cacheExec.execute(scriptName, params);
        });
    }
}
Also used : InfinispanServerTestMethodRule(org.infinispan.server.test.junit4.InfinispanServerTestMethodRule) HashMap(java.util.HashMap) RemoteCache(org.infinispan.client.hotrod.RemoteCache) Map(java.util.Map) HashMap(java.util.HashMap) TestUser(org.infinispan.server.test.api.TestUser) Test(org.junit.Test)

Example 3 with InfinispanServerTestMethodRule

use of org.infinispan.server.test.junit4.InfinispanServerTestMethodRule in project infinispan by infinispan.

the class StatefulSetRollingUpgradeIT method getRuleChain.

@Rule
public RuleChain getRuleChain() {
    serverRule = InfinispanServerRuleBuilder.config("configuration/ClusteredServerTest.xml").numServers(numServers).runMode(ServerRunMode.CONTAINER).parallelStartup(false).build();
    methodRule = new InfinispanServerTestMethodRule(serverRule);
    return RuleChain.outerRule(serverRule).around(methodRule);
}
Also used : InfinispanServerTestMethodRule(org.infinispan.server.test.junit4.InfinispanServerTestMethodRule) InfinispanServerTestMethodRule(org.infinispan.server.test.junit4.InfinispanServerTestMethodRule) InfinispanServerRule(org.infinispan.server.test.junit4.InfinispanServerRule) Rule(org.junit.Rule)

Aggregations

InfinispanServerTestMethodRule (org.infinispan.server.test.junit4.InfinispanServerTestMethodRule)3 TestUser (org.infinispan.server.test.api.TestUser)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 RemoteCache (org.infinispan.client.hotrod.RemoteCache)1 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)1 InfinispanServerRule (org.infinispan.server.test.junit4.InfinispanServerRule)1 Rule (org.junit.Rule)1