Skip to content

Instantly share code, notes, and snippets.

View andrealaforgia's full-sized avatar

Andrea Laforgia andrealaforgia

View GitHub Profile
@andrealaforgia
andrealaforgia / deployment-tool-ansible-puppet-chef-salt.md
Created May 2, 2017 20:28 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@andrealaforgia
andrealaforgia / LogRule.java
Created February 28, 2020 21:30 — forked from geowarin/LogRule.java
Junit rule that allows capturing Logs output in the Class under test during unit testing
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
@andrealaforgia
andrealaforgia / BitOutputStream.java
Created July 25, 2020 17:04
A skeleton for the BitOutputStream class
package tdd.huffman;
import java.io.IOException;
import java.io.OutputStream;
import static tdd.huffman.Bit;
public class BitOutputStream {
public void write(Bit bit) {
@andrealaforgia
andrealaforgia / BitOutputStreamTest.java
Last active July 25, 2020 19:40
Unit tests for the BitOutputStream class
package tdd.huffman;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import static java.util.Arrays.asList;
@andrealaforgia
andrealaforgia / BitOutputStream.java
Created July 25, 2020 17:15
BitOutputStream class
package tdd.huffman;
import java.io.IOException;
import java.io.OutputStream;
import static tdd.huffman.Bit.one;
import static tdd.huffman.Bit.zero;
public class BitOutputStream {
@andrealaforgia
andrealaforgia / BinaryTree.java
Last active July 31, 2020 00:34
A generic BinaryTree class
public class BinaryTree<T> {
public static<T> BinaryTree<T> newTerminalNode(T nodeValue) {
throw new UnsupportedOperationException();
}
public static<T> BinaryTree<T> newNonTerminalNode(BinaryTree<T> leftTree, BinaryTree<T> rightTree) {
throw new UnsupportedOperationException();
}
@andrealaforgia
andrealaforgia / BinaryTreeTest.java
Last active July 31, 2020 00:12
A BinaryTree test class
package tdd.huffman;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
@andrealaforgia
andrealaforgia / BinaryTree.java
Created July 30, 2020 23:41
BinaryTree class with added methods
public class BinaryTree<T> {
public static<T> BinaryTree<T> newTerminalNode(T nodeValue) {
throw new UnsupportedOperationException();
}
public static<T> BinaryTree<T> newNonTerminalNode(BinaryTree<T> leftTree, BinaryTree<T> rightTree) {
throw new UnsupportedOperationException();
}
package tdd.huffman;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Value;
import java.util.function.Consumer;
public class BinaryTree<T> {
package tdd.huffman;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Value;
import java.util.function.Consumer;
@Value
@AllArgsConstructor(access = AccessLevel.PRIVATE)