[Jiemamy-notify] commit [2050] テストケースに、assertを追加

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2008年 10月 27日 (月) 02:24:45 JST


Revision: 2050
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2050
Author:   daisuke_m
Date:     2008-10-27 02:24:45 +0900 (Mon, 27 Oct 2008)

Log Message:
-----------
テストケースに、assertを追加

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java


-------------- next part --------------
Modified: artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java	2008-10-26 13:15:41 UTC (rev 2049)
+++ artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java	2008-10-26 17:24:45 UTC (rev 2050)
@@ -18,6 +18,11 @@
  */
 package org.jiemamy.serializer;
 
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+
+import org.apache.commons.lang.text.StrBuilder;
 import org.junit.Test;
 
 import org.jiemamy.core.S2FactoryStrategy;
@@ -57,16 +62,94 @@
 		t.getColumns().add(rootModel.createJiemamyModel(ColumnModel.class).init("col3", new TimestampDataTypeMock()));
 		rootModel.appendModel(t);
 		
-		ModelInputStream mis = null;
+		StrBuilder sbActual = new StrBuilder();
+		InputStream mis = null;
 		try {
 			mis = new ModelInputStream(rootModel);
 			byte[] buffer = new byte[50];
 			while (-1 != mis.read(buffer)) {
 				System.out.print(new String(buffer));
+				sbActual.append(buffer);
 				buffer = new byte[255];
 			}
 		} finally {
 			mis.close();
 		}
+		
+		StrBuilder sbExpected = new StrBuilder();
+		sbExpected.appendln("<?xml version=\"1.0\" standalone=\"yes\"?>");
+		sbExpected.append("<rootModel id=\"").append(rootModel.getId().toString()).appendln("\">");
+		sbExpected.appendln("  <rdbmsName>org.jiemamy.dialect.MySQLDialect</rdbmsName>");
+		sbExpected.appendln("  <beginScript>BEGIN;</beginScript>");
+		sbExpected.appendln("  <endScript>COMMIT;</endScript>");
+		sbExpected.appendln("  <description>シリアライゼーションイメージ</description>");
+		sbExpected.appendln("  <schemaName/>");
+		sbExpected.appendln("  <domains>");
+		sbExpected.appendln("  </domains>");
+		sbExpected.appendln("  <nodes>");
+		sbExpected.append("    <table id=\"").append(t.getId().toString()).appendln("\">");
+		sbExpected.appendln("      <name>T_DEPT</name>");
+		sbExpected.appendln("      <logicalName/>");
+		sbExpected.appendln("      <sourceConnections/>");
+		sbExpected.appendln("      <targetConnections/>");
+		sbExpected.appendln("      <beginScript/>");
+		sbExpected.appendln("      <endScript/>");
+		sbExpected.appendln("      <description>部署マスタです。</description>");
+		sbExpected.appendln("      <columns>");
+		sbExpected.append("        <column id=\"").append(t.getColumns().get(0).getId().toString()).appendln("\">");
+		sbExpected.appendln("          <name>col1</name>");
+		sbExpected.appendln("          <logicalName/>");
+		sbExpected.append("          <dataType id=\"").append(t.getColumns().get(0).getDataType().getId().toString())
+			.appendln("\" type=\"org.jiemamy.core.model.typedef.datatype.impl.VarcharDataTypeMock\"/>");
+		sbExpected.appendln("          <defaultValue/>");
+		sbExpected.appendln("          <constraints/>");
+		sbExpected.appendln("          <simpleIndex>false</simpleIndex>");
+		sbExpected.appendln("          <freeString/>");
+		sbExpected.appendln("          <description/>");
+		sbExpected.appendln("          <options/>");
+		sbExpected.appendln("          <representation>false</representation>");
+		sbExpected.appendln("        </column>");
+		sbExpected.append("        <column id=\"").append(t.getColumns().get(1).getId().toString()).appendln("\">");
+		sbExpected.appendln("          <name>col2</name>");
+		sbExpected.appendln("          <logicalName/>");
+		sbExpected.append("          <dataType id=\"").append(t.getColumns().get(1).getDataType().getId().toString())
+			.appendln("\" type=\"org.jiemamy.core.model.typedef.datatype.impl.IntegerDataTypeMock\">");
+		sbExpected.appendln("            <size>16</size>");
+		sbExpected.appendln("          </dataType>");
+		sbExpected.appendln("          <defaultValue/>");
+		sbExpected.appendln("          <constraints/>");
+		sbExpected.appendln("          <simpleIndex>false</simpleIndex>");
+		sbExpected.appendln("          <freeString/>");
+		sbExpected.appendln("          <description/>");
+		sbExpected.appendln("          <options/>");
+		sbExpected.appendln("          <representation>false</representation>");
+		sbExpected.appendln("        </column>");
+		sbExpected.append("        <column id=\"").append(t.getColumns().get(2).getId().toString()).appendln("\">");
+		sbExpected.appendln("          <name>col3</name>");
+		sbExpected.appendln("          <logicalName/>");
+		sbExpected.append("          <dataType id=\"").append(t.getColumns().get(2).getDataType().getId().toString())
+			.appendln("\" type=\"org.jiemamy.core.model.typedef.datatype.impl.TimestampDataTypeMock\"/>");
+		sbExpected.appendln("          <defaultValue/>");
+		sbExpected.appendln("          <constraints/>");
+		sbExpected.appendln("          <simpleIndex>false</simpleIndex>");
+		sbExpected.appendln("          <freeString/>");
+		sbExpected.appendln("          <description/>");
+		sbExpected.appendln("          <options/>");
+		sbExpected.appendln("          <representation>false</representation>");
+		sbExpected.appendln("        </column>");
+		sbExpected.appendln("      </columns>");
+		sbExpected.appendln("    </table>");
+		sbExpected.appendln("  </nodes>");
+		sbExpected.appendln("  <connections>");
+		sbExpected.appendln("  </connections>");
+		sbExpected.appendln("  <insertDataSetModels>");
+		sbExpected.appendln("  </insertDataSetModels>");
+		sbExpected.appendln("  <diagramPresentations>");
+		sbExpected.appendln("  </diagramPresentations>");
+		sbExpected.appendln("</rootModel>");
+		sbExpected.appendln("");
+		
+		System.out.println(sbExpected.toString());
+		assertEquals(sbExpected.toString(), sbActual.toString());
 	}
 }


Jiemamy-notify メーリングリストの案内
Zurück zum Archiv-Index