-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
141 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ | |
|
||
import static com.segment.analytics.Utils.createTraits; | ||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.anyDouble; | ||
import static org.mockito.Matchers.anyString; | ||
import static org.mockito.MockitoAnnotations.initMocks; | ||
import static org.powermock.api.mockito.PowerMockito.mockStatic; | ||
import static org.powermock.api.mockito.PowerMockito.when; | ||
|
@@ -99,14 +101,17 @@ public void identify() throws Exception { | |
@Test | ||
public void track() throws Exception { | ||
Traits traits = createTraits("foo").putEmail("[email protected]"); | ||
|
||
TrackPayload trackPayload = | ||
new TrackPayloadBuilder().traits(traits).build(); | ||
|
||
PowerMockito.doNothing().when(Leanplum.class, "track", "", ""); | ||
PowerMockito.doNothing().when(Leanplum.class, "track", anyString(), anyString()); | ||
Leanplum.track(trackPayload.event(), trackPayload.properties()); | ||
|
||
PowerMockito.verifyStatic(Mockito.times(1)); | ||
trackPayload.properties().putValue(10); | ||
PowerMockito.doNothing().when(Leanplum.class, "track", anyString(), anyDouble(), anyString()); | ||
integration.track(trackPayload); | ||
PowerMockito.verifyStatic(Mockito.times(2)); | ||
} | ||
|
||
@Test | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
#set -x | ||
|
||
# Set magic variables for current file & dir | ||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")" | ||
__base="$(basename ${__file} .sh)" | ||
__root="$(cd "$(dirname "${__dir}")" && pwd)" | ||
|
||
echo $__dir | ||
|
||
HR="--------------------------------------------------------------------------------\n" | ||
|
||
# Use colors, but only if connected to a terminal, and that terminal | ||
# supports them. | ||
if which tput >/dev/null 2>&1; then | ||
ncolors=$(tput colors) | ||
fi | ||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | ||
R="$(tput setaf 1)" | ||
G="$(tput setaf 2)" | ||
B="$(tput setaf 4)" | ||
Y="$(tput setaf 3)" | ||
BD="$(tput bold)" | ||
N="$(tput sgr0)" | ||
else | ||
R="" | ||
G="" | ||
B="" | ||
Y="" | ||
BD="" | ||
N="" | ||
fi | ||
|
||
# Ask a Question, https://gist.github.com/davejamesmiller/1965569 | ||
function ask() { | ||
while true; do | ||
if [ "${2:-}" = "Y" ]; then | ||
prompt="Y/n" | ||
default=Y | ||
elif [ "${2:-}" = "N" ]; then | ||
prompt="y/N" | ||
default=N | ||
else | ||
prompt="y/n" | ||
default= | ||
fi | ||
|
||
# Ask the question (not using "read -p" as it uses stderr not stdout) | ||
echo "$1 [$prompt] " | ||
|
||
# Read the answer (use /dev/tty in case stdin is redirected from somewhere else) | ||
read REPLY </dev/tty | ||
|
||
# Default? | ||
if [ -z "$REPLY" ]; then | ||
REPLY=$default | ||
fi | ||
|
||
# Check if the reply is valid | ||
case "$REPLY" in | ||
Y*|y*) return 0 ;; | ||
N*|n*) return 1 ;; | ||
esac | ||
done | ||
} | ||
|
||
function replace_version() { | ||
sed -i '' -e "s|$2|$3|g" "$__dir/$1" | ||
env git status --porcelain 2>/dev/null| grep "$(basename "$1")" || { | ||
echo "${R}Error patching version info in file: $__dir/$1${N}" && exit 1 | ||
} | ||
echo "Updated versions in file: $1" | ||
} | ||
|
||
function main() { | ||
read -p "${B}Enter the new version number: ${N}" VERSION_NEW | ||
replace_version "README.md" "{{LP_SEG_VERSION}}" $VERSION_NEW | ||
replace_version "gradle.properties" "{{LP_SEG_VERSION}}" $VERSION_NEW | ||
} | ||
|
||
main |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Mon Dec 28 10:00:20 PST 2015 | ||
#Tue Dec 13 17:25:16 CET 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip |