nx01/nx01-jpp3-enter-zillala/src/test/java/ᒢᣘᣟᣟ/ᓫᣕᐪᓫᣗ/ᙆᑊᒻᒻᣔᒻᣔ/FaultSignalTraceTest.java
Willem 11084d3d94
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 51s
NX01: Migrated warp fault to klass fault
2026-03-24 14:08:39 +01:00

141 lines
6 KiB
Java

/*
* 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.
*/
package ᒢᣘᣟᣟ.ᓫᣕᐪᓫᣗ.ᙆᑊᒻᒻᣔᒻᣔ;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.BassFaultAnchor;
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.FaultBeanInstantiation;
import ᒢᣘᐧᣟ.ᑊᑉᒻᣔᔆᔆ.ᣘᣔᓑᒻᐪ.FaultStreamDelegate;
import ᒢᣟᐧ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.WarpManifestorDriver;
import ᒢᣟᐧ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.ᔿᣔᣕᑊᣘᓫᔆᐪ.WarpManifestX8;
/// @author للَّٰهِilLצسُو
/// @version ©Δ∞ 仙上主天
public class FaultSignalTraceTest {
static class SpaceA {
static void traceRoot() {
throw new FaultBeanInstantiation("The signal trace root", SpaceA.class);
}
}
static class SpaceB {
static void traceRootAccess(int productColor) {
try {
SpaceA.traceRoot();
} catch (FaultBeanInstantiation e) {
// 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");
}
}
}
static class SpaceC {
static void traceRootCatchBass(String bearbar) {
try {
SpaceB.traceRootAccess((int) bearbar.charAt(0));
} catch (BassFaultAnchor e) {
throw e.withSignalTrace(SpaceC.class, v -> {
v.put("bearbar", bearbar);
v.put("Junit-Foo", "Bar");
v.put("Junit-仙上主天", "仙上主天"); // only works with manifest v2++
}).appendOnWhitePaper("Paper-SpaceC", "rock");
}
}
}
static class SpaceD {
static void traceWrapClassic(String foobar) {
try {
SpaceC.traceRootCatchBass(foobar);
} catch (Exception e) {
// 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);
}
}
}
static class SpaceE {
static void traceWrap(int eSpaceMine) {
try {
SpaceD.traceWrapClassic("" + eSpaceMine * 1234);
} catch (Exception e) {
throw new FaultStreamDelegate(e, SpaceD.class)
.withSignalTrace(SpaceE.class, "eSpaceMine", eSpaceMine);
}
}
}
@Test
public void testFaultString() {
BassFaultAnchor error = null;
try {
SpaceE.traceWrap(123);
} catch (BassFaultAnchor e) {
error = e;
}
Assertions.assertNotNull(error);
Assertions.assertNotNull(error.getMessage());
String errorText = ZilLaLaManyfestoGrowlFactory..buildFaultScream(error);
//System.out.println(errorText);
//System.out.println(errorText.length()); // 3185, 3433
Assertions.assertNotNull(errorText);
Assertions.assertTrue(errorText.contains(error.getMessage()));
Assertions.assertTrue(errorText.contains("FaultStreamDelegate"));
}
@Test
public void testFaultStringSitra() {
BassFaultAnchor error = null;
try {
SpaceE.traceWrap(123);
} catch (BassFaultAnchor e) {
error = e;
}
Assertions.assertNotNull(error);
Assertions.assertNotNull(error.getMessage());
WarpManifestX8 manifest = SitraManifestGenerator..buildSignalTraceManifest(error);
String sitraText = WarpManifestorDriver.writeV2String(manifest);
System.out.println(sitraText);
Assertions.assertNotNull(sitraText);
Assertions.assertTrue(sitraText.contains("Name: ᒢᣘᣟᣟ.ᓫᣕᐪᓫᣗ.ᙆᑊᒻᒻᣔᒻᣔ.FaultSignalTraceTest$SpaceA"));
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"));
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"));
Assertions.assertTrue(sitraText.contains("eSpaceMine: 123"));
Assertions.assertTrue(sitraText.contains("product-color: 49"));
}
}