fixed shutdown sequence, added better modularity

This commit is contained in:
Amer Agovic
2024-01-15 10:45:40 -06:00
parent 32cf0ecd66
commit 01d49e1ee9
40 changed files with 1464 additions and 386 deletions
@@ -60,7 +60,7 @@ public class TerminalTest {
@BeforeClass
public static void beforeAllTestMethods() {
System.out.println("Invoked once before all test methods");
String url="jdbc:postgresql://postgres:Ramudin99@bigbang:5432/Test";
String url=System.getenv("DB_URL");
t=new SQLTerminal(url);
}
@@ -0,0 +1,34 @@
package com.reliancy.jabba;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.junit.Test;
public class ArgsConfigTest {
@Test
public void testEnv(){
System.out.println("testing sys env...");
ArgsConfig args=new ArgsConfig("prog","--verbose","--key","value","cmd");
try {
args.load();
ArgsConfig.Property<String> env_user=new ArgsConfig.Property<>("USER",String.class);
ArgsConfig.Property<String> sys_user=new ArgsConfig.Property<>("user.name",String.class);
ArgsConfig.Property<Boolean> verbose=new ArgsConfig.Property<>("verbose",Boolean.class);
String usr_val1=args.getProperty(env_user,"None1");
String usr_val2=args.getProperty(sys_user,"None2");
System.out.println("Env User:"+usr_val1);
System.out.println("Sys User:"+usr_val2);
assertTrue(usr_val1.equals(usr_val2));
System.out.println("Positional:"+args.getProperty(Config.APP_ARGS, null));
System.out.println("Verbose:"+verbose.get(args));
for(ArgsConfig.Property<?> p:args){
System.out.println("p:"+p+"="+p.get(args));
}
} catch (IOException e) {
e.printStackTrace();
assertTrue(false);
}
}
}
@@ -39,7 +39,7 @@ public class RouterTest
//assertTrue( true );
System.out.println("Test router init...");
JettyApp r=new JettyApp();
RoutedEndPoint rep=new RoutedEndPoint();
Router rep=new Router();
rep.importMethods(r);
rep.compile();
//Matcher m=rep.match("GET","/helloPlain");
@@ -0,0 +1,40 @@
/*
Copyright (c) 2011-2022 Reliancy LLC
Licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3.
You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html.
You may not use this file except in compliance with the License.
*/
package com.reliancy.util;
import java.io.IOException;
import org.junit.Test;
public class HandyTest {
/**
* Plain CRUD
* @throws IOException
*/
@Test
public void splitting() throws IOException
{
System.out.println("Splitting test...");
String tst1="One,Two,Three";
System.out.println(tst1+" over ,");
for(String s:Handy.split(",",tst1)){
System.out.println("\tt:"+s);
}
//System.out.println(tst1+" over ");
//for(String s:Handy.split("",tst1)){
// System.out.println("\tt:"+s);
//}
String tst2="AND A AND B ANDAND D AND";
System.out.println(tst2+" over AND");
for(String s:Handy.split("AND",tst2)){
System.out.println("\tt:"+s);
}
}
}