Examples of NodeEnvironment


Examples of io.apigee.trireme.core.NodeEnvironment

    private static final String ATTACHMENT_VAL = "basichttptest";

    @BeforeClass
    public static void init()
    {
        env = new NodeEnvironment();
        env.setHttpContainer(new NettyHttpContainer());
        env.setScriptTimeLimit(TIME_LIMIT, TimeUnit.SECONDS);
    }
View Full Code Here

Examples of io.apigee.trireme.core.NodeEnvironment

    private static NodeEnvironment env;

    @BeforeClass
    public static void init()
    {
        env = new NodeEnvironment();
        System.setProperty("TriremeHttpTimeout", "2");
        env.setHttpContainer(new NettyHttpContainer());
    }
View Full Code Here

Examples of io.apigee.trireme.core.NodeEnvironment

        if ((args.length < 1) || (args.length > 4)) {
            System.exit(10);
        }

        File fileName = new File(args[0]);
        NodeEnvironment env = new NodeEnvironment();
        int exitCode = 101;
        int timeout = TEST_TIMEOUT_SECS;
        String version = NodeEnvironment.DEFAULT_NODE_VERSION;

        if ((args.length >= 2) && args[1].equals("netty")) {
            env.setHttpContainer(new NettyHttpContainer());
        }
        if (args.length >= 3) {
            timeout = Integer.parseInt(args[2]);
        }
        if (args.length >= 4) {
            version = args[3];
        }

        try {
            NodeScript script = env.createScript(fileName.getName(), fileName, null);
            script.setNodeVersion(version);

            Future<ScriptStatus> exec;
            try {
                exec = script.execute();
                ScriptStatus status = exec.get(timeout, TimeUnit.SECONDS);
                exitCode = status.getExitCode();
                if (status.hasCause()) {
                    Throwable cause = status.getCause();

                    if (cause instanceof JavaScriptException) {
                        Object value = ((JavaScriptException) cause).getValue();
                        Context cx = Context.enter();
                        System.err.println(Context.toString(value));
                        Context.exit();
                    }
                    if (cause instanceof RhinoException) {
                        System.err.println(((RhinoException) cause).getScriptStackTrace());
                    }
                    cause.printStackTrace(System.err);
                }
            } finally {
                script.close();
            }
        } catch (TimeoutException te) {
            System.err.println("Test timeout!");
            exitCode = 102;
        } catch (InterruptedException ie) {
            exitCode = 103;
        } catch (ExecutionException ee) {
            Throwable cause = ee.getCause();
            if (cause instanceof JavaScriptException) {
                Object value = ((JavaScriptException)cause).getValue();
                Context.enter();
                System.err.println(Context.toString(value));
                System.err.println(((JavaScriptException)cause).getScriptStackTrace());
                Context.exit();
            } else if (cause instanceof RhinoException) {
                RhinoException re = (RhinoException)cause;
                System.err.println(re.details());
                System.err.println(re.getScriptStackTrace());
            } else {
                System.err.println(cause.getMessage());
            }
            cause.printStackTrace(System.err);
            exitCode = 104;
        } catch (NodeException ne) {
            ne.printStackTrace(System.err);
            exitCode = 105;
        } finally {
            env.close();
        }

        System.exit(exitCode);
    }
View Full Code Here

Examples of io.apigee.trireme.core.NodeEnvironment

    protected Scriptable module;
    protected NodeEnvironment env;

    public HadoopBase()
    {
        env = new NodeEnvironment();
    }
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

    }

    public static void main(String[] args) throws Exception {
        Environment environment = new Environment();
        Settings settings = EMPTY_SETTINGS;
        NodeEnvironment nodeEnvironment = new NodeEnvironment(settings, environment);
        ByteBufferCache byteBufferCache = new ByteBufferCache(settings);

        ShardId shardId = new ShardId(new Index("index"), 1);
        String type = args.length > 0 ? args[0] : "ram";
        Store store;
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

        assertThat(shardDirectory("server3", "test", 0).exists(), equalTo(true));
    }

    private File shardDirectory(String server, String index, int shard) {
        InternalNode node = ((InternalNode) node(server));
        NodeEnvironment env = node.injector().getInstance(NodeEnvironment.class);
        return env.shardLocation(new ShardId(index, shard));
    }
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

        return buildNode.name;
    }

    private void publishNode(NodeAndClient nodeAndClient) {
        assert !nodeAndClient.node().isClosed();
        NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, nodeAndClient.node);
        if (nodeEnv.hasNodeFile()) {
            dataDirToClean.addAll(Arrays.asList(nodeEnv.nodeDataLocations()));
        }
        nodes.put(nodeAndClient.name, nodeAndClient);

    }
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

    public void setup() throws Exception {
        dataPath = Files.createTempDirectory(null);
        Settings settings = ImmutableSettings.builder()
                .put("path.data", dataPath.toAbsolutePath()).build();
        Environment environment = new Environment(settings);
        nodeEnvironment = new NodeEnvironment(settings, environment);
        blobEnvironment = new BlobEnvironment(settings, nodeEnvironment, new ClusterName("test"));
    }
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

            Settings newSettings = callback.onNodeStopped(name);
            if (newSettings == null) {
                newSettings = ImmutableSettings.EMPTY;
            }
            if (callback.clearData(name)) {
                NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node);
                if (nodeEnv.hasNodeFile()) {
                    FileSystemUtils.deleteRecursively(nodeEnv.nodeDataLocations());
                }
            }
            node = (InternalNode) nodeBuilder().settings(node.settings()).settings(newSettings).node();
            resetClient();
        }
View Full Code Here

Examples of org.elasticsearch.env.NodeEnvironment

            when(networkService.stats()).thenReturn(networkStats);
            bind(NetworkService.class).toInstance(networkService);

            bind(NodeService.class).toInstance(nodeService);

            NodeEnvironment nodeEnv = mock(NodeEnvironment.class);
            File[] dataLocations = new File[]{ new File("/foo"), new File("/bar") };
            when(nodeEnv.hasNodeFile()).then(new Answer<Boolean>() {
                @Override
                public Boolean answer(InvocationOnMock invocation) throws Throwable {
                    return isDataNode;
                }
            });
            when(nodeEnv.nodeDataLocations()).thenReturn(dataLocations);
            bind(NodeEnvironment.class).toInstance(nodeEnv);

            Sigar sigar = mock(Sigar.class);
            SigarService sigarService = mock(SigarService.class);
            when(sigarService.sigarAvailable()).then(new Answer<Boolean>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.