modif sur les datas csv

This commit is contained in:
yann 2020-12-27 15:07:15 +01:00
parent ca6af9a406
commit 4c5c9cf2b3
3 changed files with 33 additions and 29 deletions

View file

@ -1,25 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_13"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_13">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-resource" /> <excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/target" /> </content>
</content> <orderEntry type="inheritedJdk" />
<orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0" level="project" /> <orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0" level="project" /> <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0" level="project" /> <orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" /> <orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.7.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.7.0" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" /> </component>
</component>
</module> </module>

View file

@ -8,19 +8,22 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
public class DataCsv { public class DataCsv {
protected String destination;
/** /**
* Le constructeur de DataCsv * Le constructeur de DataCsv
*/ */
public DataCsv(){ public DataCsv(){
this.destination = "src/test/resources/CsvFile";
} }
/** /**
* La methode de recuperation dun fichier csv * La methode de recuperation dun fichier csv
* @param fileZip : nom suivit du chemin du fichier zip
*/ */
public void getCsv(String fileZip) throws IOException{ public void getCsv(String fileZip) throws IOException{
//"src/main/resources/loto_201911.zip" File desDir = new File(destination);
File desDir = new File("src/main/resources/");
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip)); ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip));
ZipEntry zipEntry = zis.getNextEntry(); ZipEntry zipEntry = zis.getNextEntry();
@ -50,7 +53,9 @@ public class DataCsv {
} }
/** /**
* Methode d'extraction de fichier zip * Methode verifiant si l extraction a bien ete faite
* @param destinationDir : chemin de destination
* @param zipEntry : zip cible
*/ */
public File newFile(File destinationDir, ZipEntry zipEntry) throws IOException{ public File newFile(File destinationDir, ZipEntry zipEntry) throws IOException{
File destFile = new File(destinationDir, zipEntry.getName()); File destFile = new File(destinationDir, zipEntry.getName());

View file

@ -15,7 +15,7 @@ public class ImportData {
*/ */
ImportData(){ ImportData(){
this.url = "https://www.fdj.fr/jeux-de-tirage/loto/statistiques"; this.url = "https://www.fdj.fr/jeux-de-tirage/loto/statistiques";
this.repDes = "src/test/resources/"; this.repDes = "src/test/resources/Download/";
} }
/** /**