--- /dev/null
+package hu.user.mediacube.executors.tests;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class _2023_OfflineMC2TSMValidator {
+
+ /*
+ dsmadmc -id=support -password=userkft1q2 -TABdelimited -dataonly=yes "select LL_NAME from backups where FILESPACE_NAME = '/JOBENGINE'" >htv-tsm.txt
+ SELECT mf.relativepath, m.archived FROM mediafile mf, media m WHERE m.id=mf.mediaid and mf.storeid=1
+ */
+
+ @Test
+ public void process() throws Exception {
+ String tsmInput = "/opt/HTV/htv-tsm-2301.txt";
+ String mcInput = "/opt/HTV/htv-mc-2301.txt";
+
+ List<String> lines = Files.readAllLines(Paths.get(tsmInput));
+
+ Set<String> tsm = new LinkedHashSet<>();
+ lines.forEach(x -> {
+ if (tsm.contains(x)) {
+ // System.out.println("Already added " + x);
+ } else {
+ tsm.add(x);
+ }
+
+ });
+
+ // Set<String> conflict = new HashSet<>(Files.readAllLines(Paths.get("/opt/HTV/htv-conflict-2212.txt")));
+
+ System.out.println("TSM lines " + tsm.size());
+ Set<String> mc = new LinkedHashSet<>(Files.readAllLines(Paths.get(mcInput)));
+ Map<String, String> mcMap = new HashMap<>();
+ mc.forEach(x -> {
+ String[] tokens = x.split("\t");
+ if (tokens.length != 2) {
+ System.out.println("Wrong line:" + x);
+ } else {
+ mcMap.put(tokens[0].replace("\"", ""), tokens[1].replace("'", ""));
+ }
+ });
+
+ int errorCount = 0;
+ Set<String> mcIds = mcMap.keySet();
+ StringBuilder sb = new StringBuilder();
+ List<String> mfIDs = new ArrayList<>();
+ for (String mcfile : mcIds) {
+ boolean tsmContains = tsm.contains(mcfile);
+ if (!tsmContains) {
+// if (conflict.contains(mcfile))
+// continue;
+ errorCount++;
+ }
+ }
+ System.out.println("All missing: " + errorCount);
+
+// String joinedString = String.join(",", mfIDs);
+// System.out.println(joinedString);
+ Files.write(Paths.get("/opt/HTV/htv-missing.txt"), sb.toString().getBytes());
+ }
+
+}