develop #1
|
@ -1,4 +1,4 @@
|
|||
package metrics;
|
||||
package eu.dnetlib.repo.manager.integration.metrics;
|
||||
|
||||
import eu.dnetlib.repo.manager.controllers.PrometheusController;
|
||||
import eu.dnetlib.repo.manager.service.PiWikService;
|
|
@ -0,0 +1,58 @@
|
|||
package eu.dnetlib.repo.manager.integration.service;
|
||||
|
||||
import eu.dnetlib.repo.manager.domain.InterfaceComplianceRequest;
|
||||
import eu.dnetlib.repo.manager.domain.InterfaceComplianceRequestId;
|
||||
import eu.dnetlib.repo.manager.repository.InterfaceComplianceRequestsRepository;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest
|
||||
//@AutoConfigureTestDatabase
|
||||
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
||||
//@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
class InterfaceComplianceRequestTests {
|
||||
|
||||
@Autowired
|
||||
private InterfaceComplianceRequestsRepository repository;
|
||||
|
||||
@Test
|
||||
void getRequestById() {
|
||||
InterfaceComplianceRequest request = createRequest("3");
|
||||
repository.save(request);
|
||||
long total = repository.count();
|
||||
Assert.assertEquals(1, total);
|
||||
InterfaceComplianceRequest r = repository.findById(createRequestId()).orElse(null);
|
||||
Assert.assertNotNull(r);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void deleteRequestAfterTests() {
|
||||
repository.deleteById(createRequestId());
|
||||
}
|
||||
|
||||
private InterfaceComplianceRequestId createRequestId() {
|
||||
InterfaceComplianceRequestId id = new InterfaceComplianceRequestId();
|
||||
id.setRepositoryId("repository");
|
||||
id.setInterfaceId("interface");
|
||||
return id;
|
||||
}
|
||||
|
||||
private InterfaceComplianceRequest createRequest(String compatibilityLevel) {
|
||||
InterfaceComplianceRequest request = new InterfaceComplianceRequest();
|
||||
InterfaceComplianceRequestId id = createRequestId();
|
||||
request.setRepositoryId(id.getRepositoryId());
|
||||
request.setInterfaceId(id.getInterfaceId());
|
||||
request.setDesiredCompatibilityLevel(compatibilityLevel);
|
||||
request.setSubmissionDate(new Date());
|
||||
return request;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package eu.dnetlib.repo.manager.unit;
|
||||
|
||||
import eu.dnetlib.repo.manager.domain.InterfaceComplianceRequest;
|
||||
import eu.dnetlib.repo.manager.domain.dto.InterfaceComplianceRequestDTO;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
@SpringBootTest(classes = InterfaceComplianceRequest.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
class InterfaceComplianceRequestTest {
|
||||
|
||||
@Test
|
||||
void interfaceComplianceRequest_contains_date_test() {
|
||||
InterfaceComplianceRequest request = new InterfaceComplianceRequest();
|
||||
Assert.assertNotNull(request.getSubmissionDate());
|
||||
|
||||
InterfaceComplianceRequestDTO dto = new InterfaceComplianceRequestDTO();
|
||||
Assert.assertNull(dto.getSubmissionDate());
|
||||
|
||||
request = InterfaceComplianceRequest.from(dto);
|
||||
Assert.assertNotNull(request.getSubmissionDate());
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
|
||||
<context:annotation-config/>
|
||||
<context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/>
|
||||
|
||||
<bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
|
||||
id="propertyLoader">
|
||||
<property name="order" value="2"/>
|
||||
<property name="properties">
|
||||
<bean class="eu.dnetlib.conf.WebappContextProperyFactory">
|
||||
<property name="propertyFetcher">
|
||||
<bean class="eu.dnetlib.conf.PropertyFetcher"/>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="ignoreUnresolvablePlaceholders" value="true"/>
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath*:/gr/**/springContext-*.properties</value>
|
||||
<value>classpath*:/eu/**/springContext-*.properties</value>
|
||||
|
||||
<value>classpath*:/application.properties</value>
|
||||
<value>classpath*:email-texts.properties</value>
|
||||
|
||||
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-site-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-force-override.properties</value>-->
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
|
@ -0,0 +1,13 @@
|
|||
spring:
|
||||
datasource:
|
||||
url: jdbc:h2:mem:test
|
||||
driverClassName: org.h2.Driver
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
jpa:
|
||||
show-sql: true
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
main:
|
||||
banner-mode: console
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
|
||||
|
||||
<import resource="classpath*:/application-context.xml"/>
|
||||
|
||||
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
|
||||
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
|
||||
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
|
||||
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
|
||||
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
|
||||
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
|
||||
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
|
||||
|
||||
<!--<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>-->
|
||||
|
||||
|
||||
|
||||
|
||||
<bean id="maillib" class="eu.dnetlib.utils.MailLibrary" init-method="init">
|
||||
<property name="mailhost" value="${services.validator.mail.host}"/>
|
||||
<property name="smtpPort" value="${services.validator.mail.port}"/>
|
||||
<property name="authenticate" value="${services.validator.mail.authenticate}"/>
|
||||
<property name="username" value="${services.validator.mail.username}"/>
|
||||
<property name="password" value="${services.validator.mail.password}"/>
|
||||
<property name="from" value="${services.validator.mail.fromAddress}"/>
|
||||
<property name="replyTo" value="${services.validator.mail.replyToAddress}"/>
|
||||
<property name="mode" value="${services.validator.mail.mode}"/>
|
||||
<property name="debug" value="${services.validator.mail.debug}"/>
|
||||
</bean>
|
||||
|
||||
<bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
|
||||
id="propertyLoader">
|
||||
<property name="order" value="2"/>
|
||||
<property name="properties">
|
||||
<bean class="eu.dnetlib.conf.WebappContextProperyFactory">
|
||||
<property name="propertyFetcher">
|
||||
<bean class="eu.dnetlib.conf.PropertyFetcher"/>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="ignoreUnresolvablePlaceholders" value="true"/>
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath*:/gr/**/springContext-*.properties</value>
|
||||
<value>classpath*:/eu/**/springContext-*.properties</value>
|
||||
|
||||
<value>classpath*:/application.properties</value>
|
||||
<value>classpath*:/email-texts.properties</value>
|
||||
|
||||
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-site-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-override-new.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
|
||||
<!-- <value>classpath*:dnet-force-override.properties</value>-->
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
Loading…
Reference in New Issue