package org.ihtsdo.buildcloud.service.build.transform;

import java.security.NoSuchAlgorithmException;

import org.ihtsdo.buildcloud.service.build.RF2Constants;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class RepeatableRelationshipUUIDTransformTest {

	private RepeatableRelationshipUUIDTransform transform;

	@Before
	public void setup() throws NoSuchAlgorithmException {
		transform = new RepeatableRelationshipUUIDTransform();
	}

	@Test
	public void testTransformSameLineAlwaysGivesSameUUID() throws Exception {
		final String lineA = "null\t20140731\t1\t900000000000207008\t1016002\t81137002\t0\t116680003\t900000000000010007\t900000000000451002";
		final String lineB = "null\t20140731\t1\t900000000000012004\t800010001\t399748002\t0\t116680003\t900000000000010007\t900000000000451002";

		final String[] valuesA1 = lineA.split("\\t");
		Assert.assertEquals(RF2Constants.NULL_STRING, valuesA1[0]);
		transform.transformLine(valuesA1);
		Assert.assertEquals("c5c20346-62d2-5fb1-8df4-82fbdbb4cc49", valuesA1[0]);

		final String[] valuesA2 = lineA.split("\\t");
		Assert.assertEquals(RF2Constants.NULL_STRING, valuesA2[0]);
		transform.transformLine(valuesA2);
		Assert.assertEquals("c5c20346-62d2-5fb1-8df4-82fbdbb4cc49", valuesA2[0]);

		final String[] valuesB1 = lineB.split("\\t");
		Assert.assertEquals(RF2Constants.NULL_STRING, valuesB1[0]);
		transform.transformLine(valuesB1);
		Assert.assertEquals("81342da0-c3df-5ce2-900a-95fd6be13885", valuesB1[0]);

		final String[] valuesB2 = lineB.split("\\t");
		Assert.assertEquals(RF2Constants.NULL_STRING, valuesB2[0]);
		transform.transformLine(valuesB2);
		Assert.assertEquals("81342da0-c3df-5ce2-900a-95fd6be13885", valuesB2[0]);
	}
}
@@ -228,16 +228,43 @@
 .Test;%0A%0A
+import java.util.Scanner;%0A%0A
 public c
@@ -1750,10 +1750,974 @@
 %5B0%5D);%0A%09%7D
+%0A%0A%09public static void main(String%5B%5D args) throws TransformationException, NoSuchAlgorithmException %7B%0A%09%09RepeatableRelationshipUUIDTransformTest test = new RepeatableRelationshipUUIDTransformTest();%0A%09%09test.setup();%0A%09%09// create a scanner so we can read the command-line input%0A%09%09Scanner scanner = new Scanner(System.in);%0A%0A%09%09// prompt for the conceptid, destination, relationship group and relationship type%0A%09%09System.out.print(%22Enter source concept id: %22);%0A%09%09String sourceSCTID = scanner.next();%0A%0A%09%09System.out.print(%22Enter destination id: %22);%0A%09%09String destinationSCTID = scanner.next();%0A%0A%09%09System.out.print(%22Enter type id: %22);%0A%09%09String typeSCTID = scanner.next();%0A%0A%09%09for (int i = 0; i %3C= 5; i++) %7B%0A%0A%09%09%09String%5B%5D values = new String%5B8%5D;%0A%09%09%09values%5B4%5D = sourceSCTID;%0A%09%09%09values%5B5%5D = destinationSCTID;%0A%09%09%09values%5B6%5D = Integer.toString(i);%0A%09%09%09values%5B7%5D = typeSCTID;%0A%0A%09%09%09test.transform.transformLine(values);%0A%09%09%09System.out.println(%22Group: %22 + i + %22 UUID: %22 + values%5B0%5D);%0A%0A%09%09%7D%0A%09%7D
 %0A%7D

Add support for generating repeatable UUIDs from commandline