/*
 * jPOS Project [http://jpos.org]
 * Copyright (C) 2000-2020 jPOS Software SRL
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.jpos.gl;

import org.jpos.gl.tools.Export;
import org.jpos.gl.tools.Import;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

public abstract class TestBase {
    protected GLSession gls;
    protected long start;
    protected long checkpoint;

    @BeforeEach
    public void setUpBase () throws Exception {
        try {
            String userName = System.getProperty("user.name");
            System.setProperty("user.name", "travis");
            new Import().parse("../test-classes/testdata.xml");
            new Export().export(System.out);
            System.setProperty("user.name", userName);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
        gls = new GLSession("bob");
        start = checkpoint = System.currentTimeMillis();
    }
    @AfterEach
    public void tearDownBase () throws Exception {
        gls.close();
    }

    public void start () {
        start = checkpoint = System.currentTimeMillis();
    }
    public void start (String s) {
        System.out.println ("     start: " + s + " ("
            + Runtime.getRuntime().totalMemory() + ")"
        );
        start = checkpoint = System.currentTimeMillis();
    }
    public void checkPoint (String s) {
        long now = System.currentTimeMillis();
        System.out.println ("checkpoint: " + s + " [" + (now - checkpoint) + "] (" 
            + Runtime.getRuntime().totalMemory() + ")"
        );
        checkpoint = now;
    }
    public void end (String s) {
        long now = System.currentTimeMillis();
        System.out.println ("       end: " + s + " [" + (now - start) + "] (" 
            + Runtime.getRuntime().totalMemory() + ")"
        );
        start = checkpoint = now;
    }
}


@@ -872,20 +872,19 @@
 pi.After
-Each
+All
 ;%0Aimport
@@ -916,14 +916,152 @@
 fore
-Each;%0A
+All;%0Aimport org.junit.jupiter.api.TestInstance;%0A%0Aimport static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;%0A%0A@TestInstance(PER_CLASS)
 %0Apub
@@ -1104,16 +1104,23 @@
 otected 
+static 
 GLSessio
@@ -1136,24 +1136,31 @@
   protected 
+static 
 long start;%0A
@@ -1173,16 +1173,23 @@
 otected 
+static 
 long che
@@ -1209,20 +1209,19 @@
  @Before
-Each
+All
 %0A    pub
@@ -1220,24 +1220,31 @@
 %0A    public 
+static 
 void setUpBa
@@ -1773,12 +1773,11 @@
 fter
-Each
+All
 %0A   
@@ -1780,24 +1780,31 @@
 %0A    public 
+static 
 void tearDow

Fix TestBase so that gl session is not reset for each individual test.