Workplace Widget 5.10.23
This commit is contained in:
23
hmi-scripts/build-jaas-bridge.ps1
Normal file
23
hmi-scripts/build-jaas-bridge.ps1
Normal file
@@ -0,0 +1,23 @@
|
||||
# Build the unsigned, vendor-independent Java 11 identity helper on Windows.
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
$Source = Join-Path $Root 'hmi-docs/cheerpj/JaasIdentityBridge.java'
|
||||
$Dest = Join-Path $Root 'hmi-frontend/public/cheerpj/jaas-identity-bridge.jar'
|
||||
$Temp = Join-Path ([System.IO.Path]::GetTempPath()) ('hmi-jaas-' + [Guid]::NewGuid().ToString('N'))
|
||||
New-Item -ItemType Directory -Path $Temp -Force | Out-Null
|
||||
try {
|
||||
& javac --release 11 -d $Temp $Source
|
||||
if ($LASTEXITCODE -ne 0) { throw 'javac --release 11 failed' }
|
||||
& jar --create --file $Dest -C $Temp 'com/widgetworkbench/cheerpj/JaasIdentityBridge.class'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'JAR creation failed' }
|
||||
$entries = @(& jar tf $Dest)
|
||||
if ($LASTEXITCODE -ne 0 -or ($entries -notcontains 'com/widgetworkbench/cheerpj/JaasIdentityBridge.class')) {
|
||||
throw 'JAR did not contain the JAAS helper class'
|
||||
}
|
||||
Write-Host "JAAS Hilfsklasse erstellt: $Dest"
|
||||
} finally {
|
||||
Remove-Item -LiteralPath $Temp -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
11
hmi-scripts/build-jaas-bridge.sh
Executable file
11
hmi-scripts/build-jaas-bridge.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
SOURCE="$ROOT/hmi-docs/cheerpj/JaasIdentityBridge.java"
|
||||
DEST="$ROOT/hmi-frontend/public/cheerpj/jaas-identity-bridge.jar"
|
||||
TEMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TEMP"' EXIT
|
||||
javac --release 11 -d "$TEMP" "$SOURCE"
|
||||
jar --create --file "$DEST" -C "$TEMP" com/widgetworkbench/cheerpj/JaasIdentityBridge.class
|
||||
jar tf "$DEST" | grep -q '^com/widgetworkbench/cheerpj/JaasIdentityBridge.class$'
|
||||
echo "Created: $DEST"
|
||||
25
hmi-scripts/build-native-loader-smoke.ps1
Normal file
25
hmi-scripts/build-native-loader-smoke.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
# Rebuild only the Java 11 diagnostic JAR. Works on Windows and Linux PowerShell.
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
$Source = Join-Path $Root 'hmi-docs/cheerpj/NativeLoaderSmoke.java'
|
||||
$Helper = Join-Path $Root 'hmi-frontend/public/cheerpj/jaas-identity-bridge.jar'
|
||||
$Dest = Join-Path $Root 'hmi-frontend/public/cheerpj/jaas-native-loader-smoke.jar'
|
||||
if (!(Test-Path $Helper)) { & (Join-Path $Root 'hmi-scripts/build-jaas-bridge.ps1') }
|
||||
$Temp = Join-Path ([System.IO.Path]::GetTempPath()) ('hmi-native-' + [Guid]::NewGuid().ToString('N'))
|
||||
New-Item -ItemType Directory -Path $Temp -Force | Out-Null
|
||||
try {
|
||||
& javac --release 11 -cp $Helper -d $Temp $Source
|
||||
if ($LASTEXITCODE -ne 0) { throw 'javac --release 11 failed' }
|
||||
& jar --create --file $Dest -C $Temp 'com/widgetworkbench/cheerpj/NativeLoaderSmoke.class'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'JAR creation failed' }
|
||||
$entries = @(& jar tf $Dest)
|
||||
if ($LASTEXITCODE -ne 0 -or ($entries -notcontains 'com/widgetworkbench/cheerpj/NativeLoaderSmoke.class')) {
|
||||
throw 'JAR does not contain NativeLoaderSmoke.class'
|
||||
}
|
||||
Write-Host "Java 11 Diagnose-JAR erstellt: $Dest"
|
||||
} finally {
|
||||
Remove-Item -LiteralPath $Temp -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
14
hmi-scripts/build-native-loader-smoke.sh
Executable file
14
hmi-scripts/build-native-loader-smoke.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the vendor-independent Java 11 diagnostic with the production helper.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
CLASS="$ROOT/hmi-docs/cheerpj/NativeLoaderSmoke.java"
|
||||
HELPER="$ROOT/hmi-frontend/public/cheerpj/jaas-identity-bridge.jar"
|
||||
DEST="$ROOT/hmi-frontend/public/cheerpj/jaas-native-loader-smoke.jar"
|
||||
[[ -f "$HELPER" ]] || "$ROOT/hmi-scripts/build-jaas-bridge.sh"
|
||||
TEMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TEMP"' EXIT
|
||||
javac --release 11 -cp "$HELPER" -d "$TEMP" "$CLASS"
|
||||
jar --create --file "$DEST" -C "$TEMP" com/widgetworkbench/cheerpj/NativeLoaderSmoke.class
|
||||
jar tf "$DEST" | grep -q '^com/widgetworkbench/cheerpj/NativeLoaderSmoke.class$'
|
||||
echo "Created Java 11 diagnostic: $DEST"
|
||||
28
hmi-scripts/test-jaas-identity.sh
Normal file
28
hmi-scripts/test-jaas-identity.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
"$ROOT/hmi-scripts/build-jaas-bridge.sh"
|
||||
TEMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TEMP"' EXIT
|
||||
cat >"$TEMP/JaasIdentityBridgeProbe.java" <<'JAVA'
|
||||
import com.widgetworkbench.cheerpj.JaasIdentityBridge;
|
||||
import com.sun.security.auth.module.UnixSystem;
|
||||
public class JaasIdentityBridgeProbe {
|
||||
public static void main(String[] args) {
|
||||
UnixSystem system = new UnixSystem();
|
||||
String user = JaasIdentityBridge.populate(system);
|
||||
if (!"cheerpj-client".equals(user)
|
||||
|| !user.equals(system.getUsername())
|
||||
|| system.getUid() != 65534L
|
||||
|| system.getGid() != 65534L
|
||||
|| system.getGroups().length != 0) {
|
||||
throw new AssertionError("Virtual Unix identity incomplete");
|
||||
}
|
||||
System.out.println("JAVA 11 JAAS BRIDGE: OK (virtual OS identity only)");
|
||||
}
|
||||
}
|
||||
JAVA
|
||||
JAR="$ROOT/hmi-frontend/public/cheerpj/jaas-identity-bridge.jar"
|
||||
javac --release 11 -cp "$JAR" -d "$TEMP" "$TEMP/JaasIdentityBridgeProbe.java"
|
||||
java -cp "$TEMP:$JAR" JaasIdentityBridgeProbe
|
||||
node "$ROOT/hmi-frontend/tests/cheerpj-jaas-native.mjs"
|
||||
@@ -30,6 +30,10 @@ package com.workbenchclassic.hmi;
|
||||
public class PolicyTest {
|
||||
static void check(boolean condition, String msg) {if (!condition) throw new AssertionError(msg);}
|
||||
public static void main(String[] args) throws Exception {
|
||||
check("asadmin.bat".equals(HmiJvmOptions.executableNameFor("Windows Server 2022")), "Windows asadmin.bat");
|
||||
check("asadmin.bat".equals(HmiJvmOptions.executableNameFor("Windows 11")), "Windows desktop");
|
||||
check("asadmin".equals(HmiJvmOptions.executableNameFor("Linux")), "Linux asadmin");
|
||||
check("asadmin".equals(HmiJvmOptions.executableNameFor("FreeBSD")), "Unix fallback");
|
||||
System.clearProperty("hmi.allow.insecure");
|
||||
System.clearProperty("hmi.imsapi.allowHttp");
|
||||
check(HmiTransportPolicy.allowBrowserHttp(), "Missing browser flag must default to true");
|
||||
@@ -37,6 +41,10 @@ public class PolicyTest {
|
||||
check("DEFAULT".equals(HmiTransportPolicy.source("hmi.allow.insecure","HMI_ALLOW_INSECURE")), "Source DEFAULT");
|
||||
System.setProperty("hmi.allow.insecure", "false");
|
||||
check(!HmiTransportPolicy.allowBrowserHttp(), "Explicit false must disable browser HTTP");
|
||||
check("asadmin.bat".equals(HmiJvmOptions.executableNameFor("Windows Server 2022")), "Windows asadmin.bat");
|
||||
check("asadmin.bat".equals(HmiJvmOptions.executableNameFor("Windows 11")), "Windows desktop");
|
||||
check("asadmin".equals(HmiJvmOptions.executableNameFor("Linux")), "Linux asadmin");
|
||||
check("asadmin".equals(HmiJvmOptions.executableNameFor("FreeBSD")), "Unix fallback");
|
||||
System.clearProperty("hmi.allow.insecure");
|
||||
HmiJvmOptions.update(false, false);
|
||||
HmiJvmOptions.update(true, false); // existing property must be updated without duplication
|
||||
|
||||
20
hmi-scripts/test-workplace-login-hotfix.ps1
Normal file
20
hmi-scripts/test-workplace-login-hotfix.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
# Java 11 only. Test fixture does NOT enter production JAR.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ('ww-login-hotfix-' + [guid]::NewGuid().ToString('N'))
|
||||
New-Item -ItemType Directory -Path $tmp | Out-Null
|
||||
try {
|
||||
& javac --release 11 -d $tmp `
|
||||
(Join-Path $root 'hmi-docs/cheerpj/WorkplaceResizeBridge.java') `
|
||||
(Join-Path $root 'hmi-docs/cheerpj/WindowGeometrySmoke.java') `
|
||||
(Join-Path $root 'hmi-docs/cheerpj/WorkplaceLoginHotfixSmoke.java') `
|
||||
(Join-Path $root 'hmi-scripts/tests/fixtures/MesLoginDialog.java')
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Java-11 compilation failed' }
|
||||
& java -cp $tmp com.widgetworkbench.cheerpj.WindowGeometrySmoke
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Geometry test failed' }
|
||||
& java -cp $tmp com.widgetworkbench.cheerpj.WorkplaceLoginHotfixSmoke
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Login test failed' }
|
||||
Write-Host 'HOTFIX_V5_10_22_JAVA11_PASS'
|
||||
} finally {
|
||||
Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
25
hmi-scripts/test-workplace-login-hotfix.sh
Normal file
25
hmi-scripts/test-workplace-login-hotfix.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# Java 11 / no vendor JARs. Uses a TEST FIXTURE named MesLoginDialog.
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
javac --release 11 -d "$TMP" \
|
||||
"$ROOT/hmi-docs/cheerpj/WorkplaceResizeBridge.java" \
|
||||
"$ROOT/hmi-docs/cheerpj/WindowGeometrySmoke.java" \
|
||||
"$ROOT/hmi-docs/cheerpj/WorkplaceLoginHotfixSmoke.java" \
|
||||
"$ROOT/hmi-scripts/tests/fixtures/MesLoginDialog.java"
|
||||
java -Djava.awt.headless=true -cp "$TMP" com.widgetworkbench.cheerpj.WindowGeometrySmoke
|
||||
java -Djava.awt.headless=true -cp "$TMP" com.widgetworkbench.cheerpj.WorkplaceLoginHotfixSmoke
|
||||
if command -v xvfb-run >/dev/null 2>&1; then
|
||||
xvfb-run -a java -Djava.awt.headless=false -cp "$TMP" com.widgetworkbench.cheerpj.WindowGeometrySmoke
|
||||
xvfb-run -a java -Djava.awt.headless=false -cp "$TMP" com.widgetworkbench.cheerpj.WorkplaceLoginHotfixSmoke
|
||||
else
|
||||
echo 'Hinweis: xvfb-run nicht vorhanden; grafische Tests benötigen Windows-Desktop oder Xvfb.'
|
||||
fi
|
||||
# Production JAR contains ONLY the Workbench bridge, never the test fixture.
|
||||
if jar tf "$ROOT/hmi-frontend/public/cheerpj/workplace-window-monitor-v4.jar" | grep -q 'com/itac/'; then
|
||||
echo 'ERROR: Vendor-named test fixture must not be present in production jar' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo 'HOTFIX_V5_10_22_JAVA11_PASS'
|
||||
9
hmi-scripts/tests/fixtures/MesLoginDialog.java
vendored
Normal file
9
hmi-scripts/tests/fixtures/MesLoginDialog.java
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.itac.mes.gui.dialog;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import java.awt.Frame;
|
||||
|
||||
/** Test fixture ONLY; not included in production JAR, not an iTAC implementation. */
|
||||
public final class MesLoginDialog extends JDialog {
|
||||
public MesLoginDialog(Frame owner) { super(owner, true); }
|
||||
}
|
||||
Reference in New Issue
Block a user