package com.asksunny.codegen;

import static org.junit.Assert.*;

import org.junit.Test;

import com.asksunny.codegen.angular.CRUDUIGenerator;
import com.asksunny.codegen.java.EntityCodeGen;
import com.asksunny.codegen.java.JavaMyBatisMapperGenerator;
import com.asksunny.codegen.java.JavaRestControllerGenerator;
import com.asksunny.schema.Entity;
import com.asksunny.schema.Schema;
import com.asksunny.schema.parser.SQLScriptLexer;
import com.asksunny.schema.parser.SQLScriptParser;

public class CRUDUIGeneratorTest {

	@Test
	public void test() throws Exception {
		CodeGenConfig config = new CodeGenConfig();
		config.setMapperPackageName("com.test.mappers");
		config.setDomainPackageName("com.test.domain");
		config.setJavaBaseDir("target/src/main/java");
		config.setMyBatisXmlBaseDir("target/src/main/java");
		config.setSpringXmlBaseDir("target/src/main/java");
		config.setRestPackageName("com.test.rest");
		SQLScriptLexer lexer = new SQLScriptLexer(getClass().getResourceAsStream("/TestAngularGen.ddl.sql"));
		SQLScriptParser tokenReader = new SQLScriptParser(lexer);
		Schema schema = tokenReader.parseSql();		
		Entity entity = schema.get("Persons1");		
		JavaMyBatisMapperGenerator gen = new JavaMyBatisMapperGenerator(config, entity);
		gen.doCodeGen();
		Entity entity2 = schema.get("Persons1");	
		JavaRestControllerGenerator gen2 = new JavaRestControllerGenerator(config, entity2);
		gen2.doCodeGen();
		
	}

}

@@ -1182,25 +1182,25 @@
 get(%22Persons
-1
+2
 %22);%09%09%0D%0A%09%09Jav
@@ -1340,9 +1340,9 @@
 sons
-1
+2
 %22);%09

add code