Skip to content

Commit

Permalink
[FGJ-4] CI tests for FabCar Java sample
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
Change-Id: I2b28c69a2f3ec0e3d87252ef4a585b4a46fddcbd
  • Loading branch information
Simon Stone committed Jul 30, 2019
1 parent 81be9da commit 13f16e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion fabcar/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</repositories>
<dependencies>
<dependency>
<groupId>org.hyperledger.fabric</groupId>
<groupId>org.hyperledger.fabric-gateway-java</groupId>
<artifactId>fabric-gateway-java</artifactId>
<version>1.4.0-SNAPSHOT</version>
</dependency>
Expand Down
48 changes: 28 additions & 20 deletions scripts/ci_scripts/fabcar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi
cd $WORKSPACE/$BASE_DIR/fabcar || exit
export PATH=gopath/src/github.com/hyperledger/fabric-samples/bin:$PATH

LANGUAGES="go javascript typescript"
LANGUAGES="go java javascript typescript"
for LANGUAGE in ${LANGUAGES}; do
echo -e "\033[1m ${LANGUAGE} Test\033[0m"
echo -e "\033[32m starting fabcar test (${LANGUAGE})" "\033[0m"
Expand All @@ -36,26 +36,34 @@ for LANGUAGE in ${LANGUAGES}; do
# If an application exists for this language, test it
if [ -d ${LANGUAGE} ]; then
pushd ${LANGUAGE}
if [ ${LANGUAGE} = "javascript" ]; then
COMMAND=node
PREFIX=
SUFFIX=.js
npm install
elif [ ${LANGUAGE} = "typescript" ]; then
COMMAND=node
PREFIX=dist/
SUFFIX=.js
npm install
npm run build
if [ ${LANGUAGE} = "javascript" -o ${LANGUAGE} = "typescript" ]; then
if [ ${LANGUAGE} = "javascript" ]; then
COMMAND=node
PREFIX=
SUFFIX=.js
npm install
elif [ ${LANGUAGE} = "typescript" ]; then
COMMAND=node
PREFIX=dist/
SUFFIX=.js
npm install
npm run build
fi
${COMMAND} ${PREFIX}enrollAdmin${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-enrollAdmin
${COMMAND} ${PREFIX}registerUser${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-registerUser
${COMMAND} ${PREFIX}query${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-query
${COMMAND} ${PREFIX}invoke${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-invoke
elif [ ${LANGUAGE} = "java" ]; then
mvn test
copy_logs $? fabcar-${LANGUAGE}
else
echo -e "\033[31m do not know how to handle ${LANGUAGE}" "\033[0m"
exit 1
fi
${COMMAND} ${PREFIX}enrollAdmin${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-enrollAdmin
${COMMAND} ${PREFIX}registerUser${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-registerUser
${COMMAND} ${PREFIX}query${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-query
${COMMAND} ${PREFIX}invoke${SUFFIX}
copy_logs $? fabcar-${LANGUAGE}-invoke
popd
fi
docker ps -aq | xargs docker rm -f
Expand Down

0 comments on commit 13f16e5

Please sign in to comment.