Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Alignment API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
moex
Alignment API
Commits
f74f11d5
Commit
f74f11d5
authored
15 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
- Added classical tests of parseString
parent
f758625c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/src/IOTest.java
+48
-0
48 additions, 0 deletions
test/src/IOTest.java
with
48 additions
and
0 deletions
test/src/IOTest.java
+
48
−
0
View file @
f74f11d5
...
@@ -40,6 +40,9 @@ import java.io.PrintWriter;
...
@@ -40,6 +40,9 @@ import java.io.PrintWriter;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.File
;
import
java.io.BufferedInputStream
;
import
java.io.FileInputStream
;
/**
/**
* These tests corresponds to the tests presented in the examples/omwg directory
* These tests corresponds to the tests presented in the examples/omwg directory
...
@@ -74,4 +77,49 @@ public class IOTest {
...
@@ -74,4 +77,49 @@ public class IOTest {
assertEquals
(
alignment
.
getOntology2URI
().
toString
(),
"http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl"
);
assertEquals
(
alignment
.
getOntology2URI
().
toString
(),
"http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl"
);
assertEquals
(
alignment
.
nbCells
(),
57
);
assertEquals
(
alignment
.
nbCells
(),
57
);
}
}
private
static
String
readFileAsString
(
String
filePath
)
throws
java
.
io
.
IOException
{
byte
[]
buffer
=
new
byte
[(
int
)
new
File
(
filePath
).
length
()];
BufferedInputStream
f
=
new
BufferedInputStream
(
new
FileInputStream
(
filePath
));
f
.
read
(
buffer
);
return
new
String
(
buffer
);
}
/**
* The same tests as above (and elsewhere) using parseString instead of parse
*/
@Test
(
groups
=
{
"full"
,
"io"
,
"raw"
},
expectedExceptions
=
AlignmentException
.
class
)
public
void
loadSOAPStringErrorTest
()
throws
Exception
{
aparser
=
new
AlignmentParser
(
0
);
assertNotNull
(
aparser
);
try
{
// shut-up log4j
com
.
hp
.
hpl
.
jena
.
rdf
.
model
.
impl
.
RDFDefaultErrorHandler
.
silent
=
true
;
alignment
=
aparser
.
parseString
(
readFileAsString
(
"test/input/soap.xml"
)
);
// error (we forgot to tell the parser that the alignment is embedded)
}
catch
(
Exception
ex
)
{
com
.
hp
.
hpl
.
jena
.
rdf
.
model
.
impl
.
RDFDefaultErrorHandler
.
silent
=
false
;
throw
ex
;
}
}
@Test
(
groups
=
{
"full"
,
"io"
,
"raw"
},
dependsOnMethods
=
{
"loadSOAPStringErrorTest"
})
public
void
loadStringTest
()
throws
Exception
{
aparser
.
initAlignment
(
null
);
// a regular alignment, out of a SOAP message
alignment
=
aparser
.
parseString
(
readFileAsString
(
"examples/rdf/newsample.rdf"
)
);
assertNotNull
(
alignment
);
assertTrue
(
alignment
instanceof
URIAlignment
);
assertEquals
(
alignment
.
nbCells
(),
2
);
}
@Test
(
groups
=
{
"full"
,
"io"
,
"raw"
},
dependsOnMethods
=
{
"loadSOAPStringErrorTest"
})
public
void
loadSOAPStringTest
()
throws
Exception
{
aparser
.
initAlignment
(
null
);
aparser
.
setEmbedded
(
true
);
alignment
=
aparser
.
parseString
(
readFileAsString
(
"test/input/soap.xml"
)
);
assertNotNull
(
alignment
);
assertTrue
(
alignment
instanceof
URIAlignment
);
assertEquals
(
alignment
.
getOntology2URI
().
toString
(),
"http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl"
);
assertEquals
(
alignment
.
nbCells
(),
57
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment