Commit ab64cfac authored by npedot's avatar npedot
Browse files

cleans print

parent 86a9e682
......@@ -83,7 +83,7 @@ class JdbcAdapter {
path, connectionProps)
conn.autoCommit = true
} else {
println("Connection from POOL ${datasource.connection?.id}")
// println("Connection from POOL ${datasource.connection?.id}")
var resource = datasource.getResource(datasource.connection?.id!!)
if (resource == null) {
val connectionProps = Properties()
......
......@@ -102,7 +102,7 @@ class Schema () {
}
if (constraints==null) constraints = ArrayList()
constraints?.add(copyconstr)
println("COPIED CONSTRAINT FROM $sourceTableName TO:"+constr.toString())
// println("COPIED CONSTRAINT FROM $sourceTableName TO:"+constr.toString())
}
this.constraints?.removeAll(constrToRemove)
}
......
......@@ -11,19 +11,19 @@ fun lostBCNFConstraints(attrs : Set<Column>, fds: Set<Constraint>): Set<Constrai
var resultConstraints = HashSet<Set<Constraint>>()
for (relation in result) {
println("columns")
println(relation.table.columns)
// println("columns")
// println(relation.table.columns)
//resultTables.add(relation.table.columns)
println("constr")
println(relation.constraints)
// println("constr")
// println(relation.constraints)
resultConstraints.add(relation.constraints)
println()
// println()
}
var lost = mutableSetOf<Constraint>()
for (constraint in fds) {
if (!resultConstraints.contains((setOf(constraint)))) {
println ( "Lost "+constraint.toString())
// println ( "Lost "+constraint.toString())
lost.add(constraint)
}
......
......@@ -70,7 +70,7 @@ private fun updateReferencedTables(schema: Schema, originTableName: String, orig
// println(schema.constraints)
// println(schema.constraintsByTable(rTableNewName))
// println(schema.keys(rTableNewName))
println("OID moveConstraintsFromColsToCol ${rTableNewName}:$rTableKeys to $rTableNewName:$sid")
// println("OID moveConstraintsFromColsToCol ${rTableNewName}:$rTableKeys to $rTableNewName:$sid")
schema.moveConstraintsFromColsToCol(rTableNewName, rTableKeys, sid)
schema.removeKeyConstraint(rTableNewName)
......
......@@ -80,7 +80,7 @@ class ChangeSet() {
}
infix fun plus(createConstraint: CreateConstraint)= apply{
println("plus $createConstraint")
// println("plus $createConstraint")
this.createConstraint.add(createConstraint)
}
......
......@@ -112,9 +112,9 @@ class ApplyChangeSetUseCase(val serializer: SerializerServiceI) {
}
fun createConstraint(db:Database, createConstraint: CreateConstraint): Database {
println("apply create constraint ${createConstraint}")
// println("apply create constraint ${createConstraint}")
db.schema.constraints().add(createConstraint)
println("apply constraint size ${db.schema.constraints().size}")
// println("apply constraint size ${db.schema.constraints().size}")
return db
}
......
......@@ -60,7 +60,7 @@ class XPathTransformUseCase {
val db = serializer.deserializeDatabase(dbXml)
val newdb = ApplyChangeSetUseCase(serializer).apply(db, changeSet)
println("-----------------------NEW-DB---------------")
// println("-----------------------NEW-DB---------------")
//println(serializer.prettyDatabase(newdb))
return newdb
}
......@@ -147,7 +147,7 @@ class XPathTransformUseCase {
return ChangeSet()
}
println("22++++++++++++++++++++++++++++++++++++++++++-------------------------------")
// println("22++++++++++++++++++++++++++++++++++++++++++-------------------------------")
val templConfig = Configuration(Configuration.VERSION_2_3_29)
val classTemplLoader = ClassTemplateLoader(XPathTransformUseCase::javaClass.javaClass, "/")
......@@ -175,13 +175,13 @@ class XPathTransformUseCase {
// }
templ.process(templModel, outWriter)
println("33++++++++++++++++++++++++++++++++++++++++++-------------------------------")
// println("33++++++++++++++++++++++++++++++++++++++++++-------------------------------")
val changeSetXml = outWriter.buffer.toString()
println(changeSetXml)
println("44++++++++++++++++++++++++++++++++++++++++++-------------------------------")
// println(changeSetXml)
// println("44++++++++++++++++++++++++++++++++++++++++++-------------------------------")
val serializer = XMLSerializerJacksonAdapter()
val changeSet = XMLSerializeUseCase(serializer).deserializeChangeSet(changeSetXml).ok ?: ChangeSet()
println("55++++++++++++++++++++++++++++++++++++++++++-------------------------------")
// println("55++++++++++++++++++++++++++++++++++++++++++-------------------------------")
return changeSet
}
......@@ -209,7 +209,7 @@ class XPathTransformUseCase {
// violation = checkCondition(pathTokens, templModel, name, violation, rule)
}
else {
println("getTemplateModel().xpath.compile(value)="+value)
// println("getTemplateModel().xpath.compile(value)="+value)
templModel[name] = asValueList(xpath.compile(value).evaluate(doc, XPathConstants.NODESET) as NodeList)
//println(" ${name} = ${value}")
//println(" ${name} = ${templModel[name]}")
......
......@@ -13,7 +13,7 @@ class SchemaTest {
val time = Column.of("Time")
val classroom = Column.of("Classroom")
val course = Column.of("Course")
val fd = Constraint.of("${time.name},${classroom.name}","${course.name}")
val fd = Constraint.of("${time.name},${classroom.name}", course.name)
assertEquals(" Time , Classroom , Course"," $time , $classroom , $course")
assertEquals(" :Time,Classroom --> :Course ; "," $fd")
......@@ -308,16 +308,16 @@ class SchemaTest {
// when
val result = decomposeTo3NF(attrs, fds)
// then
var resultTables = HashSet<List<Column>>()
var resultConstraints = HashSet<Set<Constraint>>()
val resultTables = HashSet<List<Column>>()
val resultConstraints = HashSet<Set<Constraint>>()
for (relation in result) {
println("columns")
println(relation.table.columns)
// println("columns")
// println(relation.table.columns)
resultTables.add(relation.table.columns)
println("constr")
println(relation.constraints)
// println("constr")
// println(relation.constraints)
resultConstraints.add(relation.constraints)
println()
// println()
}
assertTrue(resultConstraints.contains(Constraint.set("R , H --> C ; C , H --> R")))
assertTrue(resultConstraints.contains(Constraint.set("C , S --> G")))
......@@ -356,13 +356,13 @@ class SchemaTest {
var resultTables = HashSet<List<Column>>()
var resultConstraints = HashSet<Set<Constraint>>()
for (relation in result) {
println("columns")
println(relation.table.columns)
// println("columns")
// println(relation.table.columns)
resultTables.add(relation.table.columns)
println("constr")
println(relation.constraints)
// println("constr")
// println(relation.constraints)
resultConstraints.add(relation.constraints)
println()
// println()
}
assertTrue(resultConstraints.contains(Constraint.set("application --> provider")))
assertTrue(resultConstraints.contains(Constraint.set("name --> favAppl ; name --> location")))
......@@ -386,25 +386,25 @@ class SchemaTest {
val violations = checkBCNF(attrs, fds)
assertFalse(violations.isEmpty())
for (constraint in violations) {
println(constraint.toString())
// println(constraint.toString())
}
var resultConstraints = HashSet<Set<Constraint>>()
for (relation in result) {
println("columns")
println(relation.table.columns)
// println("columns")
// println(relation.table.columns)
//resultTables.add(relation.table.columns)
println("constr")
println(relation.constraints)
// println("constr")
// println(relation.constraints)
resultConstraints.add(relation.constraints)
println()
// println()
}
for (constraint in fds) {
if (!resultConstraints.contains((setOf(constraint)))) {
println ( "Lost "+constraint.toString())
}
}
// for (constraint in fds) {
// if (!resultConstraints.contains((setOf(constraint)))) {
// println ( "Lost "+constraint.toString())
// }
// }
}
......
......@@ -111,7 +111,6 @@ table8: DepName , DepAddress
val schema = Schema()
schema.addTable("Person:code,name,surname")
schema.addKey("Person:code")
println(schema.table("Person").toString())
// when
val changeset = oid(schema,"Person")
// then
......
......@@ -2,10 +2,10 @@ package unibz.cs.semint.kprime.support
import org.junit.Test
import org.w3c.dom.NodeList
import java.io.File
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.xpath.XPathConstants
import javax.xml.xpath.XPathFactory
import kotlin.test.assertEquals
class XPathTest {
......@@ -20,9 +20,9 @@ class XPathTest {
//when
val result = xpath.compile("changeSet").evaluate(doc, XPathConstants.NODESET) as NodeList
//then
println(result.length)
assertEquals(1,result.length)
val resultMessage= asValueList(result).joinToString(",")
println(resultMessage)
assertEquals("changeSet",resultMessage)
}
@Test
......@@ -35,16 +35,15 @@ class XPathTest {
//when
val result = xpath.compile("xml/changeSet").evaluate(doc, XPathConstants.NODESET) as NodeList
//then
println(result.length)
assertEquals(2,result.length)
val resultMessage= asValueList(result).joinToString(",")
println(resultMessage)
assertEquals("changeSet,changeSet",resultMessage)
}
private fun asValueList(xpathResultNodes: NodeList): MutableList<String> {
val listNodeValues = mutableListOf<String>()
for (nodeId in 0..xpathResultNodes.length) {
val item = xpathResultNodes.item(nodeId)
if (item==null) continue
val item = xpathResultNodes.item(nodeId) ?: continue
listNodeValues.add(item.nodeName)
if (item.nodeValue==null) continue
listNodeValues.add(item.nodeValue)
......
......@@ -27,7 +27,7 @@ view2==+ lhss rhss
val tranformerParmeters = mutableMapOf<String,Any>()
val computed = xtransf.compute(dbFilePath, templateFilePath, xPaths, tranformerParmeters)
// then
print(computed)
// print(computed)
}
@Test
......
......@@ -12,7 +12,7 @@ class UnSQLizeSelectUseCaseTest {
// when
val splitResult = case.splitOnKeyWords("SELECT * FROM people")
// then
splitResult.forEach{ println("'$it'") }
// splitResult.forEach{ println("'$it'") }
assertEquals(2, splitResult.size)
assertEquals("SELECT *", splitResult[0])
assertEquals("FROM people", splitResult[1])
......@@ -25,7 +25,7 @@ class UnSQLizeSelectUseCaseTest {
// when
val splitResult = case.splitOnKeyWords("SELECT a,b FROM people WHERE a<b")
// then
splitResult.forEach{ println("'$it'") }
// splitResult.forEach{ println("'$it'") }
assertEquals(3, splitResult.size)
assertEquals("SELECT a,b", splitResult[0])
assertEquals("FROM people", splitResult[1])
......@@ -39,7 +39,7 @@ class UnSQLizeSelectUseCaseTest {
// when
val splitResult = case.splitOnKeyWords("SELECT a,b FROM people WHERE a<b UNION SELECT c,d FROM jobs WHERE c<d ")
// then
splitResult.forEach{ println("'$it'") }
// splitResult.forEach{ println("'$it'") }
assertEquals(7, splitResult.size)
assertEquals("SELECT a,b", splitResult[0])
assertEquals("FROM people", splitResult[1])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment