2025-05-07 21:46:32 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright ©Δ∞ 仙上主天
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
|
|
|
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
|
|
|
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
|
|
|
|
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
|
|
|
|
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
|
|
|
|
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
|
|
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
|
|
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
2026-03-24 14:08:39 +01:00
|
|
|
package ᒢᣘᣟᣟ.ᓫᣕᐪᓫᣗ.ᙆᑊᒻᒻᣔᒻᣔ;
|
2025-05-07 21:46:32 +02:00
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
2026-03-24 14:08:39 +01:00
|
|
|
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.BassFaultAnchor;
|
|
|
|
|
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.FaultBeanInstantiation;
|
|
|
|
|
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.FaultStreamDelegate;
|
|
|
|
|
import ᒢᣟᐧ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.WarpManifestorDriver;
|
|
|
|
|
import ᒢᣟᐧ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.ᔿᣔᣕᑊᣘᓫᔆᐪ.WarpManifestX8;
|
2025-05-07 21:46:32 +02:00
|
|
|
|
|
|
|
|
/// @author للَّٰهِilLצسُو
|
|
|
|
|
/// @version ©Δ∞ 仙上主天
|
|
|
|
|
public class FaultSignalTraceTest {
|
|
|
|
|
|
|
|
|
|
static class SpaceA {
|
|
|
|
|
static void traceRoot() {
|
|
|
|
|
throw new FaultBeanInstantiation("The signal trace root", SpaceA.class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static class SpaceB {
|
2025-12-15 15:48:33 +01:00
|
|
|
static void traceRootAccess(int productColor) {
|
2025-05-07 21:46:32 +02:00
|
|
|
try {
|
|
|
|
|
SpaceA.traceRoot();
|
|
|
|
|
} catch (FaultBeanInstantiation e) {
|
2025-12-15 15:48:33 +01:00
|
|
|
// test auto-esc of email header protection from java manifest v1 output
|
|
|
|
|
// and add stuff on the general whiteboard to play games
|
|
|
|
|
// and normal fault context signal tracing
|
|
|
|
|
throw e.withSignalTrace(SpaceB.class, "Name", "FoodSection")
|
|
|
|
|
.withSignalTrace(SpaceB.class, "From", "FoodEmail")
|
|
|
|
|
.withSignalTrace(SpaceB.class, "product-color", productColor)
|
|
|
|
|
.appendOnWhitePaper("Paper-SpaceB", "sissors");
|
2025-05-07 21:46:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static class SpaceC {
|
2025-12-15 15:48:33 +01:00
|
|
|
static void traceRootCatchBass(String bearbar) {
|
2025-05-07 21:46:32 +02:00
|
|
|
try {
|
2025-12-15 15:48:33 +01:00
|
|
|
SpaceB.traceRootAccess((int) bearbar.charAt(0));
|
2025-05-07 21:46:32 +02:00
|
|
|
} catch (BassFaultAnchor e) {
|
|
|
|
|
throw e.withSignalTrace(SpaceC.class, v -> {
|
2025-12-15 15:48:33 +01:00
|
|
|
v.put("bearbar", bearbar);
|
2025-05-07 21:46:32 +02:00
|
|
|
v.put("Junit-Foo", "Bar");
|
2025-12-15 15:48:33 +01:00
|
|
|
v.put("Junit-仙上主天", "仙上主天"); // only works with manifest v2++
|
2025-05-07 21:46:32 +02:00
|
|
|
}).appendOnWhitePaper("Paper-SpaceC", "rock");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static class SpaceD {
|
2025-12-15 15:48:33 +01:00
|
|
|
static void traceWrapClassic(String foobar) {
|
2025-05-07 21:46:32 +02:00
|
|
|
try {
|
2025-12-15 15:48:33 +01:00
|
|
|
SpaceC.traceRootCatchBass(foobar);
|
2025-05-07 21:46:32 +02:00
|
|
|
} catch (Exception e) {
|
2025-12-15 15:48:33 +01:00
|
|
|
// classic java error wrapping to add meta info like call arguments for context in stack trace
|
|
|
|
|
throw new IllegalArgumentException("Classic argument missing wrapper with foobar " + foobar, e);
|
2025-05-07 21:46:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static class SpaceE {
|
2025-12-15 15:48:33 +01:00
|
|
|
static void traceWrap(int eSpaceMine) {
|
2025-05-07 21:46:32 +02:00
|
|
|
try {
|
2025-12-15 15:48:33 +01:00
|
|
|
SpaceD.traceWrapClassic("" + eSpaceMine * 1234);
|
2025-05-07 21:46:32 +02:00
|
|
|
} catch (Exception e) {
|
2025-12-15 15:48:33 +01:00
|
|
|
throw new FaultStreamDelegate(e, SpaceD.class)
|
|
|
|
|
.withSignalTrace(SpaceE.class, "eSpaceMine", eSpaceMine);
|
2025-05-07 21:46:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testFaultString() {
|
2025-12-15 15:48:33 +01:00
|
|
|
BassFaultAnchor error = null;
|
2025-05-07 21:46:32 +02:00
|
|
|
try {
|
2025-12-15 15:48:33 +01:00
|
|
|
SpaceE.traceWrap(123);
|
|
|
|
|
} catch (BassFaultAnchor e) {
|
2025-05-07 21:46:32 +02:00
|
|
|
error = e;
|
|
|
|
|
}
|
|
|
|
|
Assertions.assertNotNull(error);
|
|
|
|
|
Assertions.assertNotNull(error.getMessage());
|
2026-03-24 10:56:33 +01:00
|
|
|
String errorText = ZilLaLaManyfestoGrowlFactory.亞.buildFaultScream(error);
|
2025-05-07 21:46:32 +02:00
|
|
|
//System.out.println(errorText);
|
|
|
|
|
//System.out.println(errorText.length()); // 3185, 3433
|
|
|
|
|
Assertions.assertNotNull(errorText);
|
|
|
|
|
Assertions.assertTrue(errorText.contains(error.getMessage()));
|
2025-12-15 15:48:33 +01:00
|
|
|
Assertions.assertTrue(errorText.contains("FaultStreamDelegate"));
|
2025-05-07 21:46:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testFaultStringSitra() {
|
|
|
|
|
BassFaultAnchor error = null;
|
|
|
|
|
try {
|
2025-12-15 15:48:33 +01:00
|
|
|
SpaceE.traceWrap(123);
|
2025-05-07 21:46:32 +02:00
|
|
|
} catch (BassFaultAnchor e) {
|
|
|
|
|
error = e;
|
|
|
|
|
}
|
|
|
|
|
Assertions.assertNotNull(error);
|
|
|
|
|
Assertions.assertNotNull(error.getMessage());
|
2026-03-24 10:56:33 +01:00
|
|
|
WarpManifestX8 manifest = SitraManifestGenerator.亞.buildSignalTraceManifest(error);
|
2025-05-07 21:46:32 +02:00
|
|
|
String sitraText = WarpManifestorDriver.writeV2String(manifest);
|
2026-03-24 10:56:33 +01:00
|
|
|
System.out.println(sitraText);
|
2025-05-07 21:46:32 +02:00
|
|
|
Assertions.assertNotNull(sitraText);
|
2026-03-24 14:08:39 +01:00
|
|
|
Assertions.assertTrue(sitraText.contains("Name: ᒢᣘᣟᣟ.ᓫᣕᐪᓫᣗ.ᙆᑊᒻᒻᣔᒻᣔ.FaultSignalTraceTest$SpaceA"));
|
2026-03-24 10:56:33 +01:00
|
|
|
Assertions.assertTrue(sitraText.contains("Fault-Section-Goal: ROCK summit"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("Fault-Section-Chain-Message: The signal trace root"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("Fault-Section-Chain-Iceberg: java.lang.IllegalArgumentException"));
|
2025-05-07 21:46:32 +02:00
|
|
|
Assertions.assertTrue(sitraText.contains("Manifest"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("SpaceB"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("FoodSection"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("SpaceC"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("Junit-Foo: Bar"));
|
2025-12-15 15:48:33 +01:00
|
|
|
Assertions.assertTrue(sitraText.contains("eSpaceMine: 123"));
|
|
|
|
|
Assertions.assertTrue(sitraText.contains("product-color: 49"));
|
2025-05-07 21:46:32 +02:00
|
|
|
}
|
|
|
|
|
}
|