Skip to content

Commit fb3fb44

Browse files
committed
Reenabled android tests and moved ExtendedAsynchronousByteChannel
Moved ExtendedAsynchronousByteChannel to com.mongodb.internal.connection The dex'ing process didn't like it being referenced in a higher package when the code was split across dex files. JAVA-3142
1 parent b0f6e88 commit fb3fb44

File tree

5 files changed

+82
-83
lines changed

5 files changed

+82
-83
lines changed

.evergreen/run-embedded-tests-android.sh

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -7,83 +7,83 @@
77
# Main Program #
88
############################################
99

10-
#SDK_HOME=$PWD/.android
11-
#if [ ! -e $SDK_HOME ]; then
12-
# echo "Installing ANDROID SDK"
13-
# DOWNLOAD_LOGS=${SDK_HOME}/download_logs
14-
# mkdir -p $SDK_HOME
15-
# mkdir -p $DOWNLOAD_LOGS
16-
# (
17-
# cd $SDK_HOME
18-
# export JAVA_HOME="/opt/java/jdk8"
19-
#
20-
# export ANDROID_HOME=${SDK_HOME}
21-
# export ANDROID_SDK_ROOT=${SDK_HOME}
22-
# export ANDROID_SDK_HOME=${SDK_HOME}
23-
#
24-
# SDK_PACKAGE=sdk-tools-linux-4333796.zip
25-
# curl -O -s https://dl.google.com/android/repository/$SDK_PACKAGE
26-
# unzip -o -qq $SDK_PACKAGE
27-
# yes | $SDK_HOME/tools/bin/sdkmanager --channel=0 \
28-
# "platforms;android-28" \
29-
# "emulator" \
30-
# "patcher;v4" \
31-
# "platform-tools" \
32-
# "build-tools;28.0.0" \
33-
# "system-images;android-21;google_apis;x86_64"
34-
#
35-
# $SDK_HOME/tools/bin/sdkmanager --update
36-
# PLATFORM_TOOLS=platform-tools-latest-linux.zip
37-
# curl -O -s https://dl.google.com/android/repository/$PLATFORM_TOOLS
38-
# unzip -o -qq $PLATFORM_TOOLS
39-
# ) &> $DOWNLOAD_LOGS/download.log
40-
#fi
41-
#
42-
#(
43-
# export JAVA_HOME="/opt/java/jdk8"
44-
#
45-
# export ANDROID_HOME=${SDK_HOME}
46-
# export ANDROID_SDK_ROOT=${SDK_HOME}
47-
# export ANDROID_SDK_HOME=${SDK_HOME}
48-
#
49-
# echo no | $SDK_HOME/tools/bin/avdmanager create avd -n embeddedTest_x86_64 -c 1000M -k "system-images;android-21;google_apis;x86_64" -f
50-
# $SDK_HOME/tools/emulator -avd embeddedTest_x86_64 -no-audio -no-window -no-snapshot -wipe-data -no-accel -gpu off &
51-
# $SDK_HOME/platform-tools/adb wait-for-device
52-
#
53-
# # Belt and braces waiting for the device
54-
# bootanim=""
55-
# failcounter=0
56-
# timeout_in_sec=360
57-
#
58-
# until [[ "$bootanim" =~ "stopped" ]]; do
59-
# bootanim=`$SDK_HOME/platform-tools/adb -e shell getprop init.svc.bootanim 2>&1 &`
60-
# if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
61-
# || "$bootanim" =~ "running" ]]; then
62-
# let "failcounter += 1"
63-
# if [[ "$failcounter" -gt timeout_in_sec ]]; then
64-
# echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
65-
# exit 1
66-
# elif (( "$failcounter" % 10 )); then
67-
# echo "Waiting for emulator to start"
68-
# fi
69-
# fi
70-
# sleep 5
71-
# done
72-
# echo "Emulator is ready"
73-
#)
74-
#
75-
#export JAVA_HOME="/opt/java/jdk9"
76-
#export ANDROID_HOME=${SDK_HOME}
77-
#
78-
#function shutdownEmulators {
79-
# retVal=$?
80-
# $SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1 | while read line; do $SDK_HOME/platform-tools/adb -s $line emu kill; done;
81-
# exit $retVal
82-
#}
83-
#
84-
#trap shutdownEmulators EXIT
85-
#
86-
#echo "Running android tests"
87-
#./gradlew -version
88-
#./gradlew --stacktrace --info :driver-embedded-android:connectedAndroidTest -DANDROID_HOME=$SDK_HOME
89-
#
10+
SDK_HOME=$PWD/.android
11+
if [ ! -e $SDK_HOME ]; then
12+
echo "Installing ANDROID SDK"
13+
DOWNLOAD_LOGS=${SDK_HOME}/download_logs
14+
mkdir -p $SDK_HOME
15+
mkdir -p $DOWNLOAD_LOGS
16+
(
17+
cd $SDK_HOME
18+
export JAVA_HOME="/opt/java/jdk8"
19+
20+
export ANDROID_HOME=${SDK_HOME}
21+
export ANDROID_SDK_ROOT=${SDK_HOME}
22+
export ANDROID_SDK_HOME=${SDK_HOME}
23+
24+
SDK_PACKAGE=sdk-tools-linux-4333796.zip
25+
curl -O -s https://dl.google.com/android/repository/$SDK_PACKAGE
26+
unzip -o -qq $SDK_PACKAGE
27+
yes | $SDK_HOME/tools/bin/sdkmanager --channel=0 \
28+
"platforms;android-28" \
29+
"emulator" \
30+
"patcher;v4" \
31+
"platform-tools" \
32+
"build-tools;28.0.0" \
33+
"system-images;android-21;google_apis;x86_64"
34+
35+
$SDK_HOME/tools/bin/sdkmanager --update
36+
PLATFORM_TOOLS=platform-tools-latest-linux.zip
37+
curl -O -s https://dl.google.com/android/repository/$PLATFORM_TOOLS
38+
unzip -o -qq $PLATFORM_TOOLS
39+
) &> $DOWNLOAD_LOGS/download.log
40+
fi
41+
42+
(
43+
export JAVA_HOME="/opt/java/jdk8"
44+
45+
export ANDROID_HOME=${SDK_HOME}
46+
export ANDROID_SDK_ROOT=${SDK_HOME}
47+
export ANDROID_SDK_HOME=${SDK_HOME}
48+
49+
echo no | $SDK_HOME/tools/bin/avdmanager create avd -n embeddedTest_x86_64 -c 1000M -k "system-images;android-21;google_apis;x86_64" -f
50+
$SDK_HOME/tools/emulator -avd embeddedTest_x86_64 -no-audio -no-window -no-snapshot -wipe-data -no-accel -gpu off &
51+
$SDK_HOME/platform-tools/adb wait-for-device
52+
53+
# Belt and braces waiting for the device
54+
bootanim=""
55+
failcounter=0
56+
timeout_in_sec=360
57+
58+
until [[ "$bootanim" =~ "stopped" ]]; do
59+
bootanim=`$SDK_HOME/platform-tools/adb -e shell getprop init.svc.bootanim 2>&1 &`
60+
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
61+
|| "$bootanim" =~ "running" ]]; then
62+
let "failcounter += 1"
63+
if [[ "$failcounter" -gt timeout_in_sec ]]; then
64+
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
65+
exit 1
66+
elif (( "$failcounter" % 10 )); then
67+
echo "Waiting for emulator to start"
68+
fi
69+
fi
70+
sleep 5
71+
done
72+
echo "Emulator is ready"
73+
)
74+
75+
export JAVA_HOME="/opt/java/jdk9"
76+
export ANDROID_HOME=${SDK_HOME}
77+
78+
function shutdownEmulators {
79+
retVal=$?
80+
$SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1 | while read line; do $SDK_HOME/platform-tools/adb -s $line emu kill; done;
81+
exit $retVal
82+
}
83+
84+
trap shutdownEmulators EXIT
85+
86+
echo "Running android tests"
87+
./gradlew -version
88+
./gradlew --stacktrace --info :driver-embedded-android:connectedAndroidTest -DANDROID_HOME=$SDK_HOME
89+

driver-core/src/main/com/mongodb/internal/connection/AsynchronousChannelStream.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.mongodb.connection.BufferProvider;
2727
import com.mongodb.connection.SocketSettings;
2828
import com.mongodb.connection.Stream;
29-
import com.mongodb.internal.connection.tlschannel.async.ExtendedAsynchronousByteChannel;
3029
import org.bson.ByteBuf;
3130

3231
import java.io.IOException;

driver-core/src/main/com/mongodb/internal/connection/AsynchronousSocketChannelStream.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.mongodb.connection.BufferProvider;
2424
import com.mongodb.connection.SocketSettings;
2525
import com.mongodb.connection.Stream;
26-
import com.mongodb.internal.connection.tlschannel.async.ExtendedAsynchronousByteChannel;
2726

2827
import java.io.IOException;
2928
import java.net.SocketAddress;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* https://github.com/marianobarrios/tls-channel
1818
*/
1919

20-
package com.mongodb.internal.connection.tlschannel.async;
20+
package com.mongodb.internal.connection;
2121

2222
import java.nio.ByteBuffer;
2323
import java.nio.channels.AsynchronousByteChannel;

driver-core/src/main/com/mongodb/internal/connection/tlschannel/async/AsynchronousTlsChannel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package com.mongodb.internal.connection.tlschannel.async;
2121

22+
import com.mongodb.internal.connection.ExtendedAsynchronousByteChannel;
2223
import com.mongodb.internal.connection.tlschannel.TlsChannel;
2324
import com.mongodb.internal.connection.tlschannel.impl.ByteBufferSet;
2425

0 commit comments

Comments
 (0)