Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setIgniteHome()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setIgniteHome() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteMock.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override public IgniteConfiguration configuration() {
    if (staticCfg != null)
        return staticCfg;

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setMarshaller(marshaller);
    cfg.setNodeId(nodeId);
    cfg.setMBeanServer(jmx);
    cfg.setIgniteHome(home);
    cfg.setLocalHost(locHost);

    try {
        cfg.setWorkDirectory(U.defaultWorkDirectory());
    }
    catch (IgniteCheckedException e) {
        throw new IgniteException("Failed to get default work directory.", e);
    }

    return cfg;
}
 
Example 2
Source File: ConfigVariationsFactory.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param cfg Config.
 * @param srcCfg Source config.
 */
private static void copyDefaultsFromSource(IgniteConfiguration cfg, IgniteConfiguration srcCfg) {
    cfg.setIgniteInstanceName(srcCfg.getIgniteInstanceName());
    cfg.setGridLogger(srcCfg.getGridLogger());
    cfg.setNodeId(srcCfg.getNodeId());
    cfg.setIgniteHome(srcCfg.getIgniteHome());
    cfg.setMBeanServer(srcCfg.getMBeanServer());
    cfg.setMetricsLogFrequency(srcCfg.getMetricsLogFrequency());
    cfg.setConnectorConfiguration(srcCfg.getConnectorConfiguration());
    cfg.setCommunicationSpi(srcCfg.getCommunicationSpi());
    cfg.setNetworkTimeout(srcCfg.getNetworkTimeout());
    cfg.setDiscoverySpi(srcCfg.getDiscoverySpi());
    cfg.setCheckpointSpi(srcCfg.getCheckpointSpi());
    cfg.setIncludeEventTypes(srcCfg.getIncludeEventTypes());

    // Specials.
    ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
    cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
}
 
Example 3
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsync() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.to(5);
    req.from(2);

    req.path(igniteHome + "/work/log/" + "test.log");
    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertNull(resp.result().getError());
    assertEquals(GridRestResponse.STATUS_SUCCESS, resp.result().getSuccessStatus());
    assertNotNull(resp.result().getResponse());
}
 
Example 4
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsyncForNonExistingLines() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.to(50);
    req.from(20);

    req.path(igniteHome + "/work/log/" + "test.log");
    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertEquals("Request parameter 'from' and 'to' are for lines that do not exist in log file.", resp.result().getError());
    assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
    assertNull(resp.result().getResponse());
}
 
Example 5
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsyncFromAndToNotSet() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.path(igniteHome + "/work/log/" + "test.log");
    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertNull(resp.result().getError());
    assertEquals(GridRestResponse.STATUS_SUCCESS, resp.result().getSuccessStatus());
    assertNotNull(resp.result().getResponse());
}
 
Example 6
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsyncPathIsOutsideIgniteHome() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.to(5);
    req.from(2);
    req.path("/home/users/mytest.log");

    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertEquals("Request parameter 'path' must contain a path to valid log file.", resp.result().getError());
    assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
    assertNull(resp.result().getResponse());
}
 
Example 7
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsyncFromGreaterThanTo() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.to(5);
    req.from(7);

    req.path(igniteHome + "/work/log/" + "test.log");
    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertEquals("Request parameter 'from' must be less than 'to'.", resp.result().getError());
    assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
    assertNull(resp.result().getResponse());
}
 
Example 8
Source File: GridLogCommandHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testHandleAsyncFromEqualTo() throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteHome(igniteHome);
    GridTestKernalContext ctx = newContext(cfg);
    GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
    GridRestLogRequest req = new GridRestLogRequest();

    req.to(5);
    req.from(5);

    req.path(igniteHome + "/work/log/" + "test.log");
    IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);

    assertEquals("Request parameter 'from' must be less than 'to'.", resp.result().getError());
    assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
    assertNull(resp.result().getResponse());
}
 
Example 9
Source File: OptimizedMarshallerEnumSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
private GridKernalContext newContext() throws IgniteCheckedException {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setIgniteHome(igniteHome);
    cfg.setClientMode(false);

    return new GridTestKernalContext(rootLog.getLogger(OptimizedMarshallerEnumSelfTest.class), cfg);
}