{"id":689,"date":"2019-06-16T14:12:38","date_gmt":"2019-06-16T05:12:38","guid":{"rendered":"https:\/\/ito-u-oti.com\/?p=689"},"modified":"2020-07-10T17:35:16","modified_gmt":"2020-07-10T08:35:16","slug":"post-689","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=689","title":{"rendered":"\u3010spring batch\u3011dbUnit\u3092\u4f7f\u7528\u3057\u3066postgresql\u306e\u7279\u6b8a\u30c7\u30fc\u30bf\u578b\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b"},"content":{"rendered":"\n<p>postgresql\u3092\u4f7f\u7528\u3057\u305fdbUnit\u30c6\u30b9\u30c8\u3092\u884c\u3063\u305f\u6642\u306b\u3001DBUnit\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306eDataFactory\u3067\u3042\u308bPostgresqlDataTypeFactory\u3092\u4f7f\u7528\u3059\u308b\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001postgresql\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4e2d\u306b\u7279\u6b8a\u30c7\u30fc\u30bf\u578b\u306b\u8a72\u5f53\u3059\u308b\u30ab\u30e9\u30e0\u304c\u3042\u308b\u3068\u4e0a\u624b\u304f\u6301\u3063\u3066\u3053\u308c\u306a\u3044\u4e8b\u8c61\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u7279\u6b8a\u30c7\u30fc\u30bf\u578b\u3068\u3044\u3046\u306e\u306f\u4e00\u822c\u7684\u306aDB\u306b\u3042\u308b\u3088\u3046\u306a\u578b\uff08int,timestamp,varchar\u3068\u304b\uff09\u3067\u306f\u306a\u304f\u3001postgresql\u7279\u6709\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u578b\u306e\u4e8b\u3067\u3059\u3002\uff08_text\u3001tsvector\u3068\u304b\uff09<br> <a href=\"https:\/\/www.postgresql.jp\/document\/9.4\/html\/datatype.html\">https:\/\/www.postgresql.jp\/document\/9.4\/html\/datatype.html<\/a> <\/p>\n\n\n\n<h2 id=\"outline__1\" class=\"wp-block-heading\">\u4e8b\u8c61<\/h2>\n\n\n\n<p>Spring batch\u306eRepositoryTest\u3092\u7279\u6b8a\u30c7\u30fc\u30bf\u578b\u306e\u30ab\u30e9\u30e0\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066dbUnit\u3092\u7528\u3044\u3066Setup\u3057\u3088\u3046\u3068\u3057\u305f\u3068\u304d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3002<\/p>\n\n\n\n<h3 id=\"outline__1_1\" class=\"wp-block-heading\">\u5bfe\u8c61\u306e\u30c6\u30fc\u30d6\u30eb<\/h3>\n\n\n\n<p>postgresql\u516c\u5f0f\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u7fa4\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<br><a href=\"http:\/\/www.postgresqltutorial.com\/postgresql-sample-database\/\">PostgreSQL Sample Database<\/a><br>\u4eca\u56de\u306ffilm\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u306eSELECT\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 id=\"outline__1_1_1\" class=\"wp-block-heading\">film\u30c6\u30fc\u30d6\u30eb<\/h4>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/06\/postgresqlRepository.png\" alt=\"\" class=\"wp-image-1016\" width=\"539\" height=\"230\"\/><\/figure>\n\n\n\n<p>\u3053\u306e\u4e2d\u3067postgresql\u306e\u7279\u6b8a\u30c7\u30fc\u30bf\u578b\u306b\u5c5e\u3059\u308b\u306e\u306f<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>mpaa_rating<\/li><li>_text<\/li><li>tsvector<\/li><\/ul>\n\n\n\n<p>\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u308c\u4ee5\u5916\u306f\u901a\u5e38\u306e\u3084\u308a\u65b9\u3067Java\u3068\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u304c\u53ef\u80fd\u3067\u3059\u3002<br> <a href=\"http:\/\/beanql.osdn.jp\/type_map.html\">http:\/\/beanql.osdn.jp\/type_map.html<\/a> <\/p>\n\n\n\n<h3 id=\"outline__1_2\" class=\"wp-block-heading\">SQL<\/h3>\n\n\n\n<p>Mybatis\u306e\u5b9a\u7fa9\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE mapper PUBLIC &quot;-\/\/mybatis.org\/DTD Mapper 3.0\/\/EN&quot;\n        &quot;http:\/\/mybatis.org\/dtd\/mybatis-3-mapper.dtd&quot;&gt;\n\n&lt;mapper namespace=&quot;itouoti.spring.batch.repository.jobsRepository.job1.Job1Repository&quot;&gt;\n\n    &lt;select id=&quot;sarchfilmData&quot; resultType=&quot;itouoti.spring.batch.repository.commonDTO.FilmDTO&quot; parameterType=&quot;map&quot;&gt;\n        &lt;!&#x5B;CDATA&#x5B;\n            SELECT\n                 film_id AS filmId,\n                 title,\n                 description,\n                 release_year AS releaseYear,\n                 language_id AS languageId,\n                 rental_duration AS rentalDuration,\n                 rental_rate AS rentalRate,\n                 length,\n                 replacement_cost AS replacementCost,\n                 rating,\n                 last_update AS lastUpdate,\n                 special_features AS specialFeatures,\n                 fulltext\n            FROM\n                film\n            WHERE\n                film_id = #{filmId}\n        ]]&gt;\n    &lt;\/select&gt;\n\n&lt;\/mapper&gt;\n<\/pre><\/div>\n\n\n<h3 id=\"outline__1_3\" class=\"wp-block-heading\">\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<p>DBUnit\u3092\u4f7f\u3063\u3066\u30a8\u30af\u30bb\u30eb\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c6\u30fc\u30d6\u30eb\u30c7\u30fc\u30bf\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage itouoti.spring.batch.repository.jobsRepository.job1;\n\nimport *;\n\n\/**\n * Theories\u30c6\u30b9\u30c8\n *\/\n@RunWith(Theories.class)\n@ContextConfiguration(locations = { &quot;classpath:META-INF\/jobs\/job1\/job1Test.xml&quot; })\n@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,\n        DirtiesContextTestExecutionListener.class,\n        TransactionalTestExecutionListener.class,\n        DbUnitTestExecutionListener.class })\n@Transactional\n@DbUnitConfiguration(dataSetLoader = XlsDataSetLoader.class)\n@Slf4j\n\/**\n * job1Repository sarchfilmData Test\n * @author itouoti\n *\/\npublic class Job1RepositorySerchFilmDataTest {\n\n    @ClassRule\n    public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();\n\n    @Rule\n    public final SpringMethodRule springMethodRule = new SpringMethodRule();\n\n    @Inject\n    Job1Repository target;\n\n    @Inject\n    ResourceLoader resourceLoader;\n\n    @Inject\n    JdbcTemplate jdbcTemplate;\n\n    @Inject\n    TransactionAwareDataSourceProxy masterDataSource;\n\n    @Value(&quot;${xlsx.expectedDataFile}&quot;)\n    String xlsxExpectedDataFile;\n\n    \/\/ \u30a8\u30af\u30bb\u30eb\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\n    private static String xlsxPath = &quot;classpath:itouoti\/spring\/batch\/repository\/jobsRepository\/job1\/&quot;;\n\n    \/\/ \u30c6\u30b9\u30c8\u30d1\u30bf\u30fc\u30f3\u7528\u30a8\u30af\u30bb\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n    private static IDataSet xlsDataSet;\n\n    \/\/ assert\u30a8\u30e9\u30fc\u683c\u7d0d\u7528List\n    private static List&lt;AssertionError&gt; assertionErrors = new ArrayList&lt;AssertionError&gt;();\n\n    private static String jdbcProps = &quot;classpath:batch-application.properties&quot;;\n\n    private static Properties props;\n\n    \/**\n     * \u30c6\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u8d77\u52d5\u524d\u8a2d\u5b9a\n     * @throws Exception \u4f8b\u5916\n     *\/\n    @BeforeClass\n    public static void setUpBeforeTest() throws Exception {\n\n        log.info(&quot;\u25a1sarchfilmData test is start&quot;);\n\n        \/\/ xlsx\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\n        File file = ResourceUtils.getFile(xlsxPath + &quot;testList.xlsx&quot;);\n        xlsDataSet = new XlsDataSet(file);\n\n        \/\/ properties\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\n        props = LoadProperties.load(jdbcProps);\n\n        \/\/ \u5916\u90e8\u30ad\u30fc\u5236\u7d04\u306e\u89e3\u9664\n        String disableAlter = &quot;ALTER TABLE film DISABLE TRIGGER ALL&quot;;\n\n        ExecSQL.execSQLExecSQL(props, disableAlter, false);\n    }\n\n    \/**\n     * \u30c6\u30b9\u30c8\u6bce\u8d77\u52d5\u524d\u8a2d\u5b9a\n     * @throws Exception \u4f8b\u5916\n     *\/\n    @Before\n    public void setUp() throws Exception {\n\n    }\n\n    \/**\n     * \u30c6\u30b9\u30c8\u6bce\u691c\u8a3c\u5f8c\u51e6\u7406\n     *\/\n    @After\n    public void cleanUp() {\n        \/\/ \u30c6\u30b9\u30c8\u5f8c\u306e\u5f8c\u51e6\u7406\u304c\u3042\u308c\u3070\u8a18\u8ff0\n    }\n\n    \/**\n     * \u30c6\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u5b9f\u884c\u5f8c\u51e6\u7406\n     * @throws Exception \u4f8b\u5916\n     *\/\n    @AfterClass\n    public static void creanUpAfterTest() throws Exception {\n        \/\/ \u30c6\u30b9\u30c8\u5f8c\u306e\u5f8c\u51e6\u7406\u304c\u3042\u308c\u3070\u8a18\u8ff0\n        if (assertionErrors.size() &gt; 0) {\n            for (AssertionError e : assertionErrors) {\n                log.error(e.getMessage());\n                e.printStackTrace();\n            }\n            log.error(assertionErrors.size() + &quot;\u4ef6\u306eAssertionError\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059&quot;);\n            fail(assertionErrors.size() + &quot;\u4ef6\u306eAssertionError\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059&quot;);\n        }\n\n        log.info(&quot;\u25a1sarchfilmData test is end&quot;);\n\n        \/\/ \u5916\u90e8\u30ad\u30fc\u5236\u7d04\u306e\u8a2d\u5b9a\n        String disableAlter = &quot;ALTER TABLE film ENABLE TRIGGER ALL&quot;;\n\n        ExecSQL.execSQLExecSQL(props, disableAlter, false);\n    }\n\n    \/**\n     * job1Repository.sarchfilmData\u30c6\u30b9\u30c8\n     * @throws Exception DBUnit\u306exlsx\u8aad\u307f\u8fbc\u307f\u4f8b\u5916\n     *\/\n    @Theory\n    @DatabaseSetup(&quot;classpath:itouoti\/spring\/batch\/repository\/jobsRepository\/job1\/setUp_data.xlsx&quot;)\n    public void sarchfilmDataTest(\n                                  Job1RepositorySerchFilmDataParam testParam) throws Exception {\n\n        log.info(&quot;\u25a0 TestNo.&quot; + testParam.no + &quot; sarchfilmData test is start&quot;);\n\n        try {\n\n            \/\/ STEP1 \u30e1\u30bd\u30c3\u30c9\u306e\u30c6\u30b9\u30c8\n            Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();\n            map.put(&quot;filmId&quot;, testParam.getFilmId());\n            FilmDTO result = target.sarchfilmData(map);\n\n            \/\/ STEP2 \u53d6\u5f97\u4ef6\u6570\u306e\u691c\u8a3c\n            assertThat(result.getTitle(), is(testParam.getExpectTitle()));\n            assertThat(result.getDescription(), is(testParam.getExpectDescription()));\n\n            \/\/ STEP3 \u30c6\u30fc\u30d6\u30eb\u72b6\u614b\u306e\u691c\u8a3c\n            ITable actual1 = DBUnitSetUp.getAtualDataTable(masterDataSource, &quot;public.film&quot;);\n            ITable expected1 = DBUnitSetUp.getExpectedDataTable(resourceLoader, xlsxPath + xlsxExpectedDataFile, &quot;film&quot;);\n\n            org.dbunit.Assertion.assertEquals(new SortedTable(new TrimTable(expected1)), new SortedTable(new TrimTable(actual1), expected1\n                    .getTableMetaData()));\n\n        } catch (AssertionError e) {\n            \/\/ AssertionErrors\u306b\u8caf\u3081\u308b\n            log.error(testParam.no + &quot;Memo = &quot; + testParam.getMemo());\n            assertionErrors.add(e);\n        } catch (Exception e) {\n            \/\/ AssertionErrors\u306b\u8caf\u3081\u308b\n            log.error(e.getMessage());\n            assertionErrors.add(new AssertionError(e));\n        } finally {\n            log.info(&quot;\u25a0 TestNo.&quot; + testParam.no + &quot; sarchfilmData test is end&quot;);\n        }\n    }\n\n    \/**\n     * job1Repository.sarchfilmData\u30c6\u30b9\u30c8\u7528\u30d1\u30e9\u30e1\u30fc\u30bf\u751f\u6210\n     * @return sarchfilmData&#x5B;]\n     * @throws Exception \u4f8b\u5916\n     *\/\n    @DataPoints\n    public static Job1RepositorySerchFilmDataParam&#x5B;] inputTestParams() throws Exception {\n\n        \/\/ \u30c6\u30b9\u30c8\u7528\u30b7\u30fc\u30c8\u540d\n        String testParamSheet = &quot;param&quot;;\n\n        ArrayList&lt;Job1RepositorySerchFilmDataParam&gt; paramList = new ArrayList&lt;Job1RepositorySerchFilmDataParam&gt;();\n\n        try {\n            ITable paramTable = xlsDataSet.getTable(testParamSheet);\n\n            for (int i = 0; i &lt; paramTable.getRowCount(); i++) {\n                Job1RepositorySerchFilmDataParam param = new Job1RepositorySerchFilmDataParam();\n\n                \/\/ \u8a66\u9a13No\n                param.setNo(TestHelper.toStr(paramTable, i, &quot;no&quot;));\n\n                \/\/ filmId\n                param.setFilmId(TestHelper.toInt(paramTable, i, &quot;filmId&quot;));\n\n                \/\/ \u671f\u5f85\u5024(\u4ef6\u6570)\n                param.setExpectCount(TestHelper.toInt(paramTable, i, &quot;expectCount&quot;));\n\n                \/\/ \u671f\u5f85\u5024(title)\n                param.setExpectTitle(TestHelper.toStr(paramTable, i, &quot;expectTitle&quot;));\n\n                \/\/ \u671f\u5f85\u5024(description)\n                param.setExpectDescription(TestHelper.toStr(paramTable, i, &quot;expectDescription&quot;));\n\n                \/\/ \u5099\u8003\n                param.setMemo(TestHelper.toStr(paramTable, i, &quot;memo&quot;));\n\n                paramList.add(param);\n            }\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return paramList.toArray(new Job1RepositorySerchFilmDataParam&#x5B;paramList.size()]);\n    }\n\n}\n\n<\/pre><\/div>\n\n\n<h2 id=\"outline__2\" class=\"wp-block-heading\">\u30a8\u30e9\u30fc\u5185\u5bb9<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;2019\/06\/16 13:47:33] &#x5B;main] &#x5B;o.d.util.SQLHelper    ] &#x5B;WARN ] film.special_features data type (2003, '_text') not recognized and will be ignored. See FAQ for more information.\n&#x5B;2019\/06\/16 13:47:33] &#x5B;main] &#x5B;o.d.util.SQLHelper    ] &#x5B;WARN ] film.fulltext data type (1111, 'tsvector') not recognized and will be ignored. See FAQ for more information.\n&#x5B;2019\/06\/16 13:47:33] &#x5B;main] &#x5B;o.s.t.c.TestContextManager] &#x5B;WARN ] Caught exception while allowing TestExecutionListener &#x5B;com.github.springtestdbunit.DbUnitTestExecutionListener@7ba18f1b] to process 'before' execution of test method &#x5B;public void itouoti.spring.batch.repository.jobsRepository.job1.Job1RepositorySerchFilmDataTest.sarchfilmDataTest(itouoti.spring.batch.repository.jobsRepository.job1.Job1RepositorySerchFilmDataParam) throws java.lang.Exception] for test instance &#x5B;itouoti.spring.batch.repository.jobsRepository.job1.Job1RepositorySerchFilmDataTest@581d969c]\norg.dbunit.dataset.NoSuchColumnException: film.SPECIAL_FEATURES -  (Non-uppercase input column: special_features) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.\n\tat org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)\n\tat org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)\n\tat org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:150)\n\tat org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)\n\tat com.github.springtestdbunit.DbUnitRunner.setupOrTeardown(DbUnitRunner.java:183)\n\tat com.github.springtestdbunit.DbUnitRunner.beforeTestMethod(DbUnitRunner.java:75)\n\tat com.github.springtestdbunit.DbUnitTestExecutionListener.beforeTestMethod(DbUnitTestExecutionListener.java:185)\n\tat org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:269)\n\tat org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)\n\tat org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)\n\tat org.springframework.test.context.junit4.statements.RunPrepareTestInstanceCallbacks.evaluate(RunPrepareTestInstanceCallbacks.java:64)\n\tat org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)\n\tat org.springframework.test.context.junit4.statements.SpringFailOnTimeout.evaluate(SpringFailOnTimeout.java:87)\n\tat org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:101)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor$1$1.evaluate(Theories.java:232)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithCompleteAssignment(Theories.java:218)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithAssignment(Theories.java:204)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithIncompleteAssignment(Theories.java:212)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.runWithAssignment(Theories.java:202)\n\tat org.junit.experimental.theories.Theories$TheoryAnchor.evaluate(Theories.java:187)\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\n\tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)\n\tat org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)\n\tat org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)\n\tat org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:101)\n\tat org.springframework.test.context.junit4.rules.SpringClassRule$TestContextManagerCacheEvictor.evaluate(SpringClassRule.java:242)\n\tat org.junit.rules.RunRules.evaluate(RunRules.java:20)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)\n<\/pre><\/div>\n\n\n<p>special_features\u30ab\u30e9\u30e0\u304c\u539f\u56e0\u3067\u5931\u6557\u3057\u3066\u3044\u307e\u3059\u3002<br>\u307e\u305f\u3001warn\u3067\u8a8d\u8b58\u3067\u304d\u306a\u3044\u578b\u3082\u3044\u304f\u3064\u304b\u8b66\u544a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 id=\"outline__3\" class=\"wp-block-heading\">\u539f\u56e0<\/h2>\n\n\n\n<p>dbUnit\u306e\u6a19\u6e96\u306epostgresql\u7528\u306e\u30c7\u30fc\u30bf\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u3067\u3042\u308b\u300corg.dbunit.ext.postgresql.PostgresqlDataTypeFactory\u300d\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u578b\u304c\u30c6\u30fc\u30d6\u30eb\u306b\u5b58\u5728\u3059\u308b\u305f\u3081\u3002<\/p>\n\n\n\n<h2 id=\"outline__4\" class=\"wp-block-heading\">\u89e3\u6c7a\u7b56<\/h2>\n\n\n\n<p> PostgresqlDataTypeFactory\u3092extends\u3057\u3066\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n\n\n\n<h3 id=\"outline__4_1\" class=\"wp-block-heading\">test-context.xml<\/h3>\n\n\n\n<p>\u307e\u305a\u3001 PostgresqlDataTypeFactory \u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;bean\n        id=&quot;dbUnitDatabaseConfig&quot;\n        class=&quot;com.github.springtestdbunit.bean.DatabaseConfigBean&quot;&gt;\n        &lt;property name=&quot;datatypeFactory&quot;&gt;\n            &lt;bean class=&quot;itouoti.spring.batch.testCommon.PsqlArrayDataTypeFactory&quot; \/&gt;\n        \n            &lt;!-- &lt;bean class=&quot;org.dbunit.ext.postgresql.PostgresqlDataTypeFactory&quot; \/&gt; --&gt;\n        &lt;\/property&gt;\n&lt;\/bean&gt;\n<\/pre><\/div>\n\n\n<h3 id=\"outline__4_2\" class=\"wp-block-heading\">PsqlArrayDataTypeFactory.java<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npublic class PsqlArrayDataTypeFactory extends PostgresqlDataTypeFactory {\n\n    public DataType createDataType(int sqlType,\n                                   String sqlTypeName,\n                                   String tableName,\n                                   String columnName) throws DataTypeException {\n\n        if (sqlType == 2003) {\n            if (sqlTypeName.equals(&quot;_text&quot;)) {\n                return new ArrayDataType(sqlTypeName, sqlType, false);\n            }\n        }\n\n        if (sqlType == 1111) {\n            if (sqlTypeName.equals(&quot;tsvector&quot;)) {\n                return new TsVectorDataType(sqlTypeName, sqlType);\n            }\n        }\n        \n        if (sqlType == 12) {\n            if (sqlTypeName.equals(&quot;mpaa_rating&quot;)) {\n                return new Mpaa_ratingDataType(sqlTypeName, sqlType);\n            }\n        }\n\n        return super.createDataType(sqlType, sqlTypeName);\n    }\n\n}\n<\/pre><\/div>\n\n\n<p>\u8b66\u544a\u304c\u51fa\u3066\u3044\u305fSQLType\u3068SQLName\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u6765\u305f\u6642\u306b\u5c02\u7528\u306e\u30af\u30e9\u30b9\u306b\u98db\u3070\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__4_3\" class=\"wp-block-heading\">ArrayDataType.java<\/h3>\n\n\n\n<p>\u53c2\u8003\u306eStackOverFlow\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h3 id=\"outline__4_4\" class=\"wp-block-heading\">TsVectorDataType.java<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage itouoti.spring.batch.testCommon.dataType;\n\nimport *;\n\npublic class TsVectorDataType extends AbstractDataType {\n\n    public TsVectorDataType(String name,\n                            int sqlType) {\n        super(&quot;tsvector&quot;, Types.OTHER, String.class, false);\n    }\n\n    public Object typeCast(Object value) throws TypeCastException  {\n        if (value == null) {\n            return null;\n        }\n\n        PGobject obj = new PGobject();\n        obj.setType(&quot;tsvector&quot;);\n        try {\n            obj.setValue(value.toString());\n        } catch (SQLException e) {\n            e.printStackTrace();\n        }\n        return obj;\n    }\n\n    public Object getSqlValue(int column,\n                              ResultSet resultSet) throws SQLException, TypeCastException {\n        return resultSet.getString(column);\n    }\n\n}\n<\/pre><\/div>\n\n\n<p>\u6587\u5b57\u5217\u3092\u7121\u7406\u3084\u308a\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<br>Mpaa_ratingDataType\u306b\u3064\u3044\u3066\u3082\u3084\u308a\u65b9\u306f\u540c\u3058\u306a\u306e\u3067\u8a73\u3057\u304f\u306fgithub\u30bd\u30fc\u30b9\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30c7\u30fc\u30bf\u306e\u30a8\u30af\u30bb\u30eb\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/06\/postgresqlRepository2-1024x158.png\" alt=\"\" class=\"wp-image-1018\" width=\"512\" height=\"79\"\/><\/figure>\n\n\n\n<h3 id=\"outline__4_5\" class=\"wp-block-heading\">\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/06\/postgresqlRepository1.png\" alt=\"\" class=\"wp-image-1017\" width=\"391\" height=\"168\"\/><\/figure>\n\n\n\n<p>\u6210\u529f\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 id=\"outline__5\" class=\"wp-block-heading\">\u30bd\u30fc\u30b9<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/itouoti12\/spring-batch\">https:\/\/github.com\/itouoti12\/spring-batch<\/a><\/p>\n\n\n\n<h2 id=\"outline__6\" class=\"wp-block-heading\">\u53c2\u8003<\/h2>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/36249849\/dbunit-support-for-postgresql-array\">dbUnit support for Postgresql Array<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>postgresql\u3092\u4f7f\u7528\u3057\u305fdbUnit\u30c6\u30b9\u30c8\u3092\u884c\u3063\u305f\u6642\u306b\u3001DBUnit\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306eDataFa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":93,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[16,229,233,149,232,230,231],"class_list":["post-689","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-error-bugs","tag-dbunit","tag-mpaa_rating","tag-repository","tag-spring-batch","tag-test","tag-tsvector","tag-_text"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=689"}],"version-history":[{"count":3,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/689\/revisions"}],"predecessor-version":[{"id":1228,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/689\/revisions\/1228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}