Package org.graylog2.inputs.codecs

Examples of org.graylog2.inputs.codecs.GelfCodec$Config


        final Map<Node, EmptyResponse> emptyResponses = api.put().path("/").executeOnAll();

        assertTrue("Request should have failed", emptyResponses.isEmpty());
        final List<Node> nodes = serverNodes.all(true);
        Node failedNode = nodes.get(0);
        Node failedNode2 = nodes.get(1);
        assertFalse("Node should be inactive" , failedNode.isActive());
        assertFalse("Node should be inactive", failedNode2.isActive());
        assertEquals(1, failedNode.getFailureCount());
        assertEquals(1, failedNode2.getFailureCount());
    }
View Full Code Here


    public void testNodeObjectsRememberedByAddress() throws Exception {
        final AddressNodeId addressNodeId = AddressNodeId.create("http://localhost:65535", UUID.randomUUID().toString());
        setupNodes(addressNodeId);

        api.setHttpClient(client);
        final Node firstNode = serverNodes.any();

        Throwable t = null;
        try {
            api.put().path("/").node(firstNode).execute();
        } catch (Graylog2ServerUnavailableException e) {
            t = e;
        }
        assertNotNull("Should have thrown an Graylog2ServerUnavailableException", t);
        assertEquals("First node failure count should be 1", 1, firstNode.getFailureCount());

        final Node.Factory nodeFactory = injector.getInstance(Node.Factory.class);
        final NodeSummaryResponse r1 = new NodeSummaryResponse();
        r1.transportAddress = "http://localhost:65534";
        r1.id = UUID.randomUUID().toString();

        final Node newNode = nodeFactory.fromSummaryResponse(r1);
        newNode.touch();
        final NodeSummaryResponse r2 = new NodeSummaryResponse();
        r2.transportAddress = firstNode.getTransportAddress();
        r2.id = firstNode.getNodeId();
        final Node sameAsInitialNode = nodeFactory.fromSummaryResponse(r2);
        sameAsInitialNode.touch();
        serverNodes.put(ImmutableList.of(newNode, sameAsInitialNode));

        final Map<Node, EmptyResponse> responses = api.put().nodes(serverNodes.all().toArray(new Node[0])).path("/").executeOnAll();

        assertTrue(responses.isEmpty());
View Full Code Here

    @Test
    public void testBuildTarget() throws Exception {
        setupNodes(AddressNodeId.create("http://horst:12900"));

        // we only have one node configured here
        final Node node = serverNodes.any();
        api.setHttpClient(client);

        final URL url = api.get(EmptyResponse.class).path("/some/resource").session("foo").node(node).prepareUrl(node);
        final URL queryParamWithPlus = api.get(EmptyResponse.class).path("/some/resource").queryParam("query", " (.+)").node(node).unauthenticated().prepareUrl(node);
View Full Code Here

    @Test
    public void testSingleExecute() throws Exception {
        setupNodes(AddressNodeId.create("http://horst:12900"));

        // we only have one node configured here
        final Node node = serverNodes.any();
        api.setHttpClient(client);

        final ApiRequestBuilder<EmptyResponse> requestBuilder =
                api.get(EmptyResponse.class)
                        .path("/some/resource")
View Full Code Here

    public void testParallelExecution() throws Exception {
        setupNodes(AddressNodeId.create("http://horst1:12900"), AddressNodeId.create("http://horst2:12900"));

        final Collection<Node> nodes = serverNodes.all();
        final Iterator<Node> it = nodes.iterator();
        Node node1 = it.next();
        Node node2 = it.next();
        api.setHttpClient(client);

        final ApiRequestBuilder<EmptyResponse> requestBuilder = api.get(EmptyResponse.class).path("/some/resource");
        final URL url1 = requestBuilder.prepareUrl(node1);
        final URL url2 = requestBuilder.prepareUrl(node2);
View Full Code Here

        final ArrayList<Node> nodes = Lists.newArrayList();
        for (AddressNodeId n : nodeDesc) {
            NodeSummaryResponse r = new NodeSummaryResponse();
            r.transportAddress = n.address;
            r.id = n.nodeId;
            final Node node = factory.fromSummaryResponse(r);
            node.touch();
            nodes.add(node);
        }
        serverNodes.put(nodes);
    }
View Full Code Here

public class SearchRouteHelper {

    public static Call getRoute(UniversalSearch search,
                                Http.Request request,
                                int page) {
        SearchSort order = search.getOrder();
        return getRoute(search, request, page, order.getField(), order.getDirection().toString().toLowerCase());
    }
View Full Code Here

            case EMAIL_TRANSPORT_FAILED:
                return new EmailTransportFailedNotification(notification);
            case STREAM_PROCESSING_DISABLED:
                String streamTitle;
                try {
                    final Stream stream = streamService.get(notification.getDetail("stream_id").toString());
                    streamTitle = stream.getTitle();
                } catch (APIException | IOException e) {
                    streamTitle = "(Stream title unavailable)";
                }
                int faultCount = (int) notification.getDetail("fault_count");
                return new StreamProcessingDisabledNotification(notification, streamTitle, faultCount);
View Full Code Here

    public static SessionService sessionService;

    @Override
    public String getUsername(Context ctx) {
        try {
            final User sessionUser = pipelineAuths(authenticateSessionUser(), authenticateBasicAuthUser());
            if (sessionUser == null) {
                return null;
            }
            return sessionUser.getName();
        } catch (Graylog2ServerUnavailableException e) {
            ctx.args.put(GRAYLOG_2_SERVER_MISSING_KEY, e);
            return null;
        }
    }
View Full Code Here

    }

    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        // the current user has been previously loaded via doGetAuthenticationInfo before, use those permissions
        User user = UserService.current();
        if (!principals.getPrimaryPrincipal().equals(user.getName())) {
            log.info("retrieving loaded user {} from per-request user cache", principals.getPrimaryPrincipal());
            user = (User) Http.Context.current().args.get("perRequestUsersCache:" + principals.getPrimaryPrincipal().toString());
            if (user == null) {
                log.error("Cannot find previously loaded user, need to load it explicitely. This is unimplemented.");
                return null;
            }
        }
        final List<String> permissions = user.getPermissions();
        final SimpleAuthorizationInfo authzInfo = new SimpleAuthorizationInfo();
        if (log.isTraceEnabled()) {
            log.trace("Permissions for {} are {}", user.getName(), Ordering.natural().sortedCopy(user.getPermissions()));
        }
        authzInfo.setStringPermissions(Sets.newHashSet(permissions));
        return authzInfo;
    }
View Full Code Here

TOP

Related Classes of org.graylog2.inputs.codecs.GelfCodec$Config

Copyright © 2018 www.massapicom. 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.