Skip to content

Commit

Permalink
test configuration for components (#286)
Browse files Browse the repository at this point in the history
* NED-Dandelion 3.2.0
add new properties for caching, token and apiLiveTesting
add costume exceptions
add RestTemplateWithCaching and CacheOfRestTemplateResponse
process method divided into several new methods
add tests for LiveAPI, MockedAPI and Caching

* NED-Dandelion 3.2.1
removing old test approaches

* NED-Dandelion 3.2.2
rename property for global usage

* NED-AGDISTIS 4.2.0
split the process method in seperate testeble methods for future testing
add RestTemplateWithCache for API call
add cache property
add cache test

* NED-Babelfy 3.2.0
split the process method in seperate testeble methods for future testing
add RestTemplateWithCache for API call
add cache property
add cache test
add live test
add mocked test

* NER-ComicCharacterNameSimpleNamedEntityRecognizer 3.2.0
split the process method in seperate testeble methods for future testing
add live test
add mocked test

* NER-Dandelion 3.2.0
split the process method in seperate testeble methods for future testing
add live test
add mocked test
add cache test

* qanary-component-NER-DBpediaSpotlight 3.2.0
add tests
update the fetcher, using now restTemplate
split the process method in smaller methods

* qanary-component-NER-DBpediaSpotlight 3.2.1
some bug fixes

* NER-MeaningCloud 3.2.0
add live tests
add mocked tests
add cache tests
split process method in separate methods
changed api call to restTemplate (with cache)
remove default template
bugfix in insert query

* NED-Dandelion 3.2.3
change api.key property
some code clean up
add new solution for cache test

* NED-Babelfy 3.2.1
update cache test

* NER-Dandelion 3.2.1
update cache test

* NER-MeaningCloud 3.2.1
update cache test

* NER-TextRazor 3.2.0
split process method in separate methods
add exceptions
add new properties
using RestTemplate for api calls
add tests

* NED-Babelfy 3.2.2

update property names

* NER-Dandelion 3.2.2

update property names

* NER-Tagme 3.2.0

split process method in smaller methods
add properties
add tests

* QB-BirthDataWikidata 3.3.0

add tests

* QB-ComicCharacterAlterEgoSimpleDBpedia 3.320

add tests

* QBE-SimpleQueryBuilderAndExecutor 3.2.0

add tests

* QB-ComicCharacterAlterEgoSimpleDBpedia 3.2.0

add tests

* QBE-SimpleQueryBuilderAndExecutor 3.2.0

add tests

* NED-AGDISTIS 4.2.1

split process method in separate methods
add tests

* fix of components MeaningCloud and Babelfy

* fixed configuration

* NER-MeaningCloud
3.2.2

disable question 3

---------

Co-authored-by: anbo-de <[email protected]>
Co-authored-by: Andreas Both <[email protected]>
  • Loading branch information
3 people authored Jul 25, 2023
1 parent 198135c commit ec1d12e
Show file tree
Hide file tree
Showing 141 changed files with 8,658 additions and 1,165 deletions.
7 changes: 2 additions & 5 deletions qanary-component-NED-AGDISTIS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>qanary-component-NED-AGDISTIS</artifactId>
<groupId>eu.wdaqua.qanary.component</groupId>
<version>4.1.4</version>
<version>4.2.1</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>17</java.version>
Expand Down Expand Up @@ -88,10 +89,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- https://github.com/spotify/dockerfile-maven -->
<!-- build Docker image: mvn dockerfile:build -->
<plugin>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package eu.wdaqua.qanary.component.agdistis.ned;

import eu.wdaqua.qanary.communications.CacheOfRestTemplateResponse;
import eu.wdaqua.qanary.communications.RestTemplateWithCaching;
import eu.wdaqua.qanary.component.QanaryComponent;
import eu.wdaqua.qanary.component.agdistis.ned.exception.ApiLiveTestFaildException;
import eu.wdaqua.qanary.component.agdistis.ned.exception.ApiUrlIsNullOrEmptyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -9,20 +14,39 @@

@SpringBootApplication
@ComponentScan(basePackages = {"eu.wdaqua.qanary"})
/**
* basic class for wrapping functionality to a Qanary component
* note: there is no need to change something here
*/
public class Application {
CacheOfRestTemplateResponse myCacheOfResponses;
RestTemplateWithCaching myRestTemplate;


@Bean
public QanaryComponent qanaryComponent(@Value("${spring.application.name}") final String applicationName) {
return new Agdistis(applicationName);
public Application(
@Autowired RestTemplateWithCaching myRestTemplate, //
@Autowired CacheOfRestTemplateResponse myCacheOfResponses //
) {
this.myRestTemplate = myRestTemplate;
this.myCacheOfResponses = myCacheOfResponses;
}

/**
* default main, can be removed later
* this method is needed to make the QanaryComponent in this project known
* to the QanaryServiceController in the qanary_component-template
*
* @return
*/
@Bean
public QanaryComponent qanaryComponent(
@Value("${spring.application.name}") final String applicationName, //
@Value("${agdistis.api.live.test.active}") final boolean apiLiveTestActive, //
@Value("${agdistis.api.url}") final String apiUrl //
) throws ApiUrlIsNullOrEmptyException, ApiLiveTestFaildException {
return new Agdistis(applicationName, myRestTemplate, myCacheOfResponses, apiLiveTestActive, apiUrl);
}


public static void main(String[] args) {
//Properties p = new Properties();
//new SpringApplicationBuilder(Application.class).properties(p).run(args);
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package eu.wdaqua.qanary.component.agdistis.ned.exception;

import java.io.Serial;
import java.security.PrivilegedActionException;

public class ApiLiveTestFaildException extends Exception {
@Serial
private static final long serialVersionUID = -1975683222057844503L;

/**
* Constructs a new exception with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public ApiLiveTestFaildException() {
}

/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public ApiLiveTestFaildException(String message) {
super(message);
}

/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ApiLiveTestFaildException(String message, Throwable cause) {
super(message, cause);
}

/**
* Constructs a new exception with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ApiLiveTestFaildException(Throwable cause) {
super(cause);
}

/**
* Constructs a new exception with the specified detail message,
* cause, suppression enabled or disabled, and writable stack
* trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
public ApiLiveTestFaildException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package eu.wdaqua.qanary.component.agdistis.ned.exception;

import java.io.Serial;
import java.security.PrivilegedActionException;

public class ApiUrlIsNullOrEmptyException extends Exception {
@Serial
private static final long serialVersionUID = 7428354571800821878L;

/**
* Constructs a new exception with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public ApiUrlIsNullOrEmptyException() {
}

/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public ApiUrlIsNullOrEmptyException(String message) {
super(message);
}

/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ApiUrlIsNullOrEmptyException(String message, Throwable cause) {
super(message, cause);
}

/**
* Constructs a new exception with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ApiUrlIsNullOrEmptyException(Throwable cause) {
super(cause);
}

/**
* Constructs a new exception with the specified detail message,
* cause, suppression enabled or disabled, and writable stack
* trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
public ApiUrlIsNullOrEmptyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
server.port=10002
spring.application.name=NED-AGDISTIS
spring.application.description=${spring.application.name} is a Qanary component

# Update the URL of the qanary pipeline
spring.boot.admin.url=http://localhost:8080
spring.boot.admin.client.url=${spring.boot.admin.url}

# the service url
#spring.boot.admin.client.service-base-url=http://0.0.0.0:${server.port}/
spring.boot.admin.client.instance.service-base-url=http://0.0.0.0:${server.port}/

# show colors in IDE console
spring.output.ansi.enabled=always

# define what additional (local) properties files should be used
spring.profiles.active=local

# log level definitions
# change logging level in production
logging.file=/var/log/application.log
logging.file.name=/var/log/application.log
logging.level.*=INFO
logging.level.org.springframework.core:WARN
logging.level.org.springframework.web:WARN
logging.level.org.springframework.beans:WARN
logging.level.org.springframework.boot:WARN
logging.level.org.apache.catalina.core:WARN
logging.level.org.springframework.jmx:WARN
logging.level.org.springframework.mock:WARN
logging.level.org.springframework.test:WARN
logging.level.eu.wdaqua.qanary:DEBUG
logging.level.org.springframework.core=WARN
logging.level.org.springframework.web=WARN
logging.level.org.springframework.beans=WARN
logging.level.org.springframework.boot=WARN
logging.level.org.apache.catalina.core=WARN
logging.level.org.springframework.jmx=WARN
logging.level.org.springframework.mock=WARN
logging.level.org.springframework.test=WARN
logging.level.eu.wdaqua.qanary=DEBUG

### SSL configuration
# the path to the key store that contains the SSL certificate, e.g., classpath:keystore.p12
server.ssl.key-store=
Expand All @@ -29,8 +39,10 @@ server.ssl.key-store-password=
server.ssl.key-store-type=
# toggle whether HTTP or HTTPS should be used (if SSL is set up)
server.ssl.enabled=false
# show colors in IDE console
spring.output.ansi.enabled=always

# agdistis service URL
agdistis.service.url=http://139.18.2.164:8080/AGDISTIS
#caching
qanary.webservicecalls.cache.specs=maximumSize=10000,expireAfterAccess=5s

# agdistis service
agdistis.api.live.test.active=true
agdistis.api.url=https://agdistis.demos.dice-research.org/api/en
Loading

0 comments on commit ec1d12e

Please sign in to comment.