Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
2edbe1bf
Commit
2edbe1bf
authored
Jan 22, 2025
by
Riegel
Browse files
Build: Remove CityDoctorWebService module
parent
04387e46
Changes
85
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorWebService/src/test/java/de/hft/stuttgart/citydoctor2/webservice/endpoints/TestUtils.java
deleted
100644 → 0
View file @
04387e46
package
de.hft.stuttgart.citydoctor2.webservice.endpoints
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.ClientProtocolException
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONTokener
;
public
class
TestUtils
{
private
TestUtils
()
{
// only static use
}
public
static
LoginValues
login
(
HttpClient
client
)
throws
ClientProtocolException
,
IOException
{
HttpPost
post
=
new
HttpPost
(
"http://localhost:8080/CityDoctorWebService/rest/login"
);
List
<
NameValuePair
>
params
=
new
ArrayList
<>(
2
);
params
.
add
(
new
BasicNameValuePair
(
"username"
,
"Test"
));
params
.
add
(
new
BasicNameValuePair
(
"password"
,
"TestPassword"
));
post
.
setEntity
(
new
UrlEncodedFormEntity
(
params
,
"UTF-8"
));
HttpResponse
response
=
client
.
execute
(
post
);
String
text
=
readCompleteReponse
(
response
);
try
{
JSONTokener
tokener
=
new
JSONTokener
(
text
);
JSONObject
o
=
new
JSONObject
(
tokener
);
String
token
=
o
.
getString
(
"token"
);
int
id
=
o
.
getInt
(
"userId"
);
return
new
LoginValues
(
token
,
id
);
}
catch
(
JSONException
e
)
{
System
.
out
.
println
(
text
);
throw
e
;
}
}
public
static
String
readCompleteReponse
(
HttpResponse
response
)
throws
IOException
{
InputStreamReader
reader
=
new
InputStreamReader
(
response
.
getEntity
().
getContent
());
char
[]
buffer
=
new
char
[
1000
];
int
readChars
=
-
1
;
StringBuilder
sb
=
new
StringBuilder
();
while
((
readChars
=
reader
.
read
(
buffer
))
!=
-
1
)
{
sb
.
append
(
buffer
,
0
,
readChars
);
}
return
sb
.
toString
();
}
public
static
JSONTokener
tokenizeReponse
(
HttpResponse
response
)
throws
IOException
{
return
new
JSONTokener
(
readCompleteReponse
(
response
));
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/test/java/de/hft/stuttgart/citydoctor2/webservice/endpoints/ValidationEndpointTest.java
deleted
100644 → 0
View file @
04387e46
package
de.hft.stuttgart.citydoctor2.webservice.endpoints
;
import
static
org
.
junit
.
Assert
.*;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.StandardCopyOption
;
import
javax.ws.rs.core.HttpHeaders
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.ClientProtocolException
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.impl.client.HttpClients
;
import
org.junit.Test
;
public
class
ValidationEndpointTest
{
@Test
public
void
testRetrieveXmlReport
()
throws
ClientProtocolException
,
IOException
{
HttpClient
client
=
HttpClients
.
createMinimal
();
LoginValues
login
=
TestUtils
.
login
(
client
);
HttpGet
get
=
new
HttpGet
(
"http://localhost:8080/CityDoctorWebService/rest/models/validations/5/xml"
);
get
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Bearer "
+
login
.
getToken
());
HttpResponse
response
=
client
.
execute
(
get
);
File
file
=
new
File
(
"C:/WebService/test.xml"
);
Files
.
copy
(
response
.
getEntity
().
getContent
(),
file
.
toPath
(),
StandardCopyOption
.
REPLACE_EXISTING
);
assertTrue
(
file
.
exists
());
}
@Test
public
void
testRetrievePdfReport
()
throws
ClientProtocolException
,
IOException
{
HttpClient
client
=
HttpClients
.
createMinimal
();
LoginValues
login
=
TestUtils
.
login
(
client
);
HttpGet
get
=
new
HttpGet
(
"http://localhost:8080/CityDoctorWebService/rest/models/validations/5/pdf"
);
get
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Bearer "
+
login
.
getToken
());
HttpResponse
response
=
client
.
execute
(
get
);
File
file
=
new
File
(
"C:/WebService/test.pdf"
);
Files
.
copy
(
response
.
getEntity
().
getContent
(),
file
.
toPath
(),
StandardCopyOption
.
REPLACE_EXISTING
);
assertTrue
(
file
.
exists
());
}
}
CityDoctorParent/Extensions/CityDoctorWebService/src/test/resources/testConfig.yml
deleted
100644 → 0
View file @
04387e46
minVertexDistance
:
1.0E-4
useStreaming
:
false
xmlValidation
:
false
checks
:
C_GE_R_TOO_FEW_POINTS
:
enabled
:
true
C_GE_R_NOT_CLOSED
:
enabled
:
true
C_GE_R_DUPLICATE_POINT
:
enabled
:
true
C_GE_R_SELF_INTERSECTION
:
enabled
:
true
C_GE_S_MULTIPLE_CONNECTED_COMPONENTS
:
enabled
:
true
C_GE_P_INTERIOR_DISCONNECTED
:
enabled
:
true
C_GE_P_INTERSECTING_RINGS
:
enabled
:
true
C_GE_P_NON_PLANAR
:
enabled
:
false
parameters
:
# one of ("distance", "angle", "both")
type
:
distance
distanceTolerance
:
0.01
angleTolerance
:
0.1
C_GE_P_HOLE_OUTSIDE
:
enabled
:
true
C_GE_P_ORIENTATION_RINGS_SAME
:
enabled
:
true
C_GE_P_INNER_RINGS_NESTED
:
enabled
:
true
C_GE_S_TOO_FEW_POLYGONS
:
enabled
:
true
C_GE_S_NOT_CLOSED
:
enabled
:
true
C_GE_S_NON_MANIFOLD_EDGE
:
enabled
:
true
C_GE_S_POLYGON_WRONG_ORIENTATION
:
enabled
:
true
C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION
:
enabled
:
true
C_GE_S_NON_MANIFOLD_VERTEX
:
enabled
:
true
C_GE_S_SELF_INTERSECTION
:
enabled
:
true
\ No newline at end of file
CityDoctorParent/Extensions/README.md
View file @
2edbe1bf
...
...
@@ -112,24 +112,6 @@ Contact a Maintainer of this project for further information in this regard.
---
## CityDoctorWebService
Contains a web service implementation for CityDoctor2.
### Usage
> ⚠ This module has been abandoned. As of writing the module is still functional, but it may break at any time.
>Issues, bug reports and suggestions for this module will not be processed.
> ⚠ CityDoctorWebservice requires connection to a PostgreSQL Server. Connection parameters need to be set in the
pgpass.conf file found in the /DBScripts directory.
>
The PostgreSQL Server needs to contain a database called "CityDoctorDB" with a schema called "citydoctordb".
The required tables will be automatically created by the web service if they're missing.
To run the web service, build the module and
[
deploy CityDoctorWebService.war
](
https://tomcat.apache.org/tomcat-9.0-doc/deployer-howto.html
)
to a Tomcat server (version 8 or 9).
---
## License
...
...
CityDoctorParent/pom.xml
View file @
2edbe1bf
...
...
@@ -273,7 +273,6 @@
<module>
Extensions/CityDoctorHealer
</module>
<module>
Extensions/CityDoctorHealerGenetic
</module>
<module>
Extensions/CityDoctorHealerGUI
</module>
<module>
Extensions/CityDoctorWebService
</module>
</modules>
</project>
\ No newline at end of file
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment