Files
SHiNE-server/scripts/tests/test_core_ws_guards.sh
T

32 lines
2.8 KiB
Bash

#!/usr/bin/env bash
# Pre-DB smoke test with the real Jetty WebSocket API jar. Not a live WS test.
set -euo pipefail
cd "$(dirname "$0")/../.."
: "${JETTY_WS_API_JAR:?Point to the real Jetty websocket-jetty-api jar}"
BCPROV_JAR="${BCPROV_JAR:-/usr/share/java/bcprov.jar}"
[[ -f "$JETTY_WS_API_JAR" && -f "$BCPROV_JAR" ]]
OUT=$(mktemp -d); trap 'rm -rf "$OUT"' EXIT
B=SHiNE-server/shine-server-blockchain/src/main/java/blockchain
N=SHiNE-server/shine-server-net-protocol/src
D=SHiNE-server/shine-server-db/src/main/java
WS="$N/main/java/server/logic/ws_protocol"
mapfile -t BODIES < <(find "$B/body" -name '*.java' | sort)
mapfile -t DEPS < <(find SHiNE-server -name Ed25519Util.java -o -name HashSHA256Util.java -o -name ShineSignatureConstants.java | sort)
CP="$BCPROV_JAR:$JETTY_WS_API_JAR"
javac --release 17 -cp "$CP" -d "$OUT" "${BODIES[@]}" "${DEPS[@]}" \
"$B"/{MsgSubType,BodyRecordParser,Ans104DataItem,ShineProtocolTags,CoreRecord,LineIndex,ProtocolHash,ContentRecord,CoreContentTransport,ContentBodyParser,BchCryptoVerifier,BchBlockEntry,ChannelMetaTextParser,PiecesRootValidator}.java \
"$B"/storage/*.java "$D"/shine/db/{KeyEncodingUtil.java,channels/ChannelNameRules.java,connection/ConnectionFactory.java,connection/DbProvider.java,connection/DriverManagerDbProvider.java,DatabaseInitializer.java,entities/CurrentUserEntry.java,entities/ActiveSessionEntry.java} \
"$D"/shine/db/dao/{KeyRotationSessionSql,KeyRotationMessagesSql}.java "$D"/shine/db/entities/{KeyRotationSessionEntry,KeyRotationStatus,UserNotificationEntry}.java \
"$WS"/JSON/ConnectionContext.java "$WS"/JSON/entyties/Net_{Event,Request,Response,Exception_Response}.java \
"$WS"/JSON/handlers/JsonMessageHandler.java "$WS"/JSON/handlers/blockchain/{CoreWsHandlers,CoreSocialWsHandlers,CoreNotificationWsHandler,CoreChannelReadWsHandler}.java \
"$WS"/JSON/handlers/notifications/entyties/Net_SetNotificationState_{Request,Response}.java \
"$WS"/JSON/handlers/profile/entyties/Net_ListUserProfileChannels_{Request,Response}.java \
"$WS"/JSON/handlers/channels/entyties/Net_{GetChannelsCounters,SearchChannels,GetUserCounters}_{Request,Response}.java \
"$WS"/JSON/handlers/tempToTest/entyties/Net_{GetUser,SearchUsers}_{Request,Response}.java \
"$WS"/JSON/handlers/profile/AvatarValueParser.java "$WS"/JSON/handlers/avatars/PiecesRootValidator.java \
"$WS"/JSON/handlers/blockchain/Net_AddBlock_Handler_utils/BlockchainLocks.java \
"$WS"/JSON/handlers/blockchain/entyties/Net_{AddBlock_Response,GetMyBlockchain_Request,GetBlockchainBlock_Request}.java \
"$WS"/JSON/handlers/system/entyties/Net_ListBlockchainHeads_Response.java "$WS"/JSON/utils/NetExceptionResponseFactory.java \
"$N/main/java/server/sync/BlockchainResyncGuard.java" "$N/test/java/server/logic/ws_protocol/JSON/handlers/blockchain/CoreWsGuardChecks.java"
java -cp "$OUT:$CP" server.logic.ws_protocol.JSON.handlers.blockchain.CoreWsGuardChecks