Workplace Widget 5.10.23
This commit is contained in:
13
hmi-docs/cheerpj/tests/WorkplaceCredentialBridgeSmoke.java
Normal file
13
hmi-docs/cheerpj/tests/WorkplaceCredentialBridgeSmoke.java
Normal file
@@ -0,0 +1,13 @@
|
||||
import com.widgetworkbench.cheerpj.WorkplaceCredentialBridge;
|
||||
/** Mimics verified public method signatures, not proprietary MES behavior. */
|
||||
public final class WorkplaceCredentialBridgeSmoke {
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String secret="secret123";
|
||||
if(WorkplaceCredentialBridge.offer("tester",secret,"any")!=1)throw new AssertionError("first offer rejected");
|
||||
if(WorkplaceCredentialBridge.offer("tester",secret,"any")!=0)throw new AssertionError("duplicate offer accepted");
|
||||
long deadline=System.currentTimeMillis()+6000;
|
||||
while(WorkplaceCredentialBridge.getResultCode()==0 && System.currentTimeMillis()<deadline)Thread.sleep(50);
|
||||
if(WorkplaceCredentialBridge.getResultCode()!=1)throw new AssertionError("MES handoff failed: "+WorkplaceCredentialBridge.getResultCode());
|
||||
System.out.println("PASS Java11 independent PersonService reflection and one-shot credential delivery");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.itac.artes.ihas;
|
||||
public final class ServiceLocator {
|
||||
private ServiceLocator(){}
|
||||
public static Object getService(Class<?> ignored){return new Object();}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.itac.mes.admin.domain;
|
||||
public interface PersonService {}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.itac.mes.gui;
|
||||
import com.itac.util.text.Password;
|
||||
public final class MesContext {
|
||||
private static final MesContext INSTANCE=new MesContext();
|
||||
private Object user;
|
||||
public static MesContext instance(){return INSTANCE;}
|
||||
public Object getUser(){return user;}
|
||||
public boolean doLogin(String username, Password password, String client){
|
||||
if("tester".equals(username) && password.matches("secret123") && "any".equals(client)){
|
||||
user=new Object();return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.itac.util.text;
|
||||
public final class Password {
|
||||
public enum Encryption { NONE }
|
||||
private final String value;
|
||||
public Password(Encryption encryption, String plaintext){
|
||||
if(encryption!=Encryption.NONE)throw new IllegalArgumentException();
|
||||
value=plaintext;
|
||||
}
|
||||
public boolean matches(String check){return value.equals(check);}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SRC="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TEMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TEMP"' EXIT
|
||||
javac --release 11 -d "$TEMP" "$SRC/WorkplaceCredentialBridge.java" \
|
||||
"$(dirname "$0")/WorkplaceCredentialBridgeSmoke.java" \
|
||||
$(find "$(dirname "$0")/stubs" -type f -name '*.java' | sort)
|
||||
java -cp "$TEMP" WorkplaceCredentialBridgeSmoke
|
||||
Reference in New Issue
Block a user