Skip to content

Commit

Permalink
Fix bug in handling child parameters (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala authored Apr 17, 2019
1 parent 925b75e commit aa55932
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 9 deletions.
Binary file modified dist/boda-bulkcmparser.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<groupId>com.bodastate.boda_bulkcmparser</groupId>
<artifactId>boda-bulkcmparser</artifactId>
<packaging>jar</packaging>
<version>2.0.5</version>
<name>boda-bulkcmparser</name>
<version>2.0.6</version>
<name>boda-bulkcmparser-pr</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BodaBulkCMParser {
*
* Since 1.3.0
*/
final static String VERSION = "2.0.5";
final static String VERSION = "2.0.6";


private static final Logger LOGGER = LoggerFactory.getLogger(BodaBulkCMParser.class);
Expand Down Expand Up @@ -845,6 +845,22 @@ public void startElementEvent(XMLEvent xmlEvent) {

//E1.2
if (null != vsDataType) {

//Handle parameters with children
//Update vsDataTypeStack and vsDataTypeRlStack
if(vsDataTypeRlStack.size() > 0){
String parentParameter = vsDataTypeRlStack.get(0).toString();
String childParameter = qName;
String param = parentParameter + "_" + childParameter;
if(!vsDataTypeStack.containsKey(param)){
vsDataTypeStack.put(param, null);
}
vsDataTypeRlStack.push(qName);

return;
}

//Handle parameters with no children
if (!vsDataTypeStack.containsKey(qName)) {
vsDataTypeStack.put(qName, null);
vsDataTypeRlStack.push(qName);
Expand Down Expand Up @@ -992,7 +1008,7 @@ public void endELementEvent(XMLEvent xmlEvent)
if (vsDataType != null && attrMarker == true) {//We are processing vsData<DataType> attributes
String newTag = qName;
String newValue = tagData;

//Handle attributes with children
if (parentChildParameters.containsKey(qName)) {//End of parent tag

Expand Down Expand Up @@ -1022,9 +1038,6 @@ public void endELementEvent(XMLEvent xmlEvent)
//Store the parent and it's child
parentChildParameters.put(parentTag, qName);

//Remove this tag from the tag stack.
vsDataTypeStack.remove(qName);

}

//Handle multivalued paramenters
Expand Down Expand Up @@ -1480,8 +1493,6 @@ private void collectVendorMOColumns(){
//If MO is not in the parameter list, then don't continue
if(parameterFile != null && !moColumns.containsKey(vsDataType)) return;



if (!moColumns.containsKey(vsDataType) ) {
moColumns.put(vsDataType, new Stack());
moColumnsParentIds.put(vsDataType, new Stack()); //Holds parent element IDs
Expand Down
57 changes: 57 additions & 0 deletions src/test/resources/bulkcm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<bulkCmConfigDataFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.615#configData" xmlns:en="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#eutranNrm" xmlns:un="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#utranNrm" xmlns:gn="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#gsmNrm" xmlns:xn="http://www.3gpp.org/ftp/specs/archive/32_series/32.625#genericNrm" xmlns:zs="http://ZTESpecificAttributes#ZTESpecificAttributes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/32_series/32.615#configData configData.xsd" xmlns:bs="http://www.bodastage.com">
<fileHeader fileFormatVersion="0.1.0" vendorName="Bodastage Solutions"/>
<configData>
<xn:SubNetwork id="BS_NRM_ROOT">
<xn:SubNetwork id="101">
<xn:attributes>
<xn:setOfMcc>999</xn:setOfMcc>
<xn:userLabel>usrLabel</xn:userLabel>
<xn:userDefinedNetworkType></xn:userDefinedNetworkType>
<xn:dnPrefix>www.bodastage.com</xn:dnPrefix>
</xn:attributes>
<xn:meContext id="4698">
<xn:attributes>
<xn:meContextId>4698</xn:meContextId>
<xn:dnPrefix>DC=www.bodastage.com</xn:dnPrefix>
</xn:attributes>
<xn:ManagedElement id="4698">
<xn:attributes>
<xn:locationName></xn:locationName>
<xn:userDefinedState>2</xn:userDefinedState>
<xn:vendorName>Bodastage Solutions</xn:vendorName>
<xn:swVersion>0.0.0</xn:swVersion>
<xn:managedElementType>SDR</xn:managedElementType>
<xn:userLabel>Some Element Name</xn:userLabel>
</xn:attributes>
<xn:vsDataContainer id="Q0001">
<xn:attributes>
<xn:vsDataType>vsDataEUtranCellFDD</xn:vsDataType>
<xn:vsDataFormatVersion>BodastageSpecificAttributes.0.0.0</xn:vsDataFormatVersion>
<bs:vsDataEUtranCellFDD>
<bs:userLabel>Q0001</bs:userLabel>
<bs:cellId>0001</bs:cellId>
<bs:tac>9</bs:tac>
<bs:userId></bs:userId>
<bs:pciConflictCell>
<bs:enbId>12345</bs:enbId>
<bs:cellId>9</bs:cellId>
<bs:mcc>0</bs:mcc>
<bs:mnc>00</bs:mnc>
</bs:pciConflictCell>
<bs:pciConflictCell>
<bs:enbId>12345</bs:enbId>
<bs:cellId>8</bs:cellId>
<bs:mcc>1</bs:mcc>
<bs:mnc>01</bs:mnc>
</bs:pciConflictCell>
</bs:vsDataEUtranCellFDD>
</xn:attributes>
</xn:vsDataContainer>
</xn:ManagedElement>
</xn:meContext>
</xn:SubNetwork>
</xn:SubNetwork>
</configData>
<fileFooter dateTime="2019-04-16T00:05:00+03:00"/>
</bulkCmConfigDataFile>
81 changes: 81 additions & 0 deletions src/test/resources/bulkcm2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<bulkCmConfigDataFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.615#configData" xmlns:en="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#eutranNrm" xmlns:un="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#utranNrm" xmlns:gn="http://www.3gpp.org/ftp/specs/archive/32_series/32.765#gsmNrm" xmlns:xn="http://www.3gpp.org/ftp/specs/archive/32_series/32.625#genericNrm" xmlns:zs="http://ZTESpecificAttributes#ZTESpecificAttributes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/32_series/32.615#configData configData.xsd" xmlns:bs="http://www.bodastage.com">
<fileHeader fileFormatVersion="0.1.0" vendorName="Bodastage Solutions"/>
<configData>
<xn:SubNetwork id="BS_NRM_ROOT">
<xn:SubNetwork id="101">
<xn:attributes>
<xn:setOfMcc>999</xn:setOfMcc>
<xn:userLabel>usrLabel</xn:userLabel>
<xn:userDefinedNetworkType></xn:userDefinedNetworkType>
<xn:dnPrefix>www.bodastage.com</xn:dnPrefix>
</xn:attributes>
<xn:meContext id="4698">
<xn:attributes>
<xn:meContextId>4698</xn:meContextId>
<xn:dnPrefix>DC=www.bodastage.com</xn:dnPrefix>
</xn:attributes>
<xn:ManagedElement id="4698">
<xn:attributes>
<xn:locationName></xn:locationName>
<xn:userDefinedState>2</xn:userDefinedState>
<xn:vendorName>Bodastage Solutions</xn:vendorName>
<xn:swVersion>0.0.0</xn:swVersion>
<xn:managedElementType>SDR</xn:managedElementType>
<xn:userLabel>Some Element Name</xn:userLabel>
</xn:attributes>
<xn:vsDataContainer id="Q0001">
<xn:attributes>
<xn:vsDataType>vsDataEUtranCellFDD</xn:vsDataType>
<xn:vsDataFormatVersion>BodastageSpecificAttributes.0.0.0</xn:vsDataFormatVersion>
<bs:vsDataEUtranCellFDD>
<bs:userLabel>Q0001</bs:userLabel>
<bs:cellId>1001</bs:cellId>
<bs:tac>9</bs:tac>
<bs:userId></bs:userId>
<bs:pciConflictCell>
<bs:enbId>12345</bs:enbId>
<bs:cellId>9</bs:cellId>
<bs:mcc>0</bs:mcc>
<bs:mnc>00</bs:mnc>
</bs:pciConflictCell>
<bs:pciConflictCell>
<bs:enbId>12345</bs:enbId>
<bs:cellId>8</bs:cellId>
<bs:mcc>1</bs:mcc>
<bs:mnc>01</bs:mnc>
</bs:pciConflictCell>
</bs:vsDataEUtranCellFDD>
</xn:attributes>
</xn:vsDataContainer>
<xn:vsDataContainer id="Q0002">
<xn:attributes>
<xn:vsDataType>vsDataEUtranCellFDD</xn:vsDataType>
<xn:vsDataFormatVersion>BodastageSpecificAttributes.0.0.0</xn:vsDataFormatVersion>
<bs:vsDataEUtranCellFDD>
<bs:userLabel>Q0002</bs:userLabel>
<bs:cellId>1002</bs:cellId>
<bs:tac>9</bs:tac>
<bs:userId></bs:userId>
<bs:pciConflictCell>
<bs:enbId>54321</bs:enbId>
<bs:cellId>2001</bs:cellId>
<bs:mcc>0</bs:mcc>
<bs:mnc>00</bs:mnc>
</bs:pciConflictCell>
<bs:pciConflictCell>
<bs:enbId>54321</bs:enbId>
<bs:cellId>8001</bs:cellId>
<bs:mcc>1</bs:mcc>
<bs:mnc>01</bs:mnc>
</bs:pciConflictCell>
</bs:vsDataEUtranCellFDD>
</xn:attributes>
</xn:vsDataContainer>
</xn:ManagedElement>
</xn:meContext>
</xn:SubNetwork>
</xn:SubNetwork>
</configData>
<fileFooter dateTime="2019-04-16T00:05:00+03:00"/>
</bulkCmConfigDataFile>

0 comments on commit aa55932

Please sign in to comment.