InfinispanContext implements Disposable { protected static SaslQop toSaslQop(String value) { try { return SaslQop.valueOf(value.trim() .replace('-', '_') .toUpperCase()); } catch (IllegalArgumentException e) { List<String> values = Arrays.asList(SaslQop.values()).stream().map(SaslQop::toString).collect(toList()); throw new InfinispanException(MessageFormat.format("SaslQoP option <{0}> is not present in one of this possible values {1}", value, values), e); } } private  InfinispanContext(Map<String, String> properties); static InfinispanContext getInstance(); void retrieveProbufSchemas(); RemoteCache<String, KObject> getCache(String index); List<String> getTypes(String index); void addProtobufSchema(String clusterId,
                                  Schema schema); void loadProtobufSchema(RemoteCache<String, String> metadataCache); @Override void dispose(); List<String> getIndices(); Optional<Schema> getSchema(String clusterId); void addSchema(Schema schema); boolean isAlive(); void deleteCache(String index); void observeInitialization(Runnable runnable); static final String SASL_MECHANISM; }
@Test public void testToSaslQoP() { SaslQop sqsl = InfinispanContext.toSaslQop("auth"); assertEquals(sqsl, SaslQop.AUTH); sqsl = InfinispanContext.toSaslQop("auth-int"); assertEquals(sqsl, SaslQop.AUTH_INT); sqsl = InfinispanContext.toSaslQop("auth-conf"); assertEquals(sqsl, SaslQop.AUTH_CONF); }
@Test public void testWrongToSaslQoP() { try { SaslQop sqsl = InfinispanContext.toSaslQop("auths"); assertEquals(sqsl, SaslQop.AUTH); fail("auths is an invalid option"); } catch (InfinispanException e) { logger.info(e.getMessage()); } }