Commit 26321659 authored by Christos Tranoris's avatar Christos Tranoris
Browse files

mock fixes

parent b1290c30
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -435,6 +435,8 @@
                	<runOrder>alphabetical</runOrder>
                	<forkCount>1</forkCount>
                	<reuseForks>true</reuseForks>
                	<!-- Memory settings -->
                	<argLine>@{argLine} -Xmx2048m -Xms512m -XX:MaxMetaspaceSize=512m</argLine>
            	</configuration>
			</plugin>
			<plugin>
+14 −2
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@ spring:
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
    password: sa
    username: sa
    hikari:
      maximum-pool-size: 5  # Reduce from default
      minimum-idle: 1
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    hibernate:
@@ -21,6 +24,15 @@ spring:
      hibernate:
        globally_quoted_identifiers: true
        globally_quoted_identifiers_skip_column_definitions: true
        # Memory optimizations for tests
        jdbc.batch_size: 20
        order_inserts: true
        order_updates: true
        cache.use_second_level_cache: false
        cache.use_query_cache: false
        jdbc.fetch_size: 50
        # Reduce connection pool overhead
        connection.provider_disables_autocommit: true
    show-sql: false
    generate-ddl: true
    
@@ -37,7 +49,7 @@ spring:
        expiry-timeout: 0
        idle-timeout: 30000
        max-connections: 1
        maximum-active-session-per-connection: 500
        maximum-active-session-per-connection: 100  # Reduced from 500
        reconnect-on-exception: true
        time-between-expiration-check: -1
        use-anonymous-producers: true
+19 −7
Original line number Diff line number Diff line
@@ -26,9 +26,12 @@ import org.etsi.osl.tmf.am642.model.Comment;
import org.etsi.osl.tmf.am642.model.PerceivedSeverityType;
import org.etsi.osl.tmf.am642.model.ProbableCauseType;
import org.etsi.osl.tmf.am642.reposervices.AlarmRepoService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
@@ -42,8 +45,7 @@ public class AlarmManagementIntegrationTest extends BaseIT {

	private static final transient Log logger = LogFactory.getLog(AlarmManagementIntegrationTest.class.getName());

	@Autowired
	private MockMvc mvc;
	private static MockMvc mvc;

	@Autowired
	AlarmRepoService alarmRepoService;
@@ -64,11 +66,21 @@ public class AlarmManagementIntegrationTest extends BaseIT {
	@Value("${ALARMS_GET_ALARM}")
	private String ALARMS_GET_ALARM ="";

	@BeforeEach
	@PersistenceContext
	private EntityManager entityManager;

	@BeforeAll
	public void setup() {
		mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
	}

	@AfterEach
	public void tearDown() {
		if (entityManager != null) {
			entityManager.clear();
		}
	}

	@WithMockUser(username = "osadmin", roles = { "ADMIN", "USER" })
	@Test
	public void testAlarmCreateAndUpdate() throws UnsupportedEncodingException, IOException, Exception {
+20 −8
Original line number Diff line number Diff line
@@ -17,7 +17,10 @@ import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
import org.etsi.osl.tmf.lcm.model.LCMRuleSpecificationCreate;
import org.etsi.osl.tmf.lcm.model.LCMRuleSpecificationUpdate;
import org.etsi.osl.tmf.lcm.reposervices.LCMRuleSpecificationRepoService;
import org.junit.jupiter.api.BeforeEach;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@@ -33,8 +36,7 @@ public class LCMRulesIntegrationTest extends BaseIT {
	private static final transient Log logger = LogFactory.getLog( LCMRulesIntegrationTest.class.getName());


    @Autowired
    private MockMvc mvc;
    private static MockMvc mvc;

    @Autowired
    private WebApplicationContext context;
@@ -43,7 +45,10 @@ public class LCMRulesIntegrationTest extends BaseIT {
	@Autowired
	LCMRuleSpecificationRepoService lcmRuleSpecificationRepoService;

	@BeforeEach
	@PersistenceContext
	private EntityManager entityManager;

	@BeforeAll
    public void setup() {
        mvc = MockMvcBuilders
          .webAppContextSetup(context)
@@ -51,6 +56,13 @@ public class LCMRulesIntegrationTest extends BaseIT {
          .build();
    }

	@AfterEach
	public void tearDown() {
		if (entityManager != null) {
			entityManager.clear();
		}
	}
	
	@WithMockUser(username="osadmin", roles = {"ADMIN","USER"})
	@Test

+18 −7
Original line number Diff line number Diff line
@@ -21,9 +21,12 @@ import org.etsi.osl.tmf.pm632.model.Organization;
import org.etsi.osl.tmf.pm632.model.OrganizationCreate;
import org.etsi.osl.tmf.pm632.reposervices.IndividualRepoService;
import org.etsi.osl.tmf.pm632.reposervices.OrganizationRepoService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors;
@@ -41,8 +44,7 @@ public class PartyManagementIntegrationTest extends BaseIT {
	private static final transient Log logger = LogFactory.getLog( PartyManagementIntegrationTest.class.getName());
	

    @Autowired
    private MockMvc mvc;
    private static MockMvc mvc;

    @Autowired
    IndividualRepoService individualRepoService;
@@ -65,8 +67,10 @@ public class PartyManagementIntegrationTest extends BaseIT {
    @Autowired
    private WebApplicationContext context;

    @PersistenceContext
    private EntityManager entityManager;

    @BeforeEach
    @BeforeAll
    public void setup() {
        mvc = MockMvcBuilders
          .webAppContextSetup(context).dispatchOptions(true)
@@ -74,6 +78,13 @@ public class PartyManagementIntegrationTest extends BaseIT {
          .build();
    }

    @AfterEach
    public void tearDown() {
        if (entityManager != null) {
            entityManager.clear();
        }
    }
    
	@WithMockUser(username="osadmin", roles = {"ADMIN","USER"})
	@Test
	public void addIndividual() throws Exception {
Loading