Skip to content

Instantly share code, notes, and snippets.

View Opalo's full-sized avatar

Maciek Opala Opalo

View GitHub Profile
@Opalo
Opalo / wrapper.java
Last active November 27, 2018 16:26
@Slf4j
@Component
class DomainExceptionWrapper extends DefaultErrorAttributes {
private final ReqTracer tracer;
DomainExceptionWrapper(ReqTracer tracer) {
super(false);
this.tracer = tracer;
}
@ToString(callSuper = true)
abstract class DomainException extends ResponseStatusException {
DomainException(HttpStatus status, String reason) {
super(status, reason);
}
}
abstract class DomainExceptionWithErrors extends DomainException implements HasDomainErrors {
@Getter
private final MapBindingResult bindingResult;
DomainExceptionWithErrors(HttpStatus status, String reason) {
this(status, reason, null, null);
}
DomainExceptionWithErrors(HttpStatus status, String reason, String objectName) {
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with defaults
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo
{
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "8454623c-6fdf-46f2-bdb6-5d6cbfd863d6",
"SequenceNumber": "18843733094220783616"
}
// receive a message with defaults
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo
def input = "Application!01.01.01 TestSuite1,TestSuite2,TestSuite3,TestSuite4 Product!01.01.01,Product2!01.01.02"
def groups = input.split(' ')
def applications = groups[0].split(',').collect { it.split('!') }.collectEntries { [(it[0]):it[1]] }
def suites = groups[1].split(',')
def products = groups[2].split(',').collect { it.split('!') }.collectEntries { [(it[0]):it[1]] }
pomPostProcess := { (node: Node) =>
// ...
}
lazy val generatorDependencies = Seq(
"com.typesafe.slick" %% "slick-codegen" % "3.3.0",
"org.slf4j" % "log4j-over-slf4j" % "1.7.26",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"ch.qos.logback" % "logback-core" % "1.2.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
)
pomPostProcess := { input: Node =>
new RuleTransformer(new RewriteRule {
override def transform(node: Node): NodeSeq = node match {
case e: Elem if e.label == "dependency" && isGeneratorDependency(findChild(e, "groupId"), findChild(e, "artifactId")) =>
def txt(label: String): String = "\"" + e.child.filter(_.label == label).flatMap(_.text).mkString + "\""
Comment(s""" Generator dependency ${txt("groupId")} % ${txt("artifactId")} % ${txt("version")} has been omitted """)
case _ => node
}
enablePlugins(FlywayPlugin)
flywayUser := "root"
flywayPassword := "root"
flywayUrl := "jdbc:mysql://localhost:3306/test"