Skip to content

Instantly share code, notes, and snippets.

View sizovs's full-sized avatar
🌴
Mentoring software developers @ principal.dev

Eduards Sizovs sizovs

🌴
Mentoring software developers @ principal.dev
View GitHub Profile
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.HttpResponseException
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.2')
version = args[0]
if (!version) {
throw new IllegalArgumentException("No version specified")
}
archive = "askfm-node-$version-docker.zip"
host = 'http://172.16.0.2:8081'
pattern = ~/.*---(.*)$/
def droppables = []
manager.build.logFile.eachLine { line ->
matcher = pattern.matcher(line)
if(matcher.matches()) {
droppables << matcher.group(1)
}
}
pattern = ~/.*<!>(.*)$/
Map dropConditions = [
new_do_stuff_toggled : { cfg("new_do_stuff.enabled") == "true" },
marketing_campaign_finished : { timeCame "09/04/2014" }
]
def timeCame(String date) {
def today = new Date()
def expirationDate = new Date().parse('dd/MM/yyyy', date)
today.after expirationDate
}
new File('.').eachFileRecurse(groovy.io.FileType.FILES) {
if (it.name.endsWith(".java")) {
def hits = it.text =~ /\/\/\s*DROP\s*\[\s*(.*)\s*\]\n/
hits.each { match, key ->
def dropConditionForAGivenKey = dropConditions[(key)]
if (!dropConditionForAGivenKey) {
println("<!> Cannot find drop conditions for key '$key'")
return
}
try {
def cfg(key) {
def uri = "http://production.configuration/$key".toURL()
uri.getText(connectTimeout: 2000, readTimeout: 3000)
}
def timeCame(String date) {
def today = new Date()
def expirationDate = new Date().parse('dd/MM/yyyy', date)
today.after expirationDate
}
Map dropConditions = [
new_do_stuff_toggled : { cfg("new_do_stuff.enabled") == "true" },
marketing_campaign_finished : { timeCame "09/04/2014" }
]
void doStuff() {
if (newImplementation.isToggled()) {
doStuffInANewWay();
} else {
// DROP [new_do_stuff_toggled]
doStuffInAnOldWay();
}
}
// DROP [marketing_campaign_finished]
package fm.ask.dao.user.auth;
import com.google.common.collect.ImmutableMap;
import com.rubylight.dao.ChunkQueryNotTotalMySQL;
import com.rubylight.dao.DAOAppException;
import com.rubylight.dao.DAOSysException;
import com.rubylight.dao.IChunkQueryDefinition;
import com.rubylight.dao.connection.IConnectionLookup;
import com.rubylight.entity.IChunkProperties;
import com.rubylight.entity.IListChunk;
Feature: Mailbox
Scenario: Registered users have a new message in the mailbox #1
Given I am "Johnny"
When I check my mailbox
Then I should have a "Welcome Johnny" message
Scenario: Registered users have a new message in the mailbox #2
Given I am "Eduards"
When I check my mailbox