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
36 changes: 0 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,6 @@ jobs:
build-and-test:
name: Build and Test All Modules
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_db
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3

postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd=pg_isready
--health-interval=10s
--health-timeout=5s
--health-retries=3

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -75,13 +47,9 @@ jobs:

- name: Run tests - openespi-common
run: mvn test -pl openespi-common -am
env:
SPRING_PROFILES_ACTIVE: test

- name: Run tests - openespi-datacustodian
run: mvn test -pl openespi-datacustodian -am
env:
SPRING_PROFILES_ACTIVE: test

# TODO: Enable when authserver implementation is complete
# - name: Run tests - openespi-authserver
Expand All @@ -91,13 +59,9 @@ jobs:

- name: Run tests - openespi-thirdparty
run: mvn test -pl openespi-thirdparty -am
env:
SPRING_PROFILES_ACTIVE: test

- name: Run integration tests with TestContainers
run: mvn verify -Pintegration-tests -pl openespi-common,openespi-datacustodian,openespi-thirdparty
env:
SPRING_PROFILES_ACTIVE: testcontainers

# JaCoCo reports are automatically generated during test phase (configured in root pom.xml)

Expand Down
12 changes: 11 additions & 1 deletion openespi-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,17 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<!-- Jakarta XML Binding Dependencies -->
<!-- Jakarta / Jackson XML Binding Dependencies -->
<dependency>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson-bom.version}</version>
</dependency>
<dependency>
<groupId>tools.jackson.module</groupId>
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
<version>${jackson-bom.version}</version>
</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 @@ -23,7 +23,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.util.Objects;
import java.util.UUID;
Expand All @@ -49,7 +51,8 @@ public class PhoneNumberEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.util.Objects;
import java.util.UUID;
Expand All @@ -48,7 +50,8 @@ public class StatementRefEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.util.Objects;
import java.util.UUID;
Expand All @@ -49,7 +51,8 @@ public class AggregatedNodeRefEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -59,7 +61,8 @@ public class BatchListEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import lombok.Setter;
import org.greenbuttonalliance.espi.common.domain.common.DateTimeInterval;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -54,7 +56,8 @@ public class IntervalReadingEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.math.BigDecimal;
import java.math.RoundingMode;
Expand Down Expand Up @@ -62,7 +64,8 @@ public class LineItemEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.type.SqlTypes;

import java.util.Objects;
import java.util.UUID;
Expand Down Expand Up @@ -57,7 +59,8 @@ public class ReadingQualityEntity {
*/
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "id", nullable = false)
@JdbcTypeCode(SqlTypes.CHAR)
@Column(length = 36, columnDefinition = "char(36)", updatable = false, nullable = false)
private UUID id;

// Quality constants based on common industry standards
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,41 @@

package org.greenbuttonalliance.espi.common.dto.atom;

import com.fasterxml.jackson.annotation.*;
import jakarta.xml.bind.annotation.*;
import org.greenbuttonalliance.espi.common.dto.usage.MeterReadingDto;
import org.greenbuttonalliance.espi.common.dto.usage.ReadingTypeDto;
import org.greenbuttonalliance.espi.common.dto.usage.UsagePointDto;
import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty;

/**
* Atom Content DTO record for content within Atom entries.
*
* Represents the content section of an Atom entry containing the actual
* Green Button resource data (Customer, UsagePoint, MeterReading, etc.).
*
* @deprecated AtomContentDto no longer used. Payload moved to AtomEntryDto
*/
@Deprecated
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AtomContent", namespace = "http://www.w3.org/2005/Atom")
public record AtomContentDto(

@XmlAttribute(name = "type")
String type,


@JsonProperty("resource")
@JacksonXmlProperty(namespace = "http://naesb.org/espi")

@XmlElementWrapper(name = "resource", namespace = "http://naesb.org/espi")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.WRAPPER_OBJECT,
property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = UsagePointDto.class, name = "UsagePoint"),
@JsonSubTypes.Type(value = MeterReadingDto.class, name = "MeterReading"),
@JsonSubTypes.Type(value = ReadingTypeDto.class, name = "ReadingType")
})
@XmlAnyElement(lax = true)
Object resource
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@

package org.greenbuttonalliance.espi.common.dto.atom;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import jakarta.xml.bind.annotation.*;
import org.greenbuttonalliance.espi.common.dto.usage.MeterReadingDto;
import org.greenbuttonalliance.espi.common.dto.usage.ReadingTypeDto;
import org.greenbuttonalliance.espi.common.dto.usage.UsagePointDto;

import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.List;

/**
* Atom Entry DTO record for individual entries in Atom feeds.
*
* <p>
* Represents an individual entry within an Atom feed containing Green Button data.
* Used to wrap individual resources (usage points, customers, etc.) in Atom format.
*/
Expand All @@ -41,7 +50,7 @@ public record AtomEntryDto(

@XmlElement(name = "title", namespace = "http://www.w3.org/2005/Atom")
String title,

@XmlElement(name = "published", namespace = "http://www.w3.org/2005/Atom")
OffsetDateTime published,

Expand All @@ -50,9 +59,18 @@ public record AtomEntryDto(

@XmlElement(name = "link", namespace = "http://www.w3.org/2005/Atom")
List<LinkDto> links,


@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.WRAPPER_OBJECT,
property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = UsagePointDto.class, name = "espi:UsagePoint"),
@JsonSubTypes.Type(value = MeterReadingDto.class, name = "espi:MeterReading"),
@JsonSubTypes.Type(value = ReadingTypeDto.class, name = "espi:ReadingType")
})
@XmlAnyElement(lax = true)
@XmlElement(name = "content", namespace = "http://www.w3.org/2005/Atom")
AtomContentDto content
Object content
) {

/**
Expand All @@ -66,7 +84,12 @@ public AtomEntryDto() {
* Constructor for basic entry data.
*/
public AtomEntryDto(String id, String title, Object resource) {
this(id, title, OffsetDateTime.now(), OffsetDateTime.now(), null,

//get date in UTC and truncate to seconds for proper ESPI date format
LocalDateTime localDateTime = LocalDateTime.now().truncatedTo(java.time.temporal.ChronoUnit.SECONDS);
OffsetDateTime now = localDateTime.atOffset(ZoneOffset.UTC).toZonedDateTime().toOffsetDateTime();

this(id, title, now, now, null,
new AtomContentDto("application/xml", resource));
}

Expand Down Expand Up @@ -100,6 +123,6 @@ public LinkDto getUpLink() {
* @return resource content or null if not available
*/
public Object getResource() {
return content != null ? content.resource() : null;
return content; // != null ? content.resource() : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public record IntervalBlockDto(

@XmlTransient
Long id,

@XmlAttribute(name = "mRID")

@XmlTransient
//@XmlAttribute(name = "mRID")
String uuid,

@XmlElement(name = "published")
Expand All @@ -66,7 +67,7 @@ public record IntervalBlockDto(
DateTimeIntervalDto interval,

@XmlElement(name = "IntervalReading")
@XmlElementWrapper(name = "IntervalReadings")
// @XmlElementWrapper(name = "IntervalReadings")
List<IntervalReadingDto> intervalReadings
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public record IntervalReadingDto(
DateTimeIntervalDto timePeriod,

@XmlElement(name = "ReadingQuality")
@XmlElementWrapper(name = "ReadingQualities")
//@XmlElementWrapper(name = "ReadingQualities")
List<ReadingQualityDto> readingQualities,

@XmlElement(name = "consumptionTier")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public record ReadingTypeDto(

@XmlTransient
Long id,

@XmlAttribute(name = "mRID")

@XmlTransient
// @XmlAttribute(name = "mRID")
String uuid,

@XmlElement(name = "description")
Expand Down
Loading
Loading