This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package us.juggl.twentysixteen.august; | |
| import java.nio.file.Files; | |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| import java.time.Instant; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.UUID; | |
| import java.util.concurrent.ConcurrentHashMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SecureRandom; | |
| import java.util.Base64; | |
| class LDAPUtil { | |
| /** | |
| * Hash the provided password using SHA-1 and return base64 encoded password hash | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DROP FUNCTION json_patch(_data TEXT, _patch TEXT) | |
| /* | |
| * On the PostgreSQL host, you will need to install: | |
| * postgresql95-plpython (RedHat/CentOS) | |
| * postgresql-plpython-9.5 (Ubuntu/Debian) | |
| * You will also need to install the jsonpatch library using either easy_install or pip | |
| * pip install jsonpatch | |
| * easy_install jsonpatch | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !! | |
| !! Implementation of JSONPatch (http://jsonpatch.com/) using PostgreSQL >= 9.5 | |
| !! | |
| CREATE OR REPLACE FUNCTION jsonb_copy(JSONB, TEXT[], TEXT[]) RETURNS JSONB AS $$ | |
| DECLARE | |
| retval ALIAS FOR $1; | |
| src_path ALIAS FOR $2; | |
| dst_path ALIAS FOR $3; | |
| tmp_value JSONB; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A {@link GroovyVerticle} which handles status requests | |
| */ | |
| class Status extends GroovyVerticle { | |
| // JaCoCo Coverage report shows 3 of 6 branches missed on this logging definition!!!! | |
| static final LOG = LoggerFactory.getLogger(Status.class.canonicalName) | |
| static final CACHE_INTERVAL = 30 * 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AmbassadorsService.createProxy = function(vertx, ebAddress) { | |
| var __args = arguments; | |
| // The `__args[0]._jdel` object is `undefined`... | |
| if (__args.length === 2 && typeof __args[0] === 'object' && __args[0]._jdel && typeof __args[1] === 'string') { | |
| if (closed) { | |
| throw new Error('Proxy is closed'); | |
| } | |
| j_eb.send(j_address, {"vertx":__args[0], "ebAddress":__args[1]}, {"action":"createProxy"}); | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SomeVerticle extends AbstractVerticle { | |
| public void start() { | |
| vertx.eventBus().send(SOME_ADDRESS, myMessage, response -> { | |
| vertx.eventBus().send(ANOTHER_ADDRESS, anotherMessage, res2 -> { | |
| // Ad infinitum.... | |
| }); | |
| }); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io.netty.handler.codec.http.HttpResponseStatus; | |
| import io.vertx.core.AbstractVerticle; | |
| import io.vertx.core.Future; | |
| import io.vertx.core.json.JsonObject; | |
| import io.vertx.ext.web.Router; | |
| import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR; | |
| import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND; | |
| import static io.netty.handler.codec.http.HttpResponseStatus.OK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.rantue.server; | |
| import io.netty.handler.codec.http.HttpResponseStatus; | |
| import io.vertx.core.AbstractVerticle; | |
| import io.vertx.core.AsyncResult; | |
| import io.vertx.core.Future; | |
| import io.vertx.core.Handler; | |
| import io.vertx.core.buffer.Buffer; | |
| import io.vertx.core.eventbus.Message; | |
| import io.vertx.core.json.JsonObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io.vertx.core.Vertx | |
| import io.vertx.core.http.RequestOptions | |
| import spock.lang.Specification | |
| import spock.util.concurrent.AsyncConditions | |
| class AsyncExampleSpec extends Specification { | |
| def "Async request for google.com should return proper page content"() { | |
| given: "An async HTTP client" | |
| def client = Vertx.vertx().createHttpClient() | |
| and: "Some HTTP request options" |