summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2024-08-27 19:03:13 +0200
committerAndreas Fankhauser hiddenalpha.ch2024-08-27 19:03:13 +0200
commitefad1586ffcaf9e52972376777044d4625f2878d (patch)
tree3a6f99469b588525dcaefddd9a1152a1e4b2be78
parent088e19c81df056c9f53c8d7f40ade5759ba09de2 (diff)
downloadUnspecifiedGarbage-efad1586ffcaf9e52972376777044d4625f2878d.zip
UnspecifiedGarbage-efad1586ffcaf9e52972376777044d4625f2878d.tar.gz
Lazlar hostname hack. Java getAsHexStr() helper func.
-rw-r--r--src/main/java/ch/hiddenalpha/unspecifiedgarbage/format/FormatUtils.java15
-rw-r--r--src/main/patch/lazlar/default.patch27
2 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/ch/hiddenalpha/unspecifiedgarbage/format/FormatUtils.java b/src/main/java/ch/hiddenalpha/unspecifiedgarbage/format/FormatUtils.java
index e156eb8..56adf1c 100644
--- a/src/main/java/ch/hiddenalpha/unspecifiedgarbage/format/FormatUtils.java
+++ b/src/main/java/ch/hiddenalpha/unspecifiedgarbage/format/FormatUtils.java
@@ -3,4 +3,17 @@ package ch.hiddenalpha.unspecifiedgarbage.format;
/** Obsolete: This class did migrate to "xtra4j" */
@Deprecated
-public class FormatUtils {}
+public class FormatUtils {
+
+ /* TODO should we move this to xtra4j? */
+ public static String getAsHexStr( byte[] src, int srcOff, int len ){
+ byte[] tmp = new byte[len * 2];
+ for( int i = 0 ; i < len ; ++i ){
+ int lo = src[srcOff + i] & 0x0F, hi = (src[srcOff + i] >>> 4) & 0x0F;
+ tmp[2 * i] = (byte)( (hi <= 9) ? hi + '0' : hi + 'A' - 10 );
+ tmp[2 * i + 1] = (byte)( (lo <= 9) ? lo + '0' : lo + 'A' - 10 );
+ }
+ return new String(tmp, US_ASCII);
+ }
+
+}
diff --git a/src/main/patch/lazlar/default.patch b/src/main/patch/lazlar/default.patch
index 181baa1..e10a3e0 100644
--- a/src/main/patch/lazlar/default.patch
+++ b/src/main/patch/lazlar/default.patch
@@ -35,3 +35,30 @@
<dependency>
+ This is needed if I wanna run mDNS tests in my virtual machine. So the
+ registered service route is of any use for my eddie which runs outside the VM
+ and so has no chance to see lazlar via its IP inside the VM.
+
+--- a/lazlar-web/src/test/java/ch/post/it/paisa/lazlar/web/LazlarStarter.java
++++ b/lazlar-web/src/test/java/ch/post/it/paisa/lazlar/web/LazlarStarter.java
+@@ -7,6 +7,18 @@
+ boolean a = false;
+ assert a = true;
+ if (!a) throw new RuntimeException("https://stackoverflow.com/a/68893479/4415884");
+- ServiceStarter.create().start();
++ String chPostItHost = System.getProperty("ch.post.it.host");
++ String paisaServiceHost = System.getProperty("paisa.service.host");
++ new Thread(() -> {
++ for(int i = 0 ; i < 5000 ; ++i ){
++ System.setProperty("ch.post.it.host", chPostItHost);
++ System.setProperty("paisa.service.host", paisaServiceHost);
++ try{
++ Thread.sleep(1);
++ }catch(InterruptedException ex){ throw new UnsupportedOperationException/*TODO*/("not impl yet",ex);}
++ }
++ }).start();
++ Thread.yield();
++ ServiceStarter.create().withName("lazlar").withPort(7042).start();
+ }
+ }
+