org.infinispan.Version.getSchemaVersion()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.infinispan.Version.getSchemaVersion()方法的一些代码示例,展示了Version.getSchemaVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getSchemaVersion()方法的具体详情如下:
包路径:org.infinispan.Version
类名称:Version
方法名:getSchemaVersion

Version.getSchemaVersion介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-core

public static String wrapXMLWithSchema(String xml) {
 return wrapXMLWithSchema(Version.getSchemaVersion(), xml);
}

代码示例来源:origin: org.infinispan/infinispan-core

@DataProvider(name = "configurationFiles")
public Object[][] configurationFiles() throws Exception {
 URL configDir = Thread.currentThread().getContextClassLoader().getResource("configs/unified");
 List<Path> paths = Files.list(Paths.get(configDir.toURI())).collect(Collectors.toList());
 Object[][] configurationFiles = new Object[paths.size()][];
 boolean hasCurrentSchema = false;
 for (int i = 0; i < paths.size(); i++) {
   if (paths.get(i).getFileName().toString().equals(Version.getSchemaVersion() + ".xml")) {
    hasCurrentSchema = true;
   }
   configurationFiles[i] = new Object[]{paths.get(i)};
 }
 // Ensure that we contain the current schema version at the very least
 assertTrue("Could not find a '" + Version.getSchemaVersion() + ".xml' configuration file", hasCurrentSchema);
 return configurationFiles;
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

@Parameters
public static Collection<Object[]> data() throws Exception {
  URL configDir = Thread.currentThread().getContextClassLoader().getResource("org/infinispan/server/jgroups/subsystem");
  List<Path> paths = Files.list(Paths.get(configDir.toURI()))
     .filter(path -> path.toString().endsWith(".xml"))
     .collect(Collectors.toList());
  boolean hasCurrentSchema = false;
  String currentSchema = "subsystem-infinispan_server_jgroups-" + Version.getSchemaVersion().replaceAll("\\.", "_") + ".xml";
  List<Object[]> data = new ArrayList<>();
  for (int i = 0; i < paths.size(); i++) {
    Path xmlPath = paths.get(i);
    if (xmlPath.getFileName().toString().equals(currentSchema)) {
      hasCurrentSchema = true;
    }
    String propsPath = xmlPath.toString().replaceAll("\\.xml$", ".properties");
    Properties properties = new Properties();
    try (Reader r = new FileReader(propsPath)) {
      properties.load(r);
    }
    data.add(new Object[]{xmlPath, properties});
  }
  // Ensure that we contain the current schema version at the very least
  assertTrue("Could not find a '" + currentSchema + "' configuration file", hasCurrentSchema);
  return data;
}

代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan

@Parameters
public static Collection<Object[]> data() throws Exception {
  URL configDir = Thread.currentThread().getContextClassLoader().getResource("org/jboss/as/clustering/infinispan/subsystem");
  List<Path> paths = Files.list(Paths.get(configDir.toURI()))
     .filter(path -> path.getFileName().toString().matches("^subsystem-infinispan_[0-9]+_[0-9]+.xml$"))
     .collect(Collectors.toList());
  boolean hasCurrentSchema = false;
  String currentSchema = "subsystem-infinispan_" + Version.getSchemaVersion().replaceAll("\\.", "_") + ".xml";
  List<Object[]> data = new ArrayList<>();
  for (int i = 0; i < paths.size(); i++) {
    Path xmlPath = paths.get(i);
    if (xmlPath.getFileName().toString().equals(currentSchema)) {
      hasCurrentSchema = true;
    }
    String propsPath = xmlPath.toString().replaceAll("\\.xml$", ".properties");
    Properties properties = new Properties();
    try (Reader r = new FileReader(propsPath)) {
      properties.load(r);
    }
    data.add(new Object[]{xmlPath, properties});
  }
  // Ensure that we contain the current schema version at the very least
  assertTrue("Could not find a '" + currentSchema + ".xml' configuration file", hasCurrentSchema);
  return data;
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-remote

public void testRemoteCacheStore() throws Exception {
 String config = TestingUtil.wrapXMLWithSchema(
    "<cache-container default-cache=\"default\">" +
    "   <local-cache name=\"default\">\n" +
    "     <persistence>\n" +
    "       <remote-store xmlns=\"urn:infinispan:config:store:remote:"+ Version.getSchemaVersion() + "\" >\n" +
    "         <remote-server host=\"one\" />\n" +
    "         <remote-server host=\"two\" />\n" +
    "         <connection-pool max-active=\"10\" exhausted-action=\"CREATE_NEW\" />\n" +
    "         <async-executor>\n" +
    "             <property name=\"maxThreads\">4</property>" +
    "         </async-executor>\n" +
    "         <write-behind/>\n" +
    "       </remote-store>\n" +
    "     </persistence>\n" +
    "   </local-cache>\n" +
    "</cache-container>"
 );
 RemoteStoreConfiguration store = (RemoteStoreConfiguration) buildCacheManagerWithCacheStore(config);
 assert store.servers().size() == 2;
 assert store.connectionPool().exhaustedAction() == ExhaustedAction.CREATE_NEW;
 assert store.asyncExecutorFactory().properties().getIntProperty("maxThreads", 0) == 4;
 assert store.async().enabled();
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-jdbc

"      <local-cache name=\"default\">\n" +
"     <persistence>\n" +
"       <string-keyed-jdbc-store xmlns=\"urn:infinispan:config:store:jdbc:"+ Version.getSchemaVersion() + "\" key-to-string-mapper=\"DummyKey2StringMapper\" shared=\"true\" " +
"                                preload=\"true\" read-only=\"true\" fetch-state=\"true\" purge=\"true\" singleton=\"false\" dialect=\"H2\">\n" +
"         <connection-pool connection-url=\"jdbc:h2:mem:infinispan;DB_CLOSE_DELAY=-1\" username=\"dbuser\" password=\"dbpass\" driver=\"org.h2.Driver\"/>\n" +

相关文章