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
4 changes: 2 additions & 2 deletions Middleware/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
Expand All @@ -55,8 +55,8 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import ca.concordia.encs.citydata.core.exceptions.MiddlewareException;
import ca.concordia.encs.citydata.core.implementations.CSVProducer;
import ca.concordia.encs.citydata.core.utils.RequestOptions;


/**
Expand All @@ -14,13 +15,19 @@
* makes the processed results available to consumers.
* @author Peter Yefi, Vinicius Mioto, Tahereh Bijani, Mohamed Jendoubi
* @date: 2026-06-27
* @author: Minette Z. Fixed the producer by adding the required constructor from CSVProducer to properly initialize the inherited base producer (CSVProducer)
* @date: 2026-05-29
*/
public class BTUProducer extends CSVProducer{

public BTUProducer(String filePath) {
super(filePath);
}

public BTUProducer(final String filePath, final RequestOptions fileOptions) {
super(filePath, fileOptions);
}

@Override
public void fetch() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@

import ca.concordia.encs.citydata.core.exceptions.MiddlewareException;
import ca.concordia.encs.citydata.core.implementations.CSVProducer;
import ca.concordia.encs.citydata.core.utils.RequestOptions;

/**
* This producer reads Flow data from a CSV source, processes it line by line, and produces a result set for the data
* readings for further operations. It stores all non-empty lines, optionally applies a configured operation on the data, and
* makes the processed results available to consumers.
* @author Peter Yefi, Vinicius Mioto, Tahereh Bijani, Mohamed Jendoubi
* @date: 2026-06-27
* @author: Minette Z. Fixed the producer by adding the required constructor from CSVProducer to properly initialize the inherited base producer (CSVProducer)
* @date: 2026-05-29
*/
public class FCUProducer extends CSVProducer{

public FCUProducer(String filePath) {
super(filePath);
}

public FCUProducer(String filePath, RequestOptions fileOptions) {
super(filePath, fileOptions);
}


@Override
public void fetch() {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ca.concordia.encs.citydata.test.producers;

import org.junit.jupiter.api.Test;
import org.junit.Assert;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;


Expand All @@ -14,6 +14,8 @@
*
* @author @author Peter Yefi, Vinicius Mioto, Tahereh Bijani, Mohamed Jendoubi
* @since 2026-05-27
* @author: Minette Z. Fixed the test by changing the imports, and using the right assert (assertEquals)
* @date: 2026-05-29
*/
public class BTUProducerTest {

Expand All @@ -29,7 +31,7 @@ void setUp() {
void testThatFilePathMatch() {
//Arrange and act
btuProducer.fetch();
Assert.assertEquals(btuProducer.getFilePath(), stringFilePath);
assertEquals(btuProducer.getFilePath(), stringFilePath);
}

@Test
Expand All @@ -39,10 +41,10 @@ void testThatResultSetMatchesFileContent() {
String [] rowOne = btuProducer.getResult().getFirst().split(",");
String [] lastRow = btuProducer.getResult().getLast().split(",");

Assert.assertEquals(btuProducer.getResult().size(), 30);
Assert.assertEquals(rowOne.length, 8);
Assert.assertEquals(rowOne[0], "2024-10-01 04:50:00+00:00");
Assert.assertEquals(lastRow[7], "20.518442");
assertEquals(btuProducer.getResult().size(), 30);
assertEquals(rowOne.length, 8);
assertEquals(rowOne[0], "2024-10-01 04:50:00+00:00");
assertEquals(lastRow[7], "20.518442");

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package ca.concordia.encs.citydata.test.producers;

import org.junit.Assert;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import ca.concordia.encs.citydata.producers.BTUProducer;

/**
* FCUProducer Tests
*
* @author @author Peter Yefi, Vinicius Mioto, Tahereh Bijani, Mohamed Jendoubi
* @since 2026-05-27
* @author: Minette Z. Fixed the test by changing the imports, and using the right assert (assertEquals)
* @date: 2026-05-29
*/


public class FCUProducerTest {

private BTUProducer fcuProducer = null;
Expand All @@ -20,7 +30,7 @@ void setUp() {
void testThatFilePathMatch() {
//Arrange and act
fcuProducer.fetch();
Assert.assertEquals(fcuProducer.getFilePath(), stringFilePath);
assertEquals(fcuProducer.getFilePath(), stringFilePath);
}

@Test
Expand All @@ -31,10 +41,10 @@ void testThatResultSetMatchesFileContent() {
String [] lastRow = fcuProducer.getResult().getLast().split(",");


Assert.assertEquals(fcuProducer.getResult().size(), 19);
Assert.assertEquals(rowOne.length, 13);
Assert.assertEquals(rowOne[0], "2022-03-02 02:15:00-05:00");
Assert.assertEquals(lastRow[12], "-0.6838173");
assertEquals(fcuProducer.getResult().size(), 19);
assertEquals(rowOne.length, 13);
assertEquals(rowOne[0], "2022-03-02 02:15:00-05:00");
assertEquals(lastRow[12], "-0.6838173");

}
}
31 changes: 31 additions & 0 deletions Middleware/src/test/resources/sample_BTU.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
,YTDVOLM-TOT,VOLM-TOT,YTDENRG-TOT,ENRG-TOT,RT,ST,VOLM-RT,ENRG-RT
2024-10-01 04:50:00+00:00,1537.0,257.0,15788700000.0,236900000.0,44.89837333333333,44.46054,8.919307,
2024-10-01 04:55:00+00:00,1537.0,257.0,15788700000.0,236900000.0,44.89837333333333,44.46054,8.919307,
2024-10-01 05:00:00+00:00,1537.0,257.0,15738200000.0,236900000.0,43.579637500000004,43.07584666666667,20.75178909090909,
2024-10-01 05:05:00+00:00,1537.0,257.0,15738300000.0,236900000.0,53.28717,45.46274,20.215303333333335,
2024-10-01 05:10:00+00:00,1537.0,257.0,15738400000.0,236900000.0,53.28717,45.39899666666667,20.74445,
2024-10-01 05:15:00+00:00,1537.0,257.0,15738500000.0,236900000.0,53.19522,45.39899666666667,20.650281666666668,
2024-10-01 05:20:00+00:00,1537.0,257.0,15738600000.0,236900000.0,53.19522,45.39899666666667,20.583014,
2024-10-01 05:25:00+00:00,1537.0,257.0,15738700000.0,236900000.0,53.19522,45.39899666666667,20.571485714285718,
2024-10-01 05:30:00+00:00,1537.0,257.0,15738800000.0,236900000.0,53.19522,45.3786,20.47001,
2024-10-01 05:35:00+00:00,1537.0,257.0,15738900000.0,236900000.0,53.54007,45.47804,20.542655,
2024-10-01 05:40:00+00:00,1537.0,257.0,15739050000.0,236900000.0,53.54007,45.47804,20.398519999999998,
2024-10-01 05:45:00+00:00,1537.0,257.0,15739200000.0,236900000.0,53.27185,45.47804,20.61328625,
2024-10-01 05:50:00+00:00,1537.0,257.0,15739300000.0,236900000.0,53.48642,45.47804,20.199605,
2024-10-01 05:55:00+00:00,1537.0,257.0,15739400000.0,236900000.0,53.48642,45.47804,20.56283625,
2024-10-01 06:00:00+00:00,1537.0,257.0,15739500000.0,236900000.0,53.77765,45.764920000000004,19.848484000000003,
2024-10-01 06:05:00+00:00,1537.0,257.0,15739600000.0,236900000.0,53.62181666666667,45.516295,20.381221666666665,
2024-10-01 06:10:00+00:00,1537.0,257.0,15739700000.0,236900000.0,53.62181666666667,45.516295,20.07853125,
2024-10-01 06:15:00+00:00,1537.0,257.0,15739800000.0,236900000.0,53.62181666666667,45.516295,20.515751666666667,
2024-10-01 06:20:00+00:00,1537.0,257.0,15739900000.0,236900000.0,53.62181666666667,45.516295,19.97186857142857,
2024-10-01 06:25:00+00:00,1537.0,257.0,15740000000.0,236900000.0,53.62181666666667,45.516295,20.0449,
2024-10-01 06:30:00+00:00,1537.0,257.0,15740100000.0,236900000.0,53.643525,45.59279333333333,20.2096975,
2024-10-01 06:35:00+00:00,1537.0,257.0,15740200000.0,236900000.0,53.643525,45.59279333333333,20.650281666666668,
2024-10-01 06:40:00+00:00,1537.0,257.0,15740350000.0,236900000.0,53.25653,45.14908,20.58301714285714,
2024-10-01 06:45:00+00:00,1537.0,257.0,15740500000.0,236900000.0,53.25653,45.14908,20.91597875,
2024-10-01 06:50:00+00:00,1537.0,257.0,15740600000.0,236900000.0,53.34337333333334,45.9198475,20.726515555555558,
2024-10-01 06:55:00+00:00,1537.0,257.0,15740700000.0,236900000.0,53.773804999999996,46.14362,21.05118,
2024-10-01 07:00:00+00:00,1537.0,257.0,15740800000.0,236900000.0,53.773804999999996,45.92941,21.1076825,
2024-10-01 07:05:00+00:00,1537.0,257.0,15740900000.0,236900000.0,53.773804999999996,46.15128,20.774720000000002,
2024-10-01 07:10:00+00:00,1537.0,257.0,15741000000.0,236900000.0,53.773804999999996,46.15128,21.194167142857143,
2024-10-01 07:15:00+00:00,1537.0,257.0,15741100000.0,236900000.0,53.8696,46.37314,20.518442,
20 changes: 20 additions & 0 deletions Middleware/src/test/resources/sample_FCU.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
,SW-O,HTG-O,HC-O,CLG-O,PUMP-C,T-SP,SAF-SP,T,SF-S,INSLAB-T,DA-T,OA-T
2022-03-02 02:15:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.04243332
2022-03-02 02:20:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.04243332
2022-03-02 02:25:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.04243332
2022-03-02 02:30:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.3653018
2022-03-02 02:35:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 02:40:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 02:45:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 02:50:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 02:55:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:00:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:05:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:10:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:15:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:20:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:25:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:30:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:35:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:40:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
2022-03-02 03:45:00-05:00,100.0,0.0,0.0,99.51366,,22.0,30.0,23.84879,1.0,24.84361,24.71732,-0.6838173
Loading