Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ To contribute code, you will need to create a fork of the repository on GitHub.
3. Create a new branch for your changes.
4. Make and verify your changes.
5. Commit and push your changes to your fork on GitHub.
- When committing you must sign-off your commit. If you are unfamiliar on how to do this, Google is your friend.

### Building the source code
To build the source code, run the following command in the root directory of the project:
Expand Down
6 changes: 6 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

public class DateAdapter {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DateAdapter() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DateAdapter {

private static final DateTimeFormatter XSD_DATE = new DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;

public class DateTimeAdapter {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DateTimeAdapter() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DateTimeAdapter {

private static final DateTimeFormatter XSD_DATE_TIME = new DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE_TIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import java.time.Duration;

public class DurationAdapter {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DurationAdapter() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DurationAdapter {

public static Duration parse(String str) {
return str != null ? Duration.parse(str) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class DateTimeCalculation {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DateTimeCalculation() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DateTimeCalculation {

public static Duration toJavaTime(javax.xml.datatype.Duration duration) {
if (!canBeConvertedWithoutOffset(duration)) {
Expand Down
2 changes: 0 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<swagger-annotations.version>2.2.21</swagger-annotations.version>
<wiremock.version>3.5.3</wiremock.version>
<xmlunit.verion>2.9.1</xmlunit.verion>
<lombok.version>1.18.32</lombok.version>
<commons-logging.version>1.3.1</commons-logging.version>
<jakarta-annotation.version>2.1.1</jakarta-annotation.version>
<awaitility.version>4.2.1</awaitility.version>
Expand All @@ -47,7 +46,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.lfenergy.shapeshifter.core.common;

import lombok.Getter;

@Getter
public enum HttpStatusCode {

//1xx: Informational
Expand Down Expand Up @@ -81,14 +84,6 @@ public enum HttpStatusCode {
this.description = description;
}

public int getValue() {
return value;
}

public String getDescription() {
return description;
}

@Override
public String toString() {
return value + " " + description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

public interface InstancePool<T> {

public int size();
int size();

public T claim();
T claim();

public void release(final T instance);
void release(final T instance);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.util.Map;
import java.util.Optional;
import java.util.function.BiConsumer;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.lfenergy.shapeshifter.api.AGRPortfolioQuery;
import org.lfenergy.shapeshifter.api.AGRPortfolioQueryResponse;
import org.lfenergy.shapeshifter.api.AGRPortfolioUpdate;
Expand Down Expand Up @@ -40,12 +43,9 @@
import org.lfenergy.shapeshifter.api.TestMessageResponse;
import org.lfenergy.shapeshifter.core.service.validation.tools.PayloadMessagePropertyRetriever;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class UftpRequestResponseMapping {

private UftpRequestResponseMapping() {
// Private constructor to hide implicit one
}

private static final Map<Class<? extends PayloadMessageType>, Class<? extends PayloadMessageType>> REQUEST_TO_RESPONSE_TYPES =
Map.ofEntries(
Map.entry(AGRPortfolioQuery.class, AGRPortfolioQueryResponse.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
package org.lfenergy.shapeshifter.core.model;

import java.util.Set;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.lfenergy.shapeshifter.api.AGRPortfolioQuery;
import org.lfenergy.shapeshifter.api.AGRPortfolioQueryResponse;
import org.lfenergy.shapeshifter.api.AGRPortfolioUpdate;
Expand Down Expand Up @@ -34,12 +37,9 @@
import org.lfenergy.shapeshifter.api.TestMessageResponse;
import org.lfenergy.shapeshifter.api.USEFRoleType;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class UftpRoleInformation {

private UftpRoleInformation() {
// Private constructor to hide implicit one
}

private static final Set<Class<? extends PayloadMessageType>> AGR_MESSAGE_TYPES = Set.of(
AGRPortfolioQuery.class,
AGRPortfolioUpdate.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public interface UftpMessageSupport {

/**
* Finds an existing received message by messageID (if any) and and sender domain and recipient domain
* Finds an existing received message by messageID (if any) and sender domain and recipient domain
*
* @param messageID The message ID.
* @param senderDomain The sender domain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package org.lfenergy.shapeshifter.core.service.validation;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
* Pre-defined constants to indicate the order with {@link UftpValidator#order}.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ValidationOrder {

private ValidationOrder() {
// Add private constructor to hide implicit public one
}

/**
* Must be performed BEFORE the validations from the official specification.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public boolean isValid(UftpMessage<PayloadMessageType> uftpMessage) {

@Override
public String getReason() {
return "ExpirationDateTime out of bounds (ISP's related)";
return "ExpirationDateTime out of bounds (ISPs related)";
}

private boolean expirationAdheresToIspList(FlexRequest msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import org.lfenergy.shapeshifter.core.service.validation.ValidationOrder;

/**
* Validates that at least one of the ISPs with a 'requested'”' disposition in the referred FlexRequest, is mentioned in the FlexOffer.
* Validates that at least one of the ISPs with a 'requested' disposition in the referred FlexRequest, is mentioned in the FlexOffer.
*/


@RequiredArgsConstructor
public class FlexOptionRequestMatchValidator implements UftpValidator<FlexOffer> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
import java.util.List;

/**
* Validates that at the ordered power matches the offered power
* Validates that the ordered power matches the offered power
*/


@RequiredArgsConstructor
public class FlexOrderFlexibilityMatchValidator implements UftpValidator<FlexOrder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import java.util.List;

/**
* Validates that at ISP's in the flex order match the ISP's in the flex offer
* Validates that ISPs in the flex order match the ISPs in the flex offer
*/


@RequiredArgsConstructor
public class FlexOrderIspMatchValidator implements UftpValidator<FlexOrder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
/**
* Validates that at the price of the order matches the price in the offer
*/


@RequiredArgsConstructor
public class FlexOrderPriceMatchValidator implements UftpValidator<FlexOrder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.lfenergy.shapeshifter.core.service.validation.ValidationOrder;

/**
* Validates that all ISP's that have disposition = requested indicate a power direction, thus having either a minPower &lt; 0 *or* a maxPower &gt; 0 but not both.
* Validates that all ISPs that have disposition = requested indicate a power direction, thus having either a minPower &lt; 0 *or* a maxPower &gt; 0 but not both.
*/
public class IspPowerDiscrepancyValidator implements UftpValidator<FlexRequest> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
/**
* Validates that the min activation factor (if present) is in the interval &lt;0,1] (thus: &gt; 0, &lt;=1)
*/


public class MinActivationFactorValidator implements UftpValidator<FlexOffer> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.time.LocalDate;

public final class DateCompareAllowingInfinite {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DateCompareAllowingInfinite() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DateCompareAllowingInfinite {

public static boolean equalOrAfter(LocalDate equalToOrAfter, LocalDate comparedTo) {
return isEqual(equalToOrAfter, comparedTo) || isAfter(equalToOrAfter, comparedTo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import java.time.OffsetDateTime;

public final class DateTimeCompareAllowingInfinite {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private DateTimeCompareAllowingInfinite() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DateTimeCompareAllowingInfinite {

public static boolean equalOrAfter(OffsetDateTime equalToOrAfter, OffsetDateTime comparedTo) {
return isEqual(equalToOrAfter, comparedTo) || isAfter(equalToOrAfter, comparedTo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public boolean isTypeInMap(Class<? extends PayloadMessageType> validatedMsgType)
}

public Optional<R> getOptionalProperty(T payloadMessage) {
var getter = retrieveProperetyGetter(payloadMessage);
var getter = retrievePropertyGetter(payloadMessage);
var result = getter.apply(payloadMessage);
return Optional.ofNullable(result);
}
Expand All @@ -36,7 +36,7 @@ public R getProperty(T payloadMessage) {
return result.get();
}

private Function<PayloadMessageType, R> retrieveProperetyGetter(T payloadMessage) {
private Function<PayloadMessageType, R> retrievePropertyGetter(T payloadMessage) {
var key = getApplicableKey(payloadMessage.getClass());
return typePropertyGetterMap.get(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import java.util.Optional;
import java.util.Set;

public final class SetOf {
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

private SetOf() {
// private constructor to hide implicit public one
}
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SetOf {

public static <T> Set<T> setOfNullable(T value) {
return setOfOptional(Optional.ofNullable(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,6 @@ private static FlexOfferOptionISPType setStartAndDuration(FlexOfferOptionISPType

@Test
void getReason() {
assertThat(testSubject.getReason()).isEqualTo("ExpirationDateTime out of bounds (ISP's related)");
assertThat(testSubject.getReason()).isEqualTo("ExpirationDateTime out of bounds (ISPs related)");
}
}
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>

<jaxb.version>4.0.1</jaxb.version>
<lombok.version>1.18.34</lombok.version>

<!-- Test dependency versions -->
<junit.version>5.10.2</junit.version>
Expand Down Expand Up @@ -72,6 +73,13 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class UftpInternalController {
@PostMapping(value = "/message", consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_XML_VALUE})
@Operation(summary = "Send an UFTP message", description = "Send an UFTP message in a signed XML document",
responses = {
@ApiResponse(responseCode = "200", description = "The UFTP message was succesfully received"),
@ApiResponse(responseCode = "200", description = "The UFTP message was successfully received"),
@ApiResponse(responseCode = "400", description = "Error during XML validation or deserialization"),
@ApiResponse(responseCode = "401", description = "Failed to unseal message"),
@ApiResponse(responseCode = "500", description = "Internal server error: An unexpected error occurred. Details are provided in the response body",
Expand Down
Loading