fixed junit tests

This commit is contained in:
Ralph Soika 2024-02-16 11:52:45 +01:00
parent 2464753877
commit 1ad63b644c
6 changed files with 129 additions and 146 deletions

View file

@ -85,7 +85,7 @@ public class TestIMAPAuhtenticators {
source.setItemValue(DocumentImportService.SOURCE_ITEM_SERVER, "outlook.office365.com"); source.setItemValue(DocumentImportService.SOURCE_ITEM_SERVER, "outlook.office365.com");
source.setItemValue(DocumentImportService.SOURCE_ITEM_PORT, "993"); source.setItemValue(DocumentImportService.SOURCE_ITEM_PORT, "993");
source.setItemValue(DocumentImportService.SOURCE_ITEM_USER, "Imixs_bhv@alexander-logistics.com"); source.setItemValue(DocumentImportService.SOURCE_ITEM_USER, "Imixsbhv@alexander-logistics.com");
source.setItemValue(DocumentImportService.SOURCE_ITEM_PASSWORD, "A6x8Q~EWVUyt~gfyTHtIJf4ig.F9tajUpEEXMaCL"); source.setItemValue(DocumentImportService.SOURCE_ITEM_PASSWORD, "A6x8Q~EWVUyt~gfyTHtIJf4ig.F9tajUpEEXMaCL");
Properties sourceOptions = new Properties(); Properties sourceOptions = new Properties();

View file

@ -30,7 +30,6 @@ import com.sun.mail.imap.IMAPFolder;
import junit.framework.Assert; import junit.framework.Assert;
/** /**
* This test shows how to access outlook via oauth2 * This test shows how to access outlook via oauth2
* *
@ -91,7 +90,7 @@ public class TestIMAPOutlookOAuth {
// try to connect... // try to connect...
token = getAuthToken(); token = getAuthToken();
Assert.assertNotNull(token); Assert.assertNotNull(token);
store = connect(token, "Imixs_bhv@alexander-logistics.com"); store = connect(token, "Imixsbhv@alexander-logistics.com");
// store = connect(token, "mgeisler@alexander-logistics.com"); // store = connect(token, "mgeisler@alexander-logistics.com");
Assert.assertNotNull(store); Assert.assertNotNull(store);

View file

@ -1,15 +1,12 @@
package com.alexanderlogistics.migration; package com.alexanderlogistics.migration;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -19,10 +16,13 @@ import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.datev.imports.DatevImportAdapter; import org.imixs.workflow.datev.imports.DatevImportAdapter;
import org.imixs.workflow.exceptions.PluginException; import org.imixs.workflow.exceptions.PluginException;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import junit.framework.Assert; import junit.framework.Assert;
@Ignore
@Deprecated
public class DueDateBugfix { public class DueDateBugfix {
WorkflowClient workflowCLient = null; WorkflowClient workflowCLient = null;
@ -46,13 +46,15 @@ public class DueDateBugfix {
* *
*/ */
@Test @Test
@Ignore
public void fixe() { public void fixe() {
System.out.println("***********************"); System.out.println("***********************");
System.out.println("* Bugfix *"); System.out.println("* Bugfix *");
System.out.println("***********************"); System.out.println("***********************");
/* Erledigte /*
* Erledigte
* *
* *
* EXTF_202301_202302030602_1295 * EXTF_202301_202302030602_1295
@ -131,12 +133,10 @@ public class DueDateBugfix {
Date bugDate = invoice.getItemValueDate("invoice.duedate"); Date bugDate = invoice.getItemValueDate("invoice.duedate");
if (!dueDate.equals(bugDate)) { if (!dueDate.equals(bugDate)) {
fixes++; fixes++;
System.out.println(".... FIX " + belegNummer + " -> " + dueDate + " Bugi Date=" + bugDate); System.out.println(".... FIX " + belegNummer + " -> " + dueDate + " Bugi Date=" + bugDate);
invoice.setItemValue("invoice.duedate", dueDate); invoice.setItemValue("invoice.duedate", dueDate);
invoice.setItemValue("invoice.reminder", dueDate); invoice.setItemValue("invoice.reminder", dueDate);
@ -156,7 +156,6 @@ public class DueDateBugfix {
System.out.println(".... " + belegNummer + " ist unbekannt"); System.out.println(".... " + belegNummer + " ist unbekannt");
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("hat nicht geklappt: " + e.getMessage()); System.out.println("hat nicht geklappt: " + e.getMessage());
} }

View file

@ -1,11 +1,9 @@
package com.alexanderlogistics.migration; package com.alexanderlogistics.migration;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -19,10 +17,13 @@ import org.imixs.melman.WorkflowClient;
import org.imixs.workflow.ItemCollection; import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.exceptions.PluginException; import org.imixs.workflow.exceptions.PluginException;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import junit.framework.Assert; import junit.framework.Assert;
@Ignore
@Deprecated
public class MigrationMahnerAusziffern { public class MigrationMahnerAusziffern {
List<Rechnung> rechnungen = new ArrayList<Rechnung>(); List<Rechnung> rechnungen = new ArrayList<Rechnung>();
@ -34,6 +35,7 @@ public class MigrationMahnerAusziffern {
int countProcessed = 0; int countProcessed = 0;
int notFound = 0; int notFound = 0;
int count = 0; int count = 0;
@Before @Before
public void setup() throws PluginException, RestAPIException { public void setup() throws PluginException, RestAPIException {
rechnungen = new ArrayList<Rechnung>(); rechnungen = new ArrayList<Rechnung>();
@ -56,11 +58,13 @@ public class MigrationMahnerAusziffern {
* Diese Test Method wandelt die Datei OPD_migration_230126.csv in eine EXTV * Diese Test Method wandelt die Datei OPD_migration_230126.csv in eine EXTV
* Datev Datei um, welche wir dann für einen einmaligen Import der * Datev Datei um, welche wir dann für einen einmaligen Import der
* Rechnugnsdaten verwenden können. * Rechnugnsdaten verwenden können.
*
* @throws PluginException * @throws PluginException
* @throws RestAPIException * @throws RestAPIException
* *
*/ */
@Test @Test
@Ignore
public void anlysiere() throws RestAPIException, PluginException { public void anlysiere() throws RestAPIException, PluginException {
System.out.println("***********************"); System.out.println("***********************");
@ -86,7 +90,6 @@ public class MigrationMahnerAusziffern {
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
String[] data = line.split(";(?=([^\"]*\"[^\"]*\")*[^\"]*$)", 999); String[] data = line.split(";(?=([^\"]*\"[^\"]*\")*[^\"]*$)", 999);
@ -110,7 +113,6 @@ public class MigrationMahnerAusziffern {
System.out.println(" " + notFound + " Rechnungen nicht mehr aktiven Bestand"); System.out.println(" " + notFound + " Rechnungen nicht mehr aktiven Bestand");
System.out.println(" processed " + countProcessed + " Rechnungen in total"); System.out.println(" processed " + countProcessed + " Rechnungen in total");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Assert.fail(); Assert.fail();
@ -140,8 +142,6 @@ public class MigrationMahnerAusziffern {
System.out.println("...line " + count); System.out.println("...line " + count);
String rechnungsNummer = data[2]; String rechnungsNummer = data[2];
String rechnungsDatum = data[3]; String rechnungsDatum = data[3];
String faelligkeit = data[4]; String faelligkeit = data[4];
String saldo = data[7]; String saldo = data[7];
@ -203,7 +203,6 @@ public class MigrationMahnerAusziffern {
// Starte RestAPI call..... // Starte RestAPI call.....
processRechnungen(rech.rechnungsNummer, matchingRech.rechnungsNummer); processRechnungen(rech.rechnungsNummer, matchingRech.rechnungsNummer);
// matchingRech muss aus dem cach raus // matchingRech muss aus dem cach raus
boolean removeresult = rechnungen.remove(matchingRech); boolean removeresult = rechnungen.remove(matchingRech);
if (removeresult == false) { if (removeresult == false) {
@ -223,9 +222,6 @@ public class MigrationMahnerAusziffern {
// die rechnung gibts nicht und es gibt nicths zu prüfen // die rechnung gibts nicht und es gibt nicths zu prüfen
} }
} }
private boolean isEmpty(String data) { private boolean isEmpty(String data) {
@ -241,7 +237,8 @@ public class MigrationMahnerAusziffern {
* @throws RestAPIException * @throws RestAPIException
* @throws PluginException * @throws PluginException
*/ */
private void processRechnungen(String rech1, String rech2) throws RestAPIException, UnsupportedEncodingException, PluginException { private void processRechnungen(String rech1, String rech2)
throws RestAPIException, UnsupportedEncodingException, PluginException {
// erstmal die Kanddaten suchen // erstmal die Kanddaten suchen
String query = "type:workitem AND $modelversion:rechnungsausgang-de-1.0 AND (invoice.number:" + rech1 String query = "type:workitem AND $modelversion:rechnungsausgang-de-1.0 AND (invoice.number:" + rech1
+ " OR invoice.number:" + rech2 + ")"; + " OR invoice.number:" + rech2 + ")";
@ -265,7 +262,6 @@ public class MigrationMahnerAusziffern {
countProcessed = countProcessed + 2; countProcessed = countProcessed + 2;
} }
/** /**
* Teste ob es diese Rechnung im Office gibt. * Teste ob es diese Rechnung im Office gibt.
* *
@ -287,7 +283,6 @@ public class MigrationMahnerAusziffern {
return false; return false;
} }
/** /**
* Hilfsmethdoe die prüft ob es zu diesr Rechnung shcon eine passende * Hilfsmethdoe die prüft ob es zu diesr Rechnung shcon eine passende
* Gegenrechnung gibt. * Gegenrechnung gibt.
@ -361,8 +356,6 @@ public class MigrationMahnerAusziffern {
return MigrationMahnerAusziffern.this; return MigrationMahnerAusziffern.this;
} }
} }
} }

View file

@ -13,10 +13,13 @@ import java.util.List;
import org.imixs.workflow.exceptions.PluginException; import org.imixs.workflow.exceptions.PluginException;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import junit.framework.Assert; import junit.framework.Assert;
@Ignore
@Deprecated
public class MigrationMahnerDatev { public class MigrationMahnerDatev {
List<String> doppelteBuchungen = new ArrayList<String>(); List<String> doppelteBuchungen = new ArrayList<String>();
@ -36,6 +39,7 @@ public class MigrationMahnerDatev {
* *
*/ */
@Test @Test
@Ignore
public void migriere() { public void migriere() {
System.out.println("***********************"); System.out.println("***********************");
@ -141,7 +145,9 @@ public class MigrationMahnerDatev {
private void writeEXTFHeader(BufferedWriter writer, String wj) throws IOException { private void writeEXTFHeader(BufferedWriter writer, String wj) throws IOException {
writer.write( writer.write(
"\"EXTF\";\"510\";21;\"Buchungsstapel\";7;\"20220721060421653\";\"\";\"CS\";\"cargoservice\";\"\";\"\";\"\";\"" + WJ + "0101\";\"4\";\"" + WJ + "0101\";\"" + WJ + "1231\";\"202206ALL\";\"CS\";\"\";\"\";0;\"EUR\";\"\";\"\";\"\";\"\";\"\";\"\";\"\";\"\";\"\""); "\"EXTF\";\"510\";21;\"Buchungsstapel\";7;\"20220721060421653\";\"\";\"CS\";\"cargoservice\";\"\";\"\";\"\";\""
+ WJ + "0101\";\"4\";\"" + WJ + "0101\";\"" + WJ
+ "1231\";\"202206ALL\";\"CS\";\"\";\"\";0;\"EUR\";\"\";\"\";\"\";\"\";\"\";\"\";\"\";\"\";\"\"");
writer.newLine(); writer.newLine();
writer.write( writer.write(
"Umsatz (ohne Soll-/Haben-Kennzeichen);Soll-Haben-Kennzeichen;WKZ Umsatz;Kurs;Basisumsatz;WKZ Basisumsatz;Konto;Gegenkonto;BU-Schlüssel;Belegdatum;Belegfeld 1;Belegfeld 2;Skonto;Buchungstext;Postensperre;Diverse Adressnummer;Geschäftspartnerbank;Sachverhalt;Zinssperre;Beleglink;Beleginfo-Art 1;Beleginfo-Inhalt 1;Beleginfo-Art 2;Beleginfo-Inhalt 2;Beleginfo-Art 3;Beleginfo-Inhalt 3;Beleginfo-Art 4;Beleginfo-Inhalt 4;Beleginfo-Art 5;Beleginfo-Inhalt 5;Beleginfo-Art 6;Beleginfo-Inhalt 6;Beleginfo-Art 7;Beleginfo-Inhalt 7;Beleginfo-Art 8;Beleginfo-Inhalt 8;KOST1-Kostenstelle;KOST2-Kostenstelle;KOST-Menge;EU-Mitgliedstaatu. USt-IdNr.;EU-Steuersatz;Abw. Versteuerungsart;Sachverhalt L+L;Funktionserg<72>nzung L+L;BU 49 Hauptfunktionstyp;BU 49 Hauptfunktionsnummer;BU 49 Funktionserg<72>nzung;Zusatzinformation-Art 1;Zusatzinformation-Inhalt 1;Zusatzinformation-Art 2;Zusatzinformation-Inhalt 2;Zusatzinformation-Art 3;Zusatzinformation-Inhalt 3;Zusatzinformation-Art 4;Zusatzinformation-Inhalt 4;Zusatzinformation-Art 5;Zusatzinformation-Inhalt 5;Zusatzinformation-Art 6;Zusatzinformation-Inhalt 6;Zusatzinformation-Art 7;Zusatzinformation-Inhalt 7;Zusatzinformation-Art 8;Zusatzinformation-Inhalt 8;Zusatzinformation-Art 9;Zusatzinformation-Inhalt 9;Zusatzinformation-Art 10;Zusatzinformation-Inhalt 10;Zusatzinformation-Art 11;Zusatzinformation-Inhalt 11;Zusatzinformation-Art 12;Zusatzinformation-Inhalt 12;Zusatzinformation-Art 13;Zusatzinformation-Inhalt 13;Zusatzinformation-Art 14;Zusatzinformation-Inhalt 14;Zusatzinformation-Art 15;Zusatzinformation-Inhalt 15;Zusatzinformation-Art 16;Zusatzinformation-Inhalt 16;Zusatzinformation-Art 17;Zusatzinformation-Inhalt 17;Zusatzinformation-Art 18;Zusatzinformation-Inhalt 18;Zusatzinformation-Art 19;Zusatzinformation-Inhalt 19;Zusatzinformation-Art 20;Zusatzinformation-Inhalt 20;St<53>ck;Gewicht;Zahlweise;Forderungsart;Veranlagungsjahr;Zugeordnete F<>lligkeit;Skontotyp;Auftragsnummer;Buchungstyp;USt-Schl<68>ssel (Anzahlungen);EU-Mitgliedstaat (Anzahlungen);Sachverhalt L+L (Anzahlungen);EU-Steuersatz (Anzahlungen);Erlöskonto (Anzahlungen);Herkunft-Kz;Leerfeld;KOST-Datum;SEPAMandatsreferenz;Skontosperre;Gesellschaftername;Beteiligtennummer;Identifikationsnummer;Zeichnernummer;Postensperre bis;Bezeichnung SoBil-Sachverhalt;Kennzeichen SoBil-Buchung;Festschreibung;Leistungsdatum;Datum Zuord. Steuerperiode"); "Umsatz (ohne Soll-/Haben-Kennzeichen);Soll-Haben-Kennzeichen;WKZ Umsatz;Kurs;Basisumsatz;WKZ Basisumsatz;Konto;Gegenkonto;BU-Schlüssel;Belegdatum;Belegfeld 1;Belegfeld 2;Skonto;Buchungstext;Postensperre;Diverse Adressnummer;Geschäftspartnerbank;Sachverhalt;Zinssperre;Beleglink;Beleginfo-Art 1;Beleginfo-Inhalt 1;Beleginfo-Art 2;Beleginfo-Inhalt 2;Beleginfo-Art 3;Beleginfo-Inhalt 3;Beleginfo-Art 4;Beleginfo-Inhalt 4;Beleginfo-Art 5;Beleginfo-Inhalt 5;Beleginfo-Art 6;Beleginfo-Inhalt 6;Beleginfo-Art 7;Beleginfo-Inhalt 7;Beleginfo-Art 8;Beleginfo-Inhalt 8;KOST1-Kostenstelle;KOST2-Kostenstelle;KOST-Menge;EU-Mitgliedstaatu. USt-IdNr.;EU-Steuersatz;Abw. Versteuerungsart;Sachverhalt L+L;Funktionserg<72>nzung L+L;BU 49 Hauptfunktionstyp;BU 49 Hauptfunktionsnummer;BU 49 Funktionserg<72>nzung;Zusatzinformation-Art 1;Zusatzinformation-Inhalt 1;Zusatzinformation-Art 2;Zusatzinformation-Inhalt 2;Zusatzinformation-Art 3;Zusatzinformation-Inhalt 3;Zusatzinformation-Art 4;Zusatzinformation-Inhalt 4;Zusatzinformation-Art 5;Zusatzinformation-Inhalt 5;Zusatzinformation-Art 6;Zusatzinformation-Inhalt 6;Zusatzinformation-Art 7;Zusatzinformation-Inhalt 7;Zusatzinformation-Art 8;Zusatzinformation-Inhalt 8;Zusatzinformation-Art 9;Zusatzinformation-Inhalt 9;Zusatzinformation-Art 10;Zusatzinformation-Inhalt 10;Zusatzinformation-Art 11;Zusatzinformation-Inhalt 11;Zusatzinformation-Art 12;Zusatzinformation-Inhalt 12;Zusatzinformation-Art 13;Zusatzinformation-Inhalt 13;Zusatzinformation-Art 14;Zusatzinformation-Inhalt 14;Zusatzinformation-Art 15;Zusatzinformation-Inhalt 15;Zusatzinformation-Art 16;Zusatzinformation-Inhalt 16;Zusatzinformation-Art 17;Zusatzinformation-Inhalt 17;Zusatzinformation-Art 18;Zusatzinformation-Inhalt 18;Zusatzinformation-Art 19;Zusatzinformation-Inhalt 19;Zusatzinformation-Art 20;Zusatzinformation-Inhalt 20;St<53>ck;Gewicht;Zahlweise;Forderungsart;Veranlagungsjahr;Zugeordnete F<>lligkeit;Skontotyp;Auftragsnummer;Buchungstyp;USt-Schl<68>ssel (Anzahlungen);EU-Mitgliedstaat (Anzahlungen);Sachverhalt L+L (Anzahlungen);EU-Steuersatz (Anzahlungen);Erlöskonto (Anzahlungen);Herkunft-Kz;Leerfeld;KOST-Datum;SEPAMandatsreferenz;Skontosperre;Gesellschaftername;Beteiligtennummer;Identifikationsnummer;Zeichnernummer;Postensperre bis;Bezeichnung SoBil-Sachverhalt;Kennzeichen SoBil-Buchung;Festschreibung;Leistungsdatum;Datum Zuord. Steuerperiode");
@ -223,7 +229,8 @@ public class MigrationMahnerDatev {
// konten // konten
writer.write(konto + ";" + gegenkonto + ";;"); writer.write(konto + ";" + gegenkonto + ";;");
// datum und rechnungsnummer // datum und rechnungsnummer
writer.write(rechnungsDatum.substring(0,4) + ";" + rechnungsNummer + ";;;"+text + ";0;;;0;;;;;Faelligkeit;"+faelligkeit+";"); writer.write(rechnungsDatum.substring(0, 4) + ";" + rechnungsNummer + ";;;" + text + ";0;;;0;;;;;Faelligkeit;"
+ faelligkeit + ";");
writer.write(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"); writer.write(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;");
writer.newLine(); writer.newLine();

View file

@ -1,19 +1,9 @@
package com.alexanderlogistics.migration; package com.alexanderlogistics.migration;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -26,8 +16,6 @@ import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import junit.framework.Assert;
/** /**
* Dieser Agent ordnet nachträglich Ausgangsrechnungen aus der Migraiton einem * Dieser Agent ordnet nachträglich Ausgangsrechnungen aus der Migraiton einem
* Space zu. * Space zu.
@ -35,6 +23,8 @@ import junit.framework.Assert;
* @author rsoika * @author rsoika
* *
*/ */
@Ignore
@Deprecated
public class MigrationSpaceZuordnung { public class MigrationSpaceZuordnung {
WorkflowClient workflowCLient = null; WorkflowClient workflowCLient = null;
@ -55,11 +45,9 @@ public class MigrationSpaceZuordnung {
FormAuthenticator formAuth = new FormAuthenticator(restAPI, user, ps); FormAuthenticator formAuth = new FormAuthenticator(restAPI, user, ps);
workflowCLient.registerClientRequestFilter(formAuth); workflowCLient.registerClientRequestFilter(formAuth);
// load spaces Pos Expressions // load spaces Pos Expressions
loadSpacePosMappings(); loadSpacePosMappings();
} }
/** /**
@ -91,7 +79,6 @@ public class MigrationSpaceZuordnung {
workflowCLient.setSortBy("$created"); workflowCLient.setSortBy("$created");
List<ItemCollection> invoices = workflowCLient.searchDocuments(query); List<ItemCollection> invoices = workflowCLient.searchDocuments(query);
System.out.println("... ich processe " + invoices.size() + " invoices..."); System.out.println("... ich processe " + invoices.size() + " invoices...");
// teste space.ref // teste space.ref
@ -142,7 +129,6 @@ public class MigrationSpaceZuordnung {
} }
} }
} }
// fetrig? // fetrig?
@ -180,6 +166,5 @@ public class MigrationSpaceZuordnung {
spaceNames.put(space.getUniqueID(), space.getItemValueString("space.name")); spaceNames.put(space.getUniqueID(), space.getItemValueString("space.name"));
} }
} }
} }