Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pedot Nicola
semint-kprime
Commits
98ff19f0
Commit
98ff19f0
authored
Mar 20, 2021
by
npedot
Browse files
adds database test trans1
parent
31c7df72
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/unibz.cs.semint.kprime/domain/ddl/Column.kt
View file @
98ff19f0
...
...
@@ -10,11 +10,11 @@ class Column (): Labelled {
@JacksonXmlProperty
(
isAttribute
=
true
)
var
id
:
String
=
""
@JacksonXmlProperty
(
isAttribute
=
true
)
var
dbname
:
String
=
""
var
dbname
:
String
?
=
null
@JacksonXmlProperty
(
isAttribute
=
true
)
var
nullable
:
Boolean
=
false
@JacksonXmlProperty
(
isAttribute
=
true
)
var
dbtype
:
String
=
""
var
dbtype
:
String
?
=
""
@JacksonXmlProperty
(
isAttribute
=
true
)
var
type
:
String
?
=
null
@JacksonXmlProperty
(
isAttribute
=
true
)
...
...
@@ -32,9 +32,16 @@ class Column (): Labelled {
@JsonCreator
constructor
(
@JsonProperty
(
"name"
)
name
:
String
,
@JsonProperty
(
"id"
)
id
:
String
,
@JsonProperty
(
"dbname"
)
dbname
:
String
)
:
this
()
{
@JsonProperty
(
"name"
)
name
:
String
,
@JsonProperty
(
"id"
)
id
:
String
)
:
this
()
{
this
.
name
=
name
this
.
id
=
id
}
constructor
(
name
:
String
,
id
:
String
,
dbname
:
String
)
:
this
()
{
this
.
name
=
name
this
.
id
=
id
this
.
dbname
=
dbname
...
...
src/test/kotlin/unibz.cs.semint.kprime/domain/ddl/DatabaseTest.kt
0 → 100644
View file @
98ff19f0
package
unibz.cs.semint.kprime.domain.ddl
import
org.junit.Test
import
unibz.cs.semint.kprime.adapter.service.XMLSerializerJacksonAdapter
import
unibz.cs.semint.kprime.scenario.person.PersonTransfomerScenarioTI
import
kotlin.test.assertEquals
class
DatabaseTest
{
@Test
fun
test_parse_trans1_database
()
{
// given
val
dbXml
=
DatabaseTest
::
class
.
java
.
getResource
(
"/db/trans1/database.xml"
).
readText
()
// when
val
db
=
XMLSerializerJacksonAdapter
().
deserializeDatabase
(
dbXml
)
// then
assertEquals
(
""
,
db
.
id
)
}
}
\ No newline at end of file
src/test/resources/db/trans1/database.xml
0 → 100644
View file @
98ff19f0
<database
name=
""
id=
""
source=
""
>
<schema
name=
""
id=
""
>
<tables>
<table
id =
"1"
name =
"Employee"
condition =
""
view =
""
>
<columns>
<columns
id =
"rel1att0"
name =
" EmpID"
nullable =
"false"
/>
<columns
id =
"rel1att1"
name =
" EmpName"
nullable =
"false"
/>
<columns
id =
"rel1att2"
name =
" DepID"
nullable =
"false"
/>
<columns
id =
"rel1att3"
name =
" DepName"
nullable =
"false"
/>
</columns>
</table>
</tables>
<constraints>
<constraints
name =
"Employee.FUNCTIONAL1"
id =
"FUNCTIONAL1"
type =
"FUNCTIONAL"
>
<source
name =
""
id =
""
table =
"Employee"
>
<columns
>
<columns
id=
""
name =
"DepID"
/>
</columns>
</source>
<target
name=
""
id=
""
table=
"Employee"
>
<columns
>
<columns
id=
""
name =
"DepName"
/>
</columns>
</target>
</constraints>
</constraints>
</schema>
</database>
\ No newline at end of file
src/test/resources/db/trans1/dbpattern1.xml
0 → 100644
View file @
98ff19f0
<database
name=
""
id=
""
source=
""
>
<schema
name=
""
id=
""
>
<relationss>
<table
table_id =
"1"
table_name =
" R"
condidion =
""
view =
""
>
<columns
column_var =
"LHS"
>
</columns>
<columns
column_var =
"RHS"
>
</columns>
<columns
column_var =
"REST"
>
</columns>
</table>
</relations>
<constraints>
<constraint
constraint_name =
"R.FUNCTIONAL1"
constraint_id =
"FUNCTIONAL1"
constraint_type =
"FUNCTIONAL"
>
<source
source_name =
""
source_id =
""
source_table =
"R"
>
<columns
column_var =
"LHS"
>
</columns>
</source>
<target
target_name=
""
target_id=
""
target_table=
"R"
>
<columns
column_var =
"RHS"
>
</columns>
</target>
</constraint>
<constraint
constraint_name =
"R.CONS^k.1"
constraint_id =
"CONS1"
constraint_type =
"CONS"
>
<source
source_name =
""
source_id =
""
source_table =
"R"
>
<columns>
<columns
name=
"LHS^k"
id=
""
dbname=
""
nullable=
"false"
dbtype=
""
/>
<columns
name=
"RHS^k"
id=
""
dbname=
""
nullable=
"false"
dbtype=
""
/>
<columns
name=
"REST^k"
id=
""
dbname=
""
nullable=
"false"
dbtype=
""
/>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"LHS.IS_NOT1"
constraint_id =
"IS_NOT1"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"RHS.IS_NOT2"
constraint_id =
"IS_NOT2"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"REST.IS_NOT3"
constraint_id =
"IS_NOT3"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"LHS^k.SUBSET4"
constraint_id =
"SUBSET4"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"LHS"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"RHS^k.SUBSET5"
constraint_id =
"SUBSET5"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"RHS"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"REST^k.SUBSET6"
constraint_id =
"SUBSET6"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"REST"
>
</columns>
</source>
</constraint>
</constraints>
</schema>
</database>
\ No newline at end of file
src/test/resources/db/trans1/dbpattern2.xml
0 → 100644
View file @
98ff19f0
<database
name=
""
id=
""
source=
""
>
<schema
name=
""
id=
""
>
<relationss>
<table
table_id =
"1"
table_name =
" R1"
condidion =
""
view =
""
>
<columns
column_var =
"LHS"
>
</columns>
<columns
column_var =
"REST"
>
</columns>
</table>
<table
table_id =
"2"
table_name =
" R2"
condidion =
""
view =
""
>
<columns
column_var =
"LHS"
>
</columns>
<columns
column_var =
"RHS"
>
</columns>
</table>
</relations>
<constraints>
<constraint
constraint_name =
"R1-R2.INCLUSION_DEPENDENCY1"
constraint_id =
"INCLUSION_DEPENDENCY1"
constraint_type =
"INCLUSION_DEPENDENCY"
>
<source
source_name =
""
source_id =
""
source_table =
"R1"
>
<columns
column_var =
"LHS"
>
</columns>
</source>
<target
target_name=
""
target_id=
""
target_table=
"R2"
>
<columns
column_var =
"LHS"
>
</columns>
</target>
</constraint>
<constraint
constraint_name =
"R2.FUNCTIONAL1"
constraint_id =
"FUNCTIONAL1"
constraint_type =
"FUNCTIONAL"
>
<source
source_name =
""
source_id =
""
source_table =
"R2"
>
<columns
column_var =
"LHS"
>
</columns>
</source>
<target
target_name=
""
target_id=
""
target_table=
"R2"
>
<columns
column_var =
"RHS"
>
</columns>
</target>
</constraint>
<constraint
constraint_name =
"LHS.IS_NOT1"
constraint_id =
"IS_NOT1"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"RHS.IS_NOT2"
constraint_id =
"IS_NOT2"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"REST.IS_NOT3"
constraint_id =
"IS_NOT3"
constraint_type =
"IS_NOT"
>
<source
source_name =
""
source_id =
""
>
<columns
column_nullable =
"false"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"LHS^k.SUBSET4"
constraint_id =
"SUBSET4"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"LHS"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"RHS^k.SUBSET5"
constraint_id =
"SUBSET5"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"RHS"
>
</columns>
</source>
</constraint>
<constraint
constraint_name =
"REST^k.SUBSET6"
constraint_id =
"SUBSET6"
constraint_type =
"SUBSET"
>
<source
source_name =
""
source_id =
""
>
<columns
column_var =
"REST"
>
</columns>
</source>
</constraint>
</constraints>
</schema>
</database>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment