本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.getIgniteHome方法的典型用法代码示例。如果您正苦于以下问题:Java U.getIgniteHome方法的具体用法?Java U.getIgniteHome怎么用?Java U.getIgniteHome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.getIgniteHome方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeConfiguration
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Writes down the configuration to local disk and returns its path.
*
* @param cfg the configuration to write.
* @param pathFromIgniteHome path relatively to Ignite home.
* @return Full path of the written configuration.
*/
static String writeConfiguration(Configuration cfg, String pathFromIgniteHome) throws IOException {
if (!pathFromIgniteHome.startsWith("/"))
pathFromIgniteHome = "/" + pathFromIgniteHome;
final String path = U.getIgniteHome() + pathFromIgniteHome;
delete(path);
File file = new File(path);
try (FileOutputStream fos = new FileOutputStream(file)) {
cfg.writeXml(fos);
}
assertTrue(file.exists());
return path;
}
示例2: writeConfigurationToFile
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Write configuration to file.
*
* @param conf Configuration.
* @throws Exception If failed.
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
private static void writeConfigurationToFile(Configuration conf) throws Exception {
final String path = U.getIgniteHome() + SECONDARY_CFG_PATH;
File file = new File(path);
file.delete();
assertFalse(file.exists());
try (FileOutputStream fos = new FileOutputStream(file)) {
conf.writeXml(fos);
}
assertTrue(file.exists());
}
示例3: testLoader
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @throws Exception If failed.
*/
public void testLoader() throws Exception {
String path = U.getIgniteHome() + GRID_CFG_PATH;
info("Loading Grid from configuration file: " + path);
G.addListener(new IgnitionListener() {
@Override public void onStateChange(String name, IgniteState state) {
if (state == STARTED) {
info("Received started notification from grid: " + name);
latch.countDown();
G.stop(name, true);
}
}
});
CommandLineStartup.main(new String[]{path});
}
示例4: resolvePath
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param igniteHome Optional ignite home path.
* @param path Path to resolve.
* @return Resolved path, or {@code null} if file cannot be resolved.
*/
@Nullable private static File resolvePath(@Nullable String igniteHome, String path) {
File file = new File(path).getAbsoluteFile();
if (!file.exists()) {
String home = igniteHome != null ? igniteHome : U.getIgniteHome();
if (home == null)
return null;
file = new File(home, path);
return file.exists() ? file : null;
}
return file;
}
示例5: afterTestsStopped
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
G.stopAll(true);
String path = U.getIgniteHome() + SECONDARY_CFG_PATH;
new File(path).delete();
}
示例6: IgnitePdsMultiNodePutGetRestartTest
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Default constructor.
*/
public IgnitePdsMultiNodePutGetRestartTest() {
String home = U.getIgniteHome();
allocPath = new File(home, "work/db/" + UUID.randomUUID());
allocPath.mkdirs();
}
示例7: tearDown
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void tearDown() throws Exception {
// Next grid in the same VM shouldn't use cached values produced by these tests.
nullifyHomeDirectory();
U.getIgniteHome();
}
示例8: beforeTestsStarted
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
Configuration secondaryConf = configurationSecondary(SECONDARY_AUTHORITY);
secondaryConf.setInt("fs.igfs.block.size", 1024);
String path = U.getIgniteHome() + SECONDARY_CFG_PATH;
File file = new File(path);
try (FileOutputStream fos = new FileOutputStream(file)) {
secondaryConf.writeXml(fos);
}
startNodes();
}
示例9: testNoClassOnServerNode
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @throws Exception If failed.
*/
public final void testNoClassOnServerNode() throws Exception {
info("Run test with client: " + clientClassName());
// Check class is really not available.
try {
Class.forName("org.apache.ignite.tests.p2p.cache.Person");
fail();
}
catch (ClassNotFoundException ignore) {
// Expected exception.
}
try (Ignite ignite = Ignition.start(createConfiguration())) {
CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cfg.setCopyOnRead(true); // To store only value bytes.
ignite.createCache(cfg);
final CountDownLatch clientReadyLatch = new CountDownLatch(1);
Collection<String> jvmArgs = Arrays.asList("-ea", "-DIGNITE_QUIET=false");
GridJavaProcess clientNode = null;
try {
String cp = U.getIgniteHome() + "/modules/extdata/p2p/target/classes/";
clientNode = GridJavaProcess.exec(
clientClassName(), null,
log,
new CI1<String>() {
@Override public void apply(String s) {
info("Client node: " + s);
if (s.contains(NODE_START_MSG))
clientReadyLatch.countDown();
}
},
null,
null,
jvmArgs,
cp
);
assertTrue(clientReadyLatch.await(60, SECONDS));
int exitCode = clientNode.getProcess().waitFor();
assertEquals("Unexpected exit code", 0, exitCode);
}
finally {
if (clientNode != null)
clientNode.killProcess();
}
}
}
示例10: buildPath
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param path Path to the working directory.
* @param consId Consistent ID of the local node.
* @return DB storage path.
*
* @throws IgniteCheckedException If resolving swap directory fails.
*/
protected File buildPath(String path, String consId) throws IgniteCheckedException {
String igniteHomeStr = U.getIgniteHome();
File workDir = igniteHomeStr == null ? new File(path) : U.resolveWorkDirectory(igniteHomeStr, path, false);
return new File(workDir, consId);
}