[Jiemamy-notify:2109] commit [3198] テストをエンティティの発見順番に依存しないように修正

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 4月 9日 (木) 00:49:29 JST


Revision: 3198
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3198
Author:   j5ik2o
Date:     2009-04-09 00:49:28 +0900 (Thu, 09 Apr 2009)

Log Message:
-----------
テストをエンティティの発見順番に依存しないように修正

Modified Paths:
--------------
    charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java


-------------- next part --------------
Modified: charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java	2009-04-08 13:36:06 UTC (rev 3197)
+++ charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java	2009-04-08 15:49:28 UTC (rev 3198)
@@ -60,7 +60,7 @@
 		classPathDirs.add(new File(JpaImporterTestUtil.getBuildDirNoException()));
 		context.setClassPathDirs(classPathDirs);
 		context.setPackageName("example.entity");
-		context.setReadComment(true);
+		context.setReadComment(false);
 		List<File> javaFileSrcDirs = CollectionsUtil.newArrayList();
 		javaFileSrcDirs.add(new File("src/test/java"));
 		context.setJavaSrcFileDirs(javaFileSrcDirs);
@@ -70,120 +70,123 @@
 		List<EntityMeta> entityMetas = entityMetaReader.read();
 		
 		EntityMeta em = entityMetas.get(0);
-		// entity name null check
-		assertThat(em.getName(), is(notNullValue()));
-		// entity name equal check
-		assertThat(em.getName(), is("depertment"));
-		LOG.debug(em.toString());
-		
-		// property null check
-		assertThat(em.getPropertyMeta("depertmentId"), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertmentName"), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version"), is(notNullValue()));
-		/*
-		// comment null check
-		assertThat(EntityMetaUtil.getComment(em), is(notNullValue()));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentId")), is(notNullValue()));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentName")), is(notNullValue()));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is(notNullValue()));
-		// comment equal check
-		assertThat(EntityMetaUtil.getComment(em), is("部署"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentId")), is("部署ID"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentName")), is("部署名"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is("バージョン"));
-		*/
-		// property name null check
-		assertThat(em.getPropertyMeta("depertmentId").getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertmentName").getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getName(), is(notNullValue()));
-		// property name equal check
-		assertThat(em.getPropertyMeta("depertmentId").getName(), is("depertmentId"));
-		assertThat(em.getPropertyMeta("depertmentName").getName(), is("depertmentName"));
-		assertThat(em.getPropertyMeta("version").getName(), is("version"));
-		// property class null check
-		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
-		// property class name null check
-		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
-		// property class name equal check
-		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is("java.lang.Long"));
-		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is("java.lang.String"));
-		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
-		// column name null check
-		assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is(notNullValue()));
-		// column name equal check
-		assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is("DEPERTMENT_ID"));
-		assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is("DEPERTMENT_NAME"));
-		assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is("VERSION"));
-		
-		// property attribute check
-		assertThat(em.getPropertyMeta("depertmentId").isId(), is(true));
-		assertThat(em.getPropertyMeta("version").isVersion(), is(true));
+		if ("depertment".equals(em.getName())) {
+			// entity name null check
+			assertThat(em.getName(), is(notNullValue()));
+			// entity name equal check
+			assertThat(em.getName(), is("depertment"));
+			LOG.debug(em.toString());
+			
+			// property null check
+			assertThat(em.getPropertyMeta("depertmentId"), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertmentName"), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version"), is(notNullValue()));
+			/*
+			// comment null check
+			assertThat(EntityMetaUtil.getComment(em), is(notNullValue()));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentId")), is(notNullValue()));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentName")), is(notNullValue()));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is(notNullValue()));
+			// comment equal check
+			assertThat(EntityMetaUtil.getComment(em), is("部署"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentId")), is("部署ID"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("depertmentName")), is("部署名"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is("バージョン"));
+			*/
+			// property name null check
+			assertThat(em.getPropertyMeta("depertmentId").getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertmentName").getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getName(), is(notNullValue()));
+			// property name equal check
+			assertThat(em.getPropertyMeta("depertmentId").getName(), is("depertmentId"));
+			assertThat(em.getPropertyMeta("depertmentName").getName(), is("depertmentName"));
+			assertThat(em.getPropertyMeta("version").getName(), is("version"));
+			// property class null check
+			assertThat(em.getPropertyMeta("depertmentId").getPropertyClass(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertmentName").getPropertyClass(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
+			// property class name null check
+			assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
+			// property class name equal check
+			assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is("java.lang.Long"));
+			assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is("java.lang.String"));
+			assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
+			// column name null check
+			assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is(notNullValue()));
+			// column name equal check
+			assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is("DEPERTMENT_ID"));
+			assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is("DEPERTMENT_NAME"));
+			assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is("VERSION"));
+			
+			// property attribute check
+			assertThat(em.getPropertyMeta("depertmentId").isId(), is(true));
+			assertThat(em.getPropertyMeta("version").isVersion(), is(true));
+		}
 		em = entityMetas.get(1);
-		
-		// entity name null check
-		assertThat(em.getName(), is(notNullValue()));
-		// entity name equal check
-		assertThat(em.getName(), is("employee"));
-		LOG.debug(em.toString());
-		// property null check
-		assertThat(em.getPropertyMeta("employeeId"), is(notNullValue()));
-		assertThat(em.getPropertyMeta("employeeName"), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version"), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertment"), is(notNullValue()));
-		/*
-		// comment null check
-		assertThat(EntityMetaUtil.getComment(em), is("従業員"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeId")), is(notNullValue()));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeName")), is(notNullValue()));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is(notNullValue()));
-		// comment equal check
-		assertThat(EntityMetaUtil.getComment(em), is("従業員"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeId")), is("従業員ID"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeName")), is("従業員名"));
-		assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is("バージョン"));
-		*/
-		// property name null check
-		assertThat(em.getPropertyMeta("employeeId").getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("employeeName").getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getName(), is(notNullValue()));
-		// property name equal check
-		assertThat(em.getPropertyMeta("employeeId").getName(), is("employeeId"));
-		assertThat(em.getPropertyMeta("employeeName").getName(), is("employeeName"));
-		assertThat(em.getPropertyMeta("version").getName(), is("version"));
-		// property class null check
-		assertThat(em.getPropertyMeta("employeeId").getPropertyClass(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("employeeName").getPropertyClass(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
-		// property class name null check
-		assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
-		// property class name equal check
-		assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is("java.lang.Long"));
-		assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is("java.lang.String"));
-		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
-		// column name null check
-		assertThat(em.getPropertyMeta("employeeId").getColumnMeta().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("employeeName").getColumnMeta().getName(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is(notNullValue()));
-		// column name equal check
-		assertThat(em.getPropertyMeta("employeeId").getColumnMeta().getName(), is("EMPLOYEE_ID"));
-		assertThat(em.getPropertyMeta("employeeName").getColumnMeta().getName(), is("EMPLOYEE_NAME"));
-		assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is("VERSION"));
-		// property attribute check
-		assertThat(em.getPropertyMeta("employeeId").isId(), is(true));
-		assertThat(em.getPropertyMeta("version").isVersion(), is(true));
-		assertThat(em.getPropertyMeta("depertment").isRelationship(), is(true));
-		assertThat(em.getPropertyMeta("depertment").getRelationshipClass(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertment").getRelationshipType(), is(notNullValue()));
-		assertThat(em.getPropertyMeta("depertment").getRelationshipClass().getName(), is("example.entity.Depertment"));
-		assertThat(em.getPropertyMeta("depertment").getRelationshipType(), is(RelationshipType.MANY_TO_ONE));
-		
+		if ("employee".equals(em.getName())) {
+			// entity name null check
+			assertThat(em.getName(), is(notNullValue()));
+			// entity name equal check
+			assertThat(em.getName(), is("employee"));
+			LOG.debug(em.toString());
+			// property null check
+			assertThat(em.getPropertyMeta("employeeId"), is(notNullValue()));
+			assertThat(em.getPropertyMeta("employeeName"), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version"), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertment"), is(notNullValue()));
+			/*
+			// comment null check
+			assertThat(EntityMetaUtil.getComment(em), is("従業員"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeId")), is(notNullValue()));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeName")), is(notNullValue()));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is(notNullValue()));
+			// comment equal check
+			assertThat(EntityMetaUtil.getComment(em), is("従業員"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeId")), is("従業員ID"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("employeeName")), is("従業員名"));
+			assertThat(PropertyMetaUtil.getComment(em.getPropertyMeta("version")), is("バージョン"));
+			*/
+			// property name null check
+			assertThat(em.getPropertyMeta("employeeId").getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("employeeName").getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getName(), is(notNullValue()));
+			// property name equal check
+			assertThat(em.getPropertyMeta("employeeId").getName(), is("employeeId"));
+			assertThat(em.getPropertyMeta("employeeName").getName(), is("employeeName"));
+			assertThat(em.getPropertyMeta("version").getName(), is("version"));
+			// property class null check
+			assertThat(em.getPropertyMeta("employeeId").getPropertyClass(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("employeeName").getPropertyClass(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
+			// property class name null check
+			assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
+			// property class name equal check
+			assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is("java.lang.Long"));
+			assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is("java.lang.String"));
+			assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
+			// column name null check
+			assertThat(em.getPropertyMeta("employeeId").getColumnMeta().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("employeeName").getColumnMeta().getName(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is(notNullValue()));
+			// column name equal check
+			assertThat(em.getPropertyMeta("employeeId").getColumnMeta().getName(), is("EMPLOYEE_ID"));
+			assertThat(em.getPropertyMeta("employeeName").getColumnMeta().getName(), is("EMPLOYEE_NAME"));
+			assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is("VERSION"));
+			// property attribute check
+			assertThat(em.getPropertyMeta("employeeId").isId(), is(true));
+			assertThat(em.getPropertyMeta("version").isVersion(), is(true));
+			assertThat(em.getPropertyMeta("depertment").isRelationship(), is(true));
+			assertThat(em.getPropertyMeta("depertment").getRelationshipClass(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertment").getRelationshipType(), is(notNullValue()));
+			assertThat(em.getPropertyMeta("depertment").getRelationshipClass().getName(),
+					is("example.entity.Depertment"));
+			assertThat(em.getPropertyMeta("depertment").getRelationshipType(), is(RelationshipType.MANY_TO_ONE));
+		}
 	}
 }



Jiemamy-notify メーリングリストの案内
アーカイブの一覧に戻る