Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 3b9036ac by Tony CHEMIT at 2018-01-28T02:58:19+01:00 add more test on templates - - - - - 3 changed files: - client/src/test/java/fr/ird/observe/ui/text/ObserveTextTemplateTest.java → client/src/test/java/fr/ird/observe/ui/text/ClientTextTemplatesTest.java - + client/src/test/java/fr/ird/observe/ui/text/UiDataSourceTextTemplatesTest.java - + client/src/test/java/fr/ird/observe/ui/text/UiMainTextTemplatesTest.java Changes: ===================================== client/src/test/java/fr/ird/observe/ui/text/ObserveTextTemplateTest.java → client/src/test/java/fr/ird/observe/ui/text/ClientTextTemplatesTest.java ===================================== --- a/client/src/test/java/fr/ird/observe/ui/text/ObserveTextTemplateTest.java +++ b/client/src/test/java/fr/ird/observe/ui/text/ClientTextTemplatesTest.java @@ -23,9 +23,6 @@ package fr.ird.observe.ui.text; */ import com.google.common.collect.ImmutableSet; -import fr.ird.observe.ui.main.ObserveTestSupport; -import fr.ird.observe.ui.main.ObserveMainUIApplicationContext; -import fr.ird.observe.ui.admin.validate.ValidateModel; import fr.ird.observe.services.ds.ClientDataSource; import fr.ird.observe.services.service.actions.validate.DataValidationRequest; import fr.ird.observe.services.service.actions.validate.ValidateService; @@ -33,6 +30,9 @@ import fr.ird.observe.services.service.actions.validate.ValidationResult; import fr.ird.observe.services.test.DatabaseName; import fr.ird.observe.services.test.spi.DatabaseNameConfiguration; import fr.ird.observe.test.ObserveFixtures; +import fr.ird.observe.ui.admin.validate.ValidateModel; +import fr.ird.observe.ui.main.ObserveMainUIApplicationContext; +import fr.ird.observe.ui.main.ObserveTestSupport; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; @@ -44,13 +44,13 @@ import org.nuiton.validator.NuitonValidatorScope; * * @author Tony Chemit - dev@tchemit.fr */ -public class ObserveTextTemplateTest extends ObserveTestSupport { +@DatabaseNameConfiguration(DatabaseName.dataForTestSeine) +public class ClientTextTemplatesTest extends ObserveTestSupport { - private static final Log log = LogFactory.getLog(ObserveTextTemplateTest.class); + private static final Log log = LogFactory.getLog(ClientTextTemplatesTest.class); - @DatabaseNameConfiguration(DatabaseName.dataForTestSeine) @Test - public void getValidationReport() { + public void applyValidateReportTemplate() { ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); ===================================== client/src/test/java/fr/ird/observe/ui/text/UiDataSourceTextTemplatesTest.java ===================================== --- /dev/null +++ b/client/src/test/java/fr/ird/observe/ui/text/UiDataSourceTextTemplatesTest.java @@ -0,0 +1,129 @@ +package fr.ird.observe.ui.text; + +/*- + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.ObserveUtil; +import fr.ird.observe.services.configuration.ObserveDataSourceConfiguration; +import fr.ird.observe.services.configuration.ObserveDataSourceInformation; +import fr.ird.observe.services.ds.ClientDataSource; +import fr.ird.observe.services.test.DatabaseName; +import fr.ird.observe.services.test.spi.DatabaseNameConfiguration; +import fr.ird.observe.ui.ds.ClientDataSourcesManager; +import fr.ird.observe.ui.ds.manager.StorageUIModel; +import fr.ird.observe.ui.main.ObserveMainUIApplicationContext; +import fr.ird.observe.ui.main.ObserveTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +import java.util.Locale; + +/** + * Created by tchemit on 28/01/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +@DatabaseNameConfiguration(DatabaseName.dataForTestSeine) +public class UiDataSourceTextTemplatesTest extends ObserveTestSupport { + private static final Log log = LogFactory.getLog(UiDataSourceTextTemplatesTest.class); + + + @Test + public void applyDataSourceInformationTemplate() { + ClientDataSource model = getMethodRule().getDataSource(); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourceInformationTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + @Ignore + public void applyInitStorageTemplate() { + ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); + ClientDataSourcesManager.InitStorageModel model = null; + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyInitStorageTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + public void applyDataSourceConnexionReportTemplate() { + ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); + StorageUIModel model = new StorageUIModel(applicationContext); + model.init(applicationContext, getMethodRule().getDataSource().getConfiguration()); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourceConnexionReportTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + public void applyDataSourcePolicyTemplate() { + ObserveDataSourceInformation model = getMethodRule().getDataSource().getInformation(); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourcePolicyTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + public void applyDataSourceLoadSummaryTemplate() { + ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); + StorageUIModel model = new StorageUIModel(applicationContext); + model.init(applicationContext, getMethodRule().getDataSource().getConfiguration()); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourceLoadSummaryTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + public void applyDataSourceConfigurationTemplate() { + ObserveDataSourceConfiguration model = getMethodRule().getDataSource().getConfiguration(); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourceConfigurationTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } + + @Test + public void applyDataSourceConnexionResultTemplate() { + ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); + StorageUIModel model = new StorageUIModel(applicationContext); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiDataSourceTextTemplates.applyDataSourceConnexionResultTemplate(model, locale); + log.info(content); + Assert.assertNotNull(content); + } + } +} ===================================== client/src/test/java/fr/ird/observe/ui/text/UiMainTextTemplatesTest.java ===================================== --- /dev/null +++ b/client/src/test/java/fr/ird/observe/ui/text/UiMainTextTemplatesTest.java @@ -0,0 +1,57 @@ +package fr.ird.observe.ui.text; + +/*- + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.ObserveUtil; +import fr.ird.observe.services.test.DatabaseName; +import fr.ird.observe.services.test.spi.DatabaseNameConfiguration; +import fr.ird.observe.ui.main.ObserveMainUIApplicationContext; +import fr.ird.observe.ui.main.ObserveTestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Locale; + +/** + * Created by tchemit on 28/01/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +@DatabaseNameConfiguration(DatabaseName.dataForTestSeine) +public class UiMainTextTemplatesTest extends ObserveTestSupport { + + private static final Log log = LogFactory.getLog(UiMainTextTemplatesTest.class); + + @Test + public void applyAboutTemplate() { + ObserveMainUIApplicationContext applicationContext = getClassRule().getApplicationContext(); + for (Locale locale : ObserveUtil.LOCALES) { + String content = UiMainTextTemplates.applyAboutTemplate(applicationContext.getConfig(), locale); + log.info(content); + Assert.assertNotNull(content); + } + } + +} View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3b9036ac4a45067e4c35bd552728... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3b9036ac4a45067e4c35bd552728... You're receiving this email because of your account on gitlab.com.