Skip to content

Instantly share code, notes, and snippets.

@srdo
srdo / gist:566a34df2dc4993529b2b21cacb8160d
Created February 20, 2019 15:32
owasp plugin repositories error
$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] owasp-repositories-example [pom]
[INFO] child [jar]
[INFO]
[INFO] -------------< io.github.srdo:owasp-repositories-example >--------------
[INFO] Building owasp-repositories-example 1.0-SNAPSHOT [1/2]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@srdo
srdo / gist:e2a75d45a227f1a43e96cd38ab7194d3
Created May 5, 2018 11:54
Example KafkaConsumer read and commit
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "consumer-test");
props.put("enable.auto.commit", "false");
props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1);
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
Set<TopicPartition> assignedPartitions = Collections.singleton(new TopicPartition(TOPIC, 0));
consumer.assign(assignedPartitions);
package com.mycompany.scratch;
public class NewClass2 {
public static class BrokenClass {
public static final BrokenClass instance = new BrokenClass();
private BrokenClass() {
throw new RuntimeException("Broken");
}
package com.schneiderelectric.test2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
Set<String> myStrings = new HashSet<>();
myStrings.add("abc");
myStrings.add("def");
Collection<String> otherStrings = new ArrayList<>();
otherStrings.add("def");
assertThat("Expected unequal sets", otherStrings, not(containsInAnyOrder(myStrings)));
otherStrings.add("abc");
assertThat("Expected equal sets", otherStrings, containsInAnyOrder(myStrings));
//Fails on the second assert, prints the missing entry in the assertion error