Skip to content

Commit

Permalink
Small text corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavarzi committed Dec 24, 2013
1 parent 1a25e2c commit e5cb758
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
Expand Up @@ -22,10 +22,10 @@ class ElementsDiffGenerator extends ListDiffGenerator{

def generator

def removed = { new Difference(description:"${labelElement} ${it.name ?: 'ref to ' + it.refValue} with minoccurs ${it?.minOccurs} ${labelRemoved}." ,
def removed = { new Difference(description:"${labelElement} ${it.name ?: 'ref to ' + it.refValue} with minOccurs ${it?.minOccurs} ${labelRemoved}." ,
type : 'element', breaks:ctx.exchange ? true: null, exchange: it.exchange) }

def added = { new Difference(description:"${labelElement} ${it.name ?: 'ref to ' + it.refValue} with minoccurs ${it?.minOccurs} ${labelAdded}.",
def added = { new Difference(description:"${labelElement} ${it.name ?: 'ref to ' + it.refValue} with minOccurs ${it?.minOccurs} ${labelAdded}.",
type : 'element', breaks:ctx.exchange ? true: null, exchange: it.exchange)}


Expand Down
Expand Up @@ -53,7 +53,7 @@ class SequenceDiffGenerator extends UnitDiffGenerator {
def warning = (aP.minOccurs == '0' && ctx.exchange == 'request')
def breaks = ctx.exchange ? (aP.minOccurs > '0') as boolean : null
String endOfSeq = (a.particles.size() == (i+1))? '(end of sequence)' : ''
diffs << new Difference(description:"${labelElement} ${aP.name ?: 'ref to ' + aP.refValue} with minoccurs ${aP?.minOccurs} ${labelRemoved} from position ${i+1}${endOfSeq}.",
diffs << new Difference(description:"${labelElement} ${aP.name ?: 'ref to ' + aP.refValue} with minOccurs ${aP?.minOccurs} ${labelRemoved} from position ${i+1}${endOfSeq}.",
type: 'sequence', warning: warning, breaks: breaks, exchange: a.exchange)
return
}
Expand Down Expand Up @@ -93,7 +93,7 @@ class SequenceDiffGenerator extends UnitDiffGenerator {
} //element not found (removed) or bP is not an element
def warning = (aP.minOccurs == '0' && a.exchange == 'request')
def breaks = (ctx.exchange? aP.minOccurs > '0': null)
diffs << new Difference(description:"${labelElement} ${aP.name?: 'ref to ' + aP.refValue} with minoccurs ${aP?.minOccurs} ${labelRemoved}." ,
diffs << new Difference(description:"${labelElement} ${aP.name?: 'ref to ' + aP.refValue} with minOccurs ${aP?.minOccurs} ${labelRemoved}." ,
type: 'sequence', warning: warning, breaks: breaks, exchange: a.exchange)
return
} //aP is NOT an element
Expand Down Expand Up @@ -134,7 +134,7 @@ class SequenceDiffGenerator extends UnitDiffGenerator {
def i = b.particles.findIndexOf{it == bP}
String endOfSeq = (b.particles.size() == (i+1))? '(end of sequence)' : ''
if(bP instanceof Element) {
diffs << new Difference(description:"${labelElement} ${bP.name?: 'ref to ' + bP.refValue} with minoccurs ${bP?.minOccurs} ${labelAdded} to position ${i+1}${endOfSeq}.",
diffs << new Difference(description:"${labelElement} ${bP.name?: 'ref to ' + bP.refValue} with minOccurs ${bP?.minOccurs} ${labelAdded} to position ${i+1}${endOfSeq}.",
type: 'sequence', warning: warning, breaks: breaks, exchange: b.exchange)
} else {
diffs << new Difference(description:"${bP.elementName} ${labelAdded} to position ${i+1}${endOfSeq}." ,
Expand Down
Expand Up @@ -43,7 +43,7 @@
tr.appendChild(td1);
td1.appendChild(span);
tbody.appendChild(tr);
var maxOccurs = tbody.attributes['maxoccurs']? tbody.attributes['maxoccurs'].value : 1;
var maxOccurs = tbody.attributes['maxOccurs']? tbody.attributes['maxOccurs'].value : 1;
var inputCount = tbody.getElementsByTagName("tr").length;
if(maxOccurs=='unbounded') return;
var left = maxOccurs - inputCount;
Expand Down
Expand Up @@ -78,10 +78,10 @@ class ChoiceDiffGeneratorTest extends GroovyTestCase{
void testElementRef(){
def diffGen = new ChoiceDiffGenerator(a: f , b: g, generator : new SchemaDiffGenerator())
def diffs = diffGen.compare()
assert diffs[0].diffs[0].description == 'Element ref to TEST1 with minoccurs 1 removed.'
assert diffs[0].diffs[1].description == 'Element ref to TEST2 with minoccurs 1 removed.'
assert diffs[0].diffs[2].description == 'Element ref to TEST4 with minoccurs 1 added.'
assert diffs[0].diffs[3].description == 'Element ref to TEST5 with minoccurs 1 added.'
assert diffs[0].diffs[0].description == 'Element ref to TEST1 with minOccurs 1 removed.'
assert diffs[0].diffs[1].description == 'Element ref to TEST2 with minOccurs 1 removed.'
assert diffs[0].diffs[2].description == 'Element ref to TEST4 with minOccurs 1 added.'
assert diffs[0].diffs[3].description == 'Element ref to TEST5 with minOccurs 1 added.'
}

}
Expand Up @@ -30,27 +30,27 @@ class ElementRefDiffTest extends GroovyTestCase {

void testRootElementsAdded() {
def diffs = compare(schemaWithName, schemaWithRef)
assert diffs[0].description == 'Element bar with minoccurs 1 removed.'
assert diffs[0].description == 'Element bar with minOccurs 1 removed.'
}

void testRootElementsReplaced() {
def diffs = compare(schemaWithRef, schemaWithName)
assert diffs[0].description == 'Element foo with minoccurs 1 removed.'
assert diffs[0].description == 'Element foo with minOccurs 1 removed.'
}

void testSequnceDiff() {
def diffs = compare(schemaWithRef, schemaWithName)
assert diffs[7].description == 'ComplexType CT4:'
assert diffs[7].diffs[0].type == 'sequence'
assert diffs[7].diffs[0].diffs[0].description == 'Element E1 with minoccurs 1 removed.'
assert diffs[7].diffs[0].diffs[1].description == 'Element E2 with minoccurs 1 removed.'
assert diffs[7].diffs[0].diffs[0].description == 'Element E1 with minOccurs 1 removed.'
assert diffs[7].diffs[0].diffs[1].description == 'Element E2 with minOccurs 1 removed.'
assert diffs[7].diffs[0].diffs[2].description == 'Position of element E3 changed from 3 to 2.'
assert diffs[7].diffs[0].diffs[3].description == 'Position of element E4 changed from 4 to 3.'
assert diffs[7].diffs[0].diffs[4].description == 'Element ref to tns:foo with minoccurs 1 removed.'
assert diffs[7].diffs[0].diffs[4].description == 'Element ref to tns:foo with minOccurs 1 removed.'
assert diffs[7].diffs[0].diffs[5].description == 'Particle choice on position 6 replaced with any.'
assert diffs[7].diffs[0].diffs[6].description == 'Element E5 with minoccurs 1 added to position 1.'
assert diffs[7].diffs[0].diffs[7].description == 'Element E6 with minoccurs 1 added to position 4.'
assert diffs[7].diffs[0].diffs[8].description == 'Element ref to tns:bar with minoccurs 1 added to position 5.'
assert diffs[7].diffs[0].diffs[6].description == 'Element E5 with minOccurs 1 added to position 1.'
assert diffs[7].diffs[0].diffs[7].description == 'Element E6 with minOccurs 1 added to position 4.'
assert diffs[7].diffs[0].diffs[8].description == 'Element ref to tns:bar with minOccurs 1 added to position 5.'
assert diffs[7].diffs[0].diffs[9].description == 'any added to position 7(end of sequence).'
}

Expand Down
Expand Up @@ -28,12 +28,12 @@ class CompatibilityInDiffGeneratorTest extends GroovyTestCase {
void testElementAdded2Req() {
def diffs = compare(wsdl1, wsdl2)
assert diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[0].description ==
"Element ElementWithMinOcc1 with minoccurs 1 removed."
"Element ElementWithMinOcc1 with minOccurs 1 removed."
assert !diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[0].safe
assert !diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[0].warning
assert diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[0].breaks
assert diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[1].description ==
"Element test with minoccurs 0 added to position 5(end of sequence)."
"Element test with minOccurs 0 added to position 5(end of sequence)."
assert !diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[1].safe
assert diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[1].warning
assert !diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[0].diffs[1].diffs[0].diffs[1].breaks
Expand Down
Expand Up @@ -28,10 +28,10 @@ class ReqResAwareDiffGeneratorTest extends GroovyTestCase {
void testSchemaDiffsInDefinitions() {
def diffs = compare(oldWSDL, newWSDL)
//Definitions -> Types -> Schema -> CType -> Seq -> Element
assert diffs[0].diffs[1].diffs[0].diffs[0].diffs[0].diffs[0].description == 'Element newElementRequest with minoccurs 0 added to position 3(end of sequence).'
assert diffs[0].diffs[1].diffs[0].diffs[0].diffs[0].diffs[0].description == 'Element newElementRequest with minOccurs 0 added to position 3(end of sequence).'
assert !diffs[0].diffs[1].diffs[0].diffs[0].diffs[0].diffs[0].safe()
assert !diffs[0].diffs[1].diffs[0].diffs[0].diffs[0].diffs[0].breaks()
assert diffs[0].diffs[1].diffs[0].diffs[1].diffs[0].diffs[1].description == 'Element newElementResponse with minoccurs 0 added to position 3(end of sequence).'
assert diffs[0].diffs[1].diffs[0].diffs[1].diffs[0].diffs[1].description == 'Element newElementResponse with minOccurs 0 added to position 3(end of sequence).'
assert !diffs[0].diffs[1].diffs[0].diffs[1].diffs[0].diffs[1].safe()
assert !diffs[0].diffs[1].diffs[0].diffs[1].diffs[0].diffs[1].breaks()
}
Expand Down

0 comments on commit e5cb758

Please sign in to comment.