Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class ApplianceArchiveReaderConstants {
public static final String OP_MEAN = "mean_";
/** Operator for the optimized post processor */
public static final String OP_OPTIMIZED = "optimized_";
/** Operator for the optimized with last sample post processor */
public static final String OP_OPTIMIZED_WITH_LAST_SAMPLE = "optimLastSample_";

/** The schema delimiter: ca://pvName or pva://pvname */
static final String SCHEMA_DELIMITER = "://";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ public ApplianceOptimizedValueIterator(ApplianceArchiveReader reader, String nam
*/
@Override
protected void fetchDataInternal(String pvName) throws ArchiverApplianceException {
String optimized = new StringBuilder().append(ApplianceArchiveReaderConstants.OP_OPTIMIZED)
String optimizedOperator = ApplianceArchiveReaderConstants.OP_OPTIMIZED;
if (AppliancePreferences.ppOptimizedWithLastSample)
Comment thread
rjwills28 marked this conversation as resolved.
optimizedOperator = ApplianceArchiveReaderConstants.OP_OPTIMIZED_WITH_LAST_SAMPLE;

String optimized = new StringBuilder().append(optimizedOperator)
.append(requestedPoints).append('(').append(pvName).append(')').toString();
super.fetchDataInternal(optimized);
}
Expand Down Expand Up @@ -155,4 +159,4 @@ public VType next() {
return super.extractData(message);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class AppliancePreferences {
@Preference static boolean useStatisticsForOptimizedData;
@Preference static boolean useNewOptimizedOperator;
Comment thread
rjwills28 marked this conversation as resolved.
@Preference static boolean useHttps;
@Preference static boolean ppOptimizedWithLastSample;

static {
AnnotatedPreferences.initialize(AppliancePreferences.class, "/appliance_preferences.properties");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ useNewOptimizedOperator=true

# Use 'https://..' instead of plain 'http://..'?
useHttps=false

# Query the AA using the 'Optimized With Last Sample' post processor.
# Setting to false means that the 'Optimized' post processor will be
# used.
ppOptimizedWithLastSample=true
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ private static GenMsgIterator probeStream(PayloadType type) {
@Test
void fetchUrlContainsOptimizedNOperator() throws Exception {
FakeDataRetrieval dr = new FakeDataRetrieval(probeStream(PayloadType.SCALAR_DOUBLE));
dr.whenPvContains("optimized_", emptyStream());
dr.whenPvContains("optimLastSample_", emptyStream());

FakeApplianceArchiveReader reader = new FakeApplianceArchiveReader(dr);
new ApplianceOptimizedValueIterator(reader, "TEST:PV", START, END, POINTS, false);

assertTrue(dr.pvsCalled.stream().anyMatch(pv -> pv.startsWith("optimized_") && pv.endsWith("(TEST:PV)")),
"Expected optimized_<N>(TEST:PV) call, got: " + dr.pvsCalled);
assertTrue(dr.pvsCalled.stream().anyMatch(pv -> pv.startsWith("optimLastSample_") && pv.endsWith("(TEST:PV)")),
"Expected optimLastSample__<N>(TEST:PV) call, got: " + dr.pvsCalled);
}

@Test
Expand Down Expand Up @@ -78,7 +78,7 @@ private ApplianceOptimizedValueIterator makeWithWaveformData(boolean useStatisti
when(dataStream.getPayLoadInfo()).thenReturn(waveformInfo);

FakeDataRetrieval dr = new FakeDataRetrieval(probeStream(PayloadType.SCALAR_DOUBLE));
dr.whenPvContains("optimized_", dataStream);
dr.whenPvContains("optimLastSample_", dataStream);

FakeApplianceArchiveReader reader = new FakeApplianceArchiveReader(dr);
return new ApplianceOptimizedValueIterator(reader, "TEST:PV", START, END, POINTS, useStatistics);
Expand Down
Loading