Skip to content

Commit

Permalink
Merge branch 'release/3.21.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
msqr committed Jun 20, 2024
2 parents fd7bf67 + 8785828 commit fb23a38
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 55 deletions.
2 changes: 1 addition & 1 deletion solarnet/datum/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencyManagement {
}

description = 'SolarNet: Datum'
version = '2.9.1'
version = '2.9.2'

base {
archivesName = 'solarnet-datum'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* ==================================================================
* ObjectMapperStreamDatumFilteredResultsProcessor.java - 1/05/2022 5:32:46 pm
*
*
* Copyright 2022 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/
Expand Down Expand Up @@ -53,16 +53,15 @@
import net.solarnetwork.domain.datum.ObjectDatumStreamMetadata;
import net.solarnetwork.domain.datum.ObjectDatumStreamMetadataProvider;
import net.solarnetwork.domain.datum.StreamDatum;
import net.solarnetwork.util.ArrayUtils;

/**
* {@link FilteredResultsProcessor} for encoding overall results into datum
* stream form.
*
*
* <p>
* The overall structure has the metadata followed by the data:
* </p>
*
*
* <pre>
* <code>{
* "returnedResultCount" : &lt;count&gt;,
Expand All @@ -80,12 +79,12 @@
* ]
* }</code>
* </pre>
*
*
* <p>
* For {@link Datum} results, each {@code data} element is an array with the
* following:
* </p>
*
*
* <ol>
* <li>0-based index of the associated stream metadata object in the
* {@literal meta} array</li>
Expand All @@ -98,11 +97,11 @@
* array)</li>
* <li>tags (one element per tag)</li>
* </ol>
*
*
* <p>
* The {@link Datum} structure resembles this:
* </p>
*
*
* <pre>
* <code>[
* &lt;meta index&gt;,
Expand All @@ -117,12 +116,12 @@
* ...,
* ]</code>
* </pre>
*
*
* <p>
* For {@link AggregateDatum} results, each {@code data} element is an array
* with the following:
* </p>
*
*
* <ol>
* <li>0-based index of the associated stream metadata object in the
* {@literal meta} array</li>
Expand All @@ -136,11 +135,11 @@
* ending value, for each accumulating property value (elements in order of the
* {@code meta.a} array)</li>
* </ol>
*
*
* <p>
* The {@link AggregateDatum} structure resembles this:
* </p>
*
*
* <pre>
* <code>[
* &lt;meta index&gt;,
Expand All @@ -151,9 +150,9 @@
* ...,
* ]</code>
* </pre>
*
*
* @author matt
* @version 1.1
* @version 1.2
* @since 1.3
*/
public final class ObjectMapperStreamDatumFilteredResultsProcessor
Expand All @@ -173,7 +172,7 @@ public final class ObjectMapperStreamDatumFilteredResultsProcessor

/**
* Constructor.
*
*
* @param generator
* the generator to use
* @param provider
Expand Down Expand Up @@ -283,13 +282,8 @@ public void handleResultItem(StreamDatum d) throws IOException {
p.getInstantaneous(), stats.getInstantaneous());
writeAggregateProperty(generator, DatumSamplesType.Accumulating, aLen,
p.getAccumulating(), stats.getAccumulating());
if ( sLen > 0 || tLen > 0 ) {
// if status or tags provided try to optimize them away if
if ( !ArrayUtils.isOnlyNull(p.getStatus()) || tLen > 0 ) {
writeStringArrayValues(generator, p.getStatus(), sLen);
}
writeStringArrayValues(generator, p.getTags(), tLen);
}
writeStringArrayValues(generator, p.getStatus(), sLen);
writeStringArrayValues(generator, p.getTags(), tLen);
} else {
generator.writeNull();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* ==================================================================
* ObjectMapperStreamDatumFilteredResultsProcessorTests.java - 1/05/2022 6:02:55 pm
*
*
* Copyright 2022 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/
Expand All @@ -25,10 +25,10 @@
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;
import static net.solarnetwork.domain.datum.DatumPropertiesStatistics.statisticsOf;
import static net.solarnetwork.central.datum.v2.support.StreamDatumFilteredResultsProcessor.METADATA_PROVIDER_ATTR;
import static net.solarnetwork.domain.datum.BasicObjectDatumStreamDataSet.dataSet;
import static net.solarnetwork.domain.datum.DatumProperties.propertiesOf;
import static net.solarnetwork.domain.datum.DatumPropertiesStatistics.statisticsOf;
import static net.solarnetwork.util.NumberUtils.decimalArray;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -63,9 +63,9 @@
/**
* Test cases for the {@link ObjectMapperStreamDatumFilteredResultsProcessor}
* class.
*
*
* @author matt
* @version 1.0
* @version 1.1
*/
public class ObjectMapperStreamDatumFilteredResultsProcessorTests {

Expand Down Expand Up @@ -148,7 +148,7 @@ public void oneStream_aggregate() throws IOException {
statisticsOf(new BigDecimal[][] {
decimalArray("10", "1.0", "2.0"),
decimalArray("10", "2.0", "3.0")
}, new BigDecimal[][] {
}, new BigDecimal[][] {
decimalArray("30", "100", "130")
}
)
Expand Down Expand Up @@ -192,7 +192,7 @@ public void oneStream_reading() throws IOException {
statisticsOf(new BigDecimal[][] {
decimalArray("10", "1.0", "2.0"),
decimalArray("10", "2.0", "3.0")
}, new BigDecimal[][] {
}, new BigDecimal[][] {
decimalArray("30", "100", "130")
}));
// @formatter:on
Expand All @@ -213,7 +213,7 @@ public void oneStream_reading() throws IOException {
assertThat("Reading JSON", json, is(format("{\"success\":true,\"meta\":[{\"streamId\":\"%s\",",
meta.getStreamId()) + "\"zone\":\"Pacific/Auckland\",\"kind\":\"n\",\"objectId\":123,"
+ "\"sourceId\":\"test/source\",\"i\":[\"a\",\"b\"],\"a\":[\"c\"],\"s\":[\"d\"]}],"
+ "\"data\":[[0,[1651197060000,1651200660000],[1.23,10,1.0,2.0],[2.34,10,2.0,3.0],[30,100,130]]]}"));
+ "\"data\":[[0,[1651197060000,1651200660000],[1.23,10,1.0,2.0],[2.34,10,2.0,3.0],[30,100,130],null]]}"));
}

}
2 changes: 1 addition & 1 deletion solarnet/solarquery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

description = 'SolarQuery'
version = '2.7.2'
version = '2.7.3'

base {
archivesName = 'solarquery'
Expand Down

0 comments on commit fb23a38

Please sign in to comment.