Skip to content

Commit

Permalink
Merge pull request #6 from erssebaggala/bump_to_v1.2.2
Browse files Browse the repository at this point in the history
Fix tests and bump version to v1.2.2
  • Loading branch information
erssebaggala authored Jul 14, 2019
2 parents c63fe79 + 74725f5 commit df5344c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 31 deletions.
Binary file modified dist/boda-ztexlscmparser.jar
Binary file not shown.
45 changes: 23 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bodastage.cm</groupId>
<artifactId>boda-ztexlscmparser</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.2.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -48,27 +48,28 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.bodastage.boda_ztexmlcmparser.ZTEXLSCMParser</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.bodastage.boda_ztexmlcmparser.ZTEXLSCMParser</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.bodastage.boda_ztexmlcmparser.ZTEXLSCMParser</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.bodastage.boda_ztexmlcmparser.ZTEXLSCMParser</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<name>boda-ztexlscmparser-pr</name>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ZTEXLSCMParser {
*
* Since 1.3.0
*/
final static String VERSION = "1.2.1";
final static String VERSION = "1.2.2";

private static final Logger LOGGER = LoggerFactory.getLogger(ZTEXLSCMParser.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.slf4j.LoggerFactory;

/**
*
* @author ADMIN
*/
public class ZTEXLSCMParserTest extends TestCase {

void testGeneralParsing(){
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ZTEXLSCMParser.class);

public void testGeneralParsing(){

ClassLoader classLoader = getClass().getClassLoader();
File inFile = new File(classLoader.getResource("tempaltedata.xlsx").getFile());
File inFile = new File(classLoader.getResource("templatedata.xlsx").getFile());
String inputFile = inFile.getAbsolutePath();

String outputFolder = System.getProperty("java.io.tmpdir");
Expand All @@ -39,24 +42,32 @@ void testGeneralParsing(){

String expectedResult [] = {
"FileName,varDateTime,NeType,TemplateType,TemplateVersion,DataType,SomeMO1Param1,SomeMO1Param2,SomeMO1Param3",
"templatedata.xlsx,2019-07-14 09:05:16,Multi-mode Controller,Plan,V0123,tech_radio,1,2,3",
"templatedata.xlsx,2019-07-14 09:05:16,Multi-mode Controller,Plan,V0123,tech_radio,4,5,6"
"templatedata.xlsx,YYYY-MM-DD HH:MI:SS,Multi-mode Controller,Plan,V0123,tech_radio,1,2,3",
"templatedata.xlsx,YYYY-MM-DD HH:MI:SS,Multi-mode Controller,Plan,V0123,tech_radio,4,5,6"
};

try{
String csvFile = outputFolder + File.separator + "vsDataSomeMO.csv";
String csvFile = outputFolder + File.separator + "SomeMO1.csv";

BufferedReader br = new BufferedReader(new FileReader(csvFile));
String csvResult [] = new String[2];
String csvResult [] = new String[3];

int i = 0;
String st;
while ((st = br.readLine()) != null) {
csvResult[i] = st;
//Repalce the date with YYYY-MM-DD HH:MI:SS as the parser generates
//as unique datetime whenever it runs
String c [] = st.split(",");
c[1] = "YYYY-MM-DD HH:MI:SS";

csvResult[i] = "";
for(int idx =0; idx < c.length; idx++){
if( idx > 0) csvResult[idx] += ",";
csvResult[i] += c[idx];
}
i++;
}


assertTrue(Arrays.equals(expectedResult, csvResult));

}catch(FileNotFoundException ex){
Expand Down

0 comments on commit df5344c

Please sign in to comment.