Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dcat-catalog-proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
dcat-catalog-proxy
Commits
2890c8f5
Commit
2890c8f5
authored
2 years ago
by
Jesper Zedlitz
Browse files
Options
Downloads
Patches
Plain Diff
Test
parent
46abcd3f
No related branches found
No related tags found
1 merge request
!4
Resolve "dcat:mediaType korrigieren"
Pipeline
#399
failed
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/landsh/opendata/catalogproxy/CatalogFilterTest.java
+63
-51
63 additions, 51 deletions
...va/de/landsh/opendata/catalogproxy/CatalogFilterTest.java
with
63 additions
and
51 deletions
src/test/java/de/landsh/opendata/catalogproxy/CatalogFilterTest.java
+
63
−
51
View file @
2890c8f5
...
...
@@ -57,9 +57,9 @@ public class CatalogFilterTest {
@Test
public
void
work
()
throws
Exception
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/catalog.xml"
)
;
try
(
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/catalog.xml"
)
)
{
catalogFilter
.
work
(
inputStream
);
inputStream
.
close
();
}
}
@Test
...
...
@@ -145,13 +145,13 @@ public class CatalogFilterTest {
*/
@Test
public
void
work_will_preseve_collections
()
throws
Exception
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
;
try
(
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
)
{
final
Model
model
=
catalogFilter
.
work
(
inputStream
);
Assertions
.
assertEquals
(
8
,
countInstances
(
model
,
DCAT
.
Dataset
));
Assertions
.
assertEquals
(
7
,
countInstances
(
model
,
DCAT
.
Distribution
));
inputStream
.
close
();
}
}
/**
...
...
@@ -160,7 +160,7 @@ public class CatalogFilterTest {
*/
@Test
public
void
work_will_add_accessRights
()
throws
Exception
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
;
try
(
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
)
{
final
Model
model
=
catalogFilter
.
work
(
inputStream
);
// Every dataset has a dct:accessRights statement
...
...
@@ -175,8 +175,7 @@ public class CatalogFilterTest {
}
assertEquals
(
8
,
count
);
inputStream
.
close
();
}
}
/**
...
...
@@ -184,7 +183,7 @@ public class CatalogFilterTest {
*/
@Test
public
void
work_will_add_rights
()
throws
Exception
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
;
try
(
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/with_collection.xml"
)
)
{
final
Model
model
=
catalogFilter
.
work
(
inputStream
);
// Every dataset has a dct:accessRights statement
...
...
@@ -200,8 +199,7 @@ public class CatalogFilterTest {
}
assertEquals
(
7
,
count
);
inputStream
.
close
();
}
}
/**
...
...
@@ -211,7 +209,7 @@ public class CatalogFilterTest {
@Test
public
void
work_invalid_iri
()
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/invalid_iri.xml"
);
final
Model
model
=
catalogFilter
.
work
(
inputStream
);
catalogFilter
.
work
(
inputStream
);
}
/**
...
...
@@ -221,13 +219,12 @@ public class CatalogFilterTest {
public
void
work_will_remove_non_government_organization
()
throws
IOException
{
catalogFilter
.
unwantedPublishers
=
Collections
.
singletonList
(
"https://opendata.schleswig-holstein.de/organization/ee4df032-ec5f-4726-b7ad-a2c708fb53ec"
);
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/two-organizations.xml"
)
;
try
(
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/two-organizations.xml"
)
)
{
final
Model
model
=
catalogFilter
.
work
(
inputStream
);
Assertions
.
assertEquals
(
1
,
countInstances
(
model
,
DCAT
.
Dataset
));
Assertions
.
assertEquals
(
1
,
countInstances
(
model
,
DCAT
.
Distribution
));
inputStream
.
close
();
}
}
/**
...
...
@@ -235,9 +232,24 @@ public class CatalogFilterTest {
* catalog proxy must be able to cope with this.
*/
@Test
public
void
work_invalid_uri
()
{
final
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/invalid_uri.xml"
)
;
public
void
work_invalid_uri
()
throws
IOException
{
try
(
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/invalid_uri.xml"
)
)
{
catalogFilter
.
work
(
inputStream
);
}
}
@Test
@org
.
junit
.
jupiter
.
api
.
Disabled
public
void
repairMediaType
()
{
final
Model
model
=
parseRdf
(
getClass
().
getResourceAsStream
(
"/with_downloadURL.xml"
));
catalogFilter
.
rewriteDownloadAndAccessURLs
(
model
);
final
ResIterator
it
=
model
.
listSubjectsWithProperty
(
RDF
.
type
,
DCAT
.
Distribution
);
final
Resource
distribution
=
it
.
next
();
final
Resource
mediaType
=
distribution
.
getPropertyResourceValue
(
DCAT
.
mediaType
);
assertNotNull
(
mediaType
);
assertEquals
(
"https://www.iana.org/assignments/media-types/text/csv"
,
mediaType
.
getURI
());
}
}
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