Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	simulator-ui/src/main/webapp/app/entities/message-header/detail/message-header-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/message-header/list/message-header-table.component.html
#	simulator-ui/src/main/webapp/app/entities/message-header/list/message-header.component.html
#	simulator-ui/src/main/webapp/app/entities/message/detail/message-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/message/list/message.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-action/detail/scenario-action-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-action/list/scenario-action.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-execution/detail/scenario-actions-table.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-execution/detail/scenario-messages-table.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-execution/detail/scenario-parameters-table.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-execution/list/scenario-execution.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-execution/list/scenario-execution.component.scss
#	simulator-ui/src/main/webapp/app/entities/scenario-parameter/detail/scenario-parameter-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/scenario-parameter/list/scenario-parameter.component.html
#	simulator-ui/src/main/webapp/app/entities/test-parameter/detail/test-parameter-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/test-parameter/list/test-parameter.component.html
#	simulator-ui/src/main/webapp/app/entities/test-result/detail/test-result-detail.component.html
#	simulator-ui/src/main/webapp/app/entities/test-result/list/test-result.component.html
#	simulator-ui/src/main/webapp/app/home/test-result-summary.component.html
#	simulator-ui/src/main/webapp/app/layouts/navbar/navbar.component.html
#	simulator-ui/src/main/webapp/app/scenario-result/filter/header-filter-dialog.component.html
#	simulator-ui/src/main/webapp/app/scenario-result/filter/scenario-execution-filter.component.html
#	simulator-ui/src/main/webapp/app/scenario-result/scenario-result.component.html
#	simulator-ui/src/main/webapp/app/scenario/detail/scenario-detail.component.html
#	simulator-ui/src/main/webapp/app/scenario/list/scenario.component.html
#	simulator-ui/src/main/webapp/app/shared/alert/alert-error.component.html
#	simulator-ui/src/main/webapp/app/shared/alert/alert.component.html
#	simulator-ui/src/main/webapp/app/shared/filter/filter.component.html
#	simulator-ui/src/main/webapp/app/shared/pagination/select-page-size.component.html
#	simulator-ui/src/main/webapp/content/scss/global.scss
  • Loading branch information
Melvin Johner committed Aug 20, 2024
2 parents 25827c6 + 3aef091 commit 292f66b
Show file tree
Hide file tree
Showing 60 changed files with 9,014 additions and 10,260 deletions.
2 changes: 1 addition & 1 deletion .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Citrus Simulator
release:
current-version: 3.0.0
current-version: 3.0.1
next-version: 3.1.0-SNAPSHOT
5 changes: 1 addition & 4 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [ 20, 21, 22 ]
node-version: [ 22 ]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -56,9 +56,6 @@ jobs:
- name: Install dependencies
run: npm ci --cache .npm --force
working-directory: simulator-ui
- name: Lint
run: npm run lint
working-directory: simulator-ui
- name: Prettier
run: npm run prettier:check
working-directory: simulator-ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ 18, 19, 20 ]
version: [ 19, 21 ]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ---------------------------------------------------------------------------
# Copyright the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

name: nightly

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
nightly:
runs-on: ubuntu-latest
steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Maven cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Info
run: |
java -version
./mvnw -version
- name: Simulator Dependency Report
run: |
./mvnw --no-transfer-progress versions:display-dependency-updates
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ target
.classpath
.settings
.idea
.vscode
.DS_Store
*.iml
*.ipr
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<maven.nexus-staging.plugin.version>1.6.13</maven.nexus-staging.plugin.version>

<lombok.version>1.18.30</lombok.version>
<citrus.version>4.2.1</citrus.version>
<citrus.version>4.3.1</citrus.version>

<spring-boot.version>3.3.0</spring-boot.version>
<spring.version>6.3.0</spring.version>
<spring-boot.version>3.3.2</spring-boot.version>
<spring.version>6.3.2</spring.version>
<testng.version>7.10.2</testng.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
<xerces.version>2.12.2</xerces.version>
Expand All @@ -38,8 +38,8 @@
<!-- see https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-logging/3.3.0 -->
<logback.classic.version>1.5.6</logback.classic.version>

<node.version>v20.12.1</node.version>
<npm.version>10.5.0</npm.version>
<node.version>v22.4.1</node.version>
<npm.version>10.8.1</npm.version>

<skip.gpg>false</skip.gpg>
<reuseForks>true</reuseForks>
Expand Down Expand Up @@ -216,7 +216,7 @@
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>3.1.0</version>
<version>5.2.0</version>
</dependency>

<dependency>
Expand Down
6 changes: 3 additions & 3 deletions scripts/commands/release
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ build_and_stage_artifacts() {
cd $working_dir
if [ $(hasflag --local-release) ]; then
echo "==== Release to local"
./mvnw ${maven_opts} install
./mvnw ${maven_opts} install -DskipFrontend=false
elif [ $(hasflag --snapshot-release) ]; then
echo "==== Release snapshot to local"
./mvnw ${maven_opts} install
./mvnw ${maven_opts} install -DskipFrontend=false
else
echo "==== Release to Maven central and stage artifacts to Sonatype"
./mvnw ${maven_opts} install deploy -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dtest -Dit.test -Prelease-central -DstagingDescription="Staging Citrus for v$release_version"
./mvnw ${maven_opts} install deploy -DskipFrontend=false -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dtest -Dit.test -Prelease-central -DstagingDescription="Staging Citrus for v$release_version"
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* limitations under the License.
*/

package org.citrusframework.simulator.service.impl;
package org.citrusframework.simulator.common;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

class TimeProvider {
import static java.time.ZoneOffset.UTC;

TimeProvider() {
// Separate class that allows mocking
}
/**
* Should be used whenever the current time is needed, to ensure consistent Date/Time values
*/
public class TimeProvider {

Instant getTimeNow() {
return LocalDateTime.now().toInstant(ZoneOffset.UTC);
public Instant getTimeNow() {
return LocalDateTime.now().toInstant(UTC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.Data;
import org.citrusframework.simulator.common.TimeProvider;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
Expand All @@ -39,16 +40,18 @@
@JsonIgnoreProperties(value = {"createdDate", "lastModifiedDate"}, allowGetters = true)
public abstract class AbstractAuditingEntity<T, I> implements Serializable {

private static TimeProvider timeProvider = new TimeProvider();

@Serial
private static final long serialVersionUID = 1L;

@CreatedDate
@Column(name = "created_date", nullable = false, updatable = false)
private Instant createdDate = Instant.now();
private Instant createdDate = timeProvider.getTimeNow();

@LastModifiedDate
@Column(name = "last_modified_date")
private Instant lastModifiedDate = Instant.now();
private Instant lastModifiedDate = timeProvider.getTimeNow();

public static abstract class AuditingEntityBuilder<B extends AuditingEntityBuilder<B, E, A>, E extends AbstractAuditingEntity<E, A>, A> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.citrusframework.TestAction;
import org.citrusframework.TestCase;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.common.TimeProvider;
import org.citrusframework.simulator.model.ScenarioAction;
import org.citrusframework.simulator.repository.ScenarioActionRepository;
import org.citrusframework.simulator.service.ScenarioActionService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import jakarta.annotation.Nullable;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.common.TimeProvider;
import org.citrusframework.simulator.model.ScenarioExecution;
import org.citrusframework.simulator.model.ScenarioParameter;
import org.citrusframework.simulator.model.TestResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.exception.SimulatorException;
import org.citrusframework.spi.CitrusResourceWrapper;
Expand Down Expand Up @@ -52,6 +51,9 @@
import java.util.ArrayList;
import java.util.List;

import static org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil.createSampleForType;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;

/**
* @author Christoph Deppisch
*/
Expand Down Expand Up @@ -127,13 +129,13 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
case SOAP_ACTION -> soapAction;
};

if (beanFactory instanceof BeanDefinitionRegistry) {
logger.info("Register auto generated scenario as bean definition: " + scenarioName);
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(WsdlOperationScenario.class)
if (beanFactory instanceof BeanDefinitionRegistry beanDefinitionRegistry) {
logger.info("Register auto generated scenario as bean definition: {}", scenarioName);
BeanDefinitionBuilder beanDefinitionBuilder = genericBeanDefinition(WsdlOperationScenario.class)
.addConstructorArgValue(operation)
.addPropertyValue("soapAction", soapAction)
.addPropertyValue("input", generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)))
.addPropertyValue("output", generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
.addPropertyValue("input", generateRequest(operation, createSampleForType(requestElem)))
.addPropertyValue("output", generateResponse(operation, createSampleForType(responseElem)));

if (beanFactory.containsBeanDefinition("inboundXmlDataDictionary")) {
beanDefinitionBuilder.addPropertyReference("inboundDataDictionary", "inboundXmlDataDictionary");
Expand All @@ -143,10 +145,10 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
beanDefinitionBuilder.addPropertyReference("outboundDataDictionary", "outboundXmlDataDictionary");
}

((BeanDefinitionRegistry) beanFactory).registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition());
beanDefinitionRegistry.registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition());
} else {
logger.info("Register auto generated scenario as singleton: " + scenarioName);
WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)), generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
logger.info("Register auto generated scenario as singleton: {}", scenarioName);
WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, createSampleForType(requestElem)), generateResponse(operation, createSampleForType(responseElem)));
beanFactory.registerSingleton(scenarioName, scenario);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.citrusframework.simulator.model;

import org.assertj.core.data.TemporalUnitLessThanOffset;
import org.citrusframework.simulator.common.TimeProvider;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static java.time.temporal.ChronoUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;

class AbstractAuditingEntityIT {

public static final TemporalUnitLessThanOffset LESS_THAN_1_SECOND = new TemporalUnitLessThanOffset(1, SECONDS);

AuditedEntity fixture;

@BeforeEach
void setup() {
fixture = new AuditedEntity();
}

@Test
void shouldUseCorrectTime() {
var timeProvider = new TimeProvider();
assertThat(fixture.getCreatedDate()).isCloseTo(timeProvider.getTimeNow(), LESS_THAN_1_SECOND);
assertThat(fixture.getLastModifiedDate()).isCloseTo(timeProvider.getTimeNow(), LESS_THAN_1_SECOND);
}

private static class AuditedEntity extends AbstractAuditingEntity<AuditedEntity, Long> {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.citrusframework.TestAction;
import org.citrusframework.TestCase;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.common.TimeProvider;
import org.citrusframework.simulator.model.ScenarioAction;
import org.citrusframework.simulator.model.ScenarioExecution;
import org.citrusframework.simulator.repository.ScenarioActionRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.citrusframework.simulator.service.impl;

import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.common.TimeProvider;
import org.citrusframework.simulator.model.ScenarioExecution;
import org.citrusframework.simulator.model.ScenarioParameter;
import org.citrusframework.simulator.model.TestResult;
Expand Down
Loading

0 comments on commit 292f66b

Please sign in to comment.