target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testIsNumericArray(){ VDouble vDouble = VDouble.of(7.7, Alarm.none(), Time.now(), Display.none()); assertFalse(VTypeHelper.isNumericArray(vDouble)); VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); assertTrue(VTypeHelper.isNumericArray(dou... | public static boolean isNumericArray(final VType value) { return value instanceof VNumberArray || value instanceof VEnumArray; } | VTypeHelper { public static boolean isNumericArray(final VType value) { return value instanceof VNumberArray || value instanceof VEnumArray; } } | VTypeHelper { public static boolean isNumericArray(final VType value) { return value instanceof VNumberArray || value instanceof VEnumArray; } } | VTypeHelper { public static boolean isNumericArray(final VType value) { return value instanceof VNumberArray || value instanceof VEnumArray; } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType val... | VTypeHelper { public static boolean isNumericArray(final VType value) { return value instanceof VNumberArray || value instanceof VEnumArray; } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType val... |
@Test public void testGetArraySize(){ VDoubleArray doubleArray = VDoubleArray.of(ArrayDouble.of(7.7, 8.8), Alarm.none(), Time.now(), Display.none()); assertEquals(2, VTypeHelper.getArraySize(doubleArray)); VEnumArray enumArray = VEnumArray.of(ArrayInteger.of(0, 1), EnumDisplay.of("a", "b"), Alarm.none(), Time.now()); a... | public static int getArraySize(final VType value) { final ListInteger sizes; if (value instanceof VNumberArray) { sizes = ((VNumberArray) value).getSizes(); } else if (value instanceof VEnumArray) { sizes = ((VEnumArray) value).getSizes(); } else if (value instanceof VStringArray) { sizes = ((VStringArray) value).getSi... | VTypeHelper { public static int getArraySize(final VType value) { final ListInteger sizes; if (value instanceof VNumberArray) { sizes = ((VNumberArray) value).getSizes(); } else if (value instanceof VEnumArray) { sizes = ((VEnumArray) value).getSizes(); } else if (value instanceof VStringArray) { sizes = ((VStringArray... | VTypeHelper { public static int getArraySize(final VType value) { final ListInteger sizes; if (value instanceof VNumberArray) { sizes = ((VNumberArray) value).getSizes(); } else if (value instanceof VEnumArray) { sizes = ((VEnumArray) value).getSizes(); } else if (value instanceof VStringArray) { sizes = ((VStringArray... | VTypeHelper { public static int getArraySize(final VType value) { final ListInteger sizes; if (value instanceof VNumberArray) { sizes = ((VNumberArray) value).getSizes(); } else if (value instanceof VEnumArray) { sizes = ((VEnumArray) value).getSizes(); } else if (value instanceof VStringArray) { sizes = ((VStringArray... | VTypeHelper { public static int getArraySize(final VType value) { final ListInteger sizes; if (value instanceof VNumberArray) { sizes = ((VNumberArray) value).getSizes(); } else if (value instanceof VEnumArray) { sizes = ((VEnumArray) value).getSizes(); } else if (value instanceof VStringArray) { sizes = ((VStringArray... |
@Test public void testGetLatestTimeOf(){ Instant now = Instant.now(); Time t1 = Time.of(Instant.EPOCH); Time t2 = Time.of(now); VInt i1 = VInt.of(1, Alarm.none(), t1, Display.none()); VInt i2 = VInt.of(2, Alarm.none(), t2, Display.none()); assertEquals(t2, VTypeHelper.lastestTimeOf(i1, i2)); assertEquals(t2, VTypeHelpe... | public static Time lastestTimeOf(final VType a, final VType b) { final Time ta = Time.timeOf(a); final Time tb = Time.timeOf(b); if (ta.getTimestamp().isAfter(tb.getTimestamp())) { return ta; } return tb; } | VTypeHelper { public static Time lastestTimeOf(final VType a, final VType b) { final Time ta = Time.timeOf(a); final Time tb = Time.timeOf(b); if (ta.getTimestamp().isAfter(tb.getTimestamp())) { return ta; } return tb; } } | VTypeHelper { public static Time lastestTimeOf(final VType a, final VType b) { final Time ta = Time.timeOf(a); final Time tb = Time.timeOf(b); if (ta.getTimestamp().isAfter(tb.getTimestamp())) { return ta; } return tb; } } | VTypeHelper { public static Time lastestTimeOf(final VType a, final VType b) { final Time ta = Time.timeOf(a); final Time tb = Time.timeOf(b); if (ta.getTimestamp().isAfter(tb.getTimestamp())) { return ta; } return tb; } final static double toDouble(final VType value); static double[] toDoubles(final VType value); sta... | VTypeHelper { public static Time lastestTimeOf(final VType a, final VType b) { final Time ta = Time.timeOf(a); final Time tb = Time.timeOf(b); if (ta.getTimestamp().isAfter(tb.getTimestamp())) { return ta; } return tb; } final static double toDouble(final VType value); static double[] toDoubles(final VType value); sta... |
@Test public void testGetTimestamp() throws Exception{ Instant epoch = Instant.EPOCH; Time t = Time.of(epoch); VInt i1 = VInt.of(1, Alarm.none(), t, Display.none()); assertEquals(epoch, VTypeHelper.getTimestamp(i1)); t = Time.nowInvalid(); i1 = VInt.of(1, Alarm.none(), t, Display.none()); Instant now = Instant.now(); T... | final public static Instant getTimestamp(final VType value) { final Time time = Time.timeOf(value); if (time != null && time.isValid()) { return time.getTimestamp(); } return Instant.now(); } | VTypeHelper { final public static Instant getTimestamp(final VType value) { final Time time = Time.timeOf(value); if (time != null && time.isValid()) { return time.getTimestamp(); } return Instant.now(); } } | VTypeHelper { final public static Instant getTimestamp(final VType value) { final Time time = Time.timeOf(value); if (time != null && time.isValid()) { return time.getTimestamp(); } return Instant.now(); } } | VTypeHelper { final public static Instant getTimestamp(final VType value) { final Time time = Time.timeOf(value); if (time != null && time.isValid()) { return time.getTimestamp(); } return Instant.now(); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toSt... | VTypeHelper { final public static Instant getTimestamp(final VType value) { final Time time = Time.timeOf(value); if (time != null && time.isValid()) { return time.getTimestamp(); } return Instant.now(); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toSt... |
@Test public void testTransformTimestamp(){ Instant instant = Instant.now(); VInt intValue = VInt.of(7, Alarm.none(), Time.of(Instant.EPOCH), Display.none()); intValue = (VInt)VTypeHelper.transformTimestamp(intValue, instant); assertEquals(instant, intValue.getTime().getTimestamp()); VDouble doubleValue = VDouble.of(7.... | public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber number = (VNu... | VTypeHelper { public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber... | VTypeHelper { public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber... | VTypeHelper { public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber... | VTypeHelper { public static VType transformTimestamp(final VType value, final Instant time) { if (value instanceof VDouble) { final VDouble number = (VDouble) value; return VDouble.of(number.getValue().doubleValue(), number.getAlarm(), Time.of(time), number.getDisplay()); } if (value instanceof VNumber) { final VNumber... |
@Test public void testGetScalarValueString() { assertEquals("[1]", SnapshotDataConverter.getScalarValueString(Integer.valueOf(1))); assertEquals("[1.1]", SnapshotDataConverter.getScalarValueString(Double.valueOf(1.1))); String string = SnapshotDataConverter.getScalarValueString("string"); assertEquals("[\"string\"]", s... | protected static String getScalarValueString(Object value) { ObjectMapper objectMapper = new ObjectMapper(); Object[] valueArray = {value}; try { return objectMapper.writeValueAsString(valueArray); } catch (JsonProcessingException e) { throw new PVConversionException(String.format("Unable to write scalar value \"%s\" a... | SnapshotDataConverter { protected static String getScalarValueString(Object value) { ObjectMapper objectMapper = new ObjectMapper(); Object[] valueArray = {value}; try { return objectMapper.writeValueAsString(valueArray); } catch (JsonProcessingException e) { throw new PVConversionException(String.format("Unable to wri... | SnapshotDataConverter { protected static String getScalarValueString(Object value) { ObjectMapper objectMapper = new ObjectMapper(); Object[] valueArray = {value}; try { return objectMapper.writeValueAsString(valueArray); } catch (JsonProcessingException e) { throw new PVConversionException(String.format("Unable to wri... | SnapshotDataConverter { protected static String getScalarValueString(Object value) { ObjectMapper objectMapper = new ObjectMapper(); Object[] valueArray = {value}; try { return objectMapper.writeValueAsString(valueArray); } catch (JsonProcessingException e) { throw new PVConversionException(String.format("Unable to wri... | SnapshotDataConverter { protected static String getScalarValueString(Object value) { ObjectMapper objectMapper = new ObjectMapper(); Object[] valueArray = {value}; try { return objectMapper.writeValueAsString(valueArray); } catch (JsonProcessingException e) { throw new PVConversionException(String.format("Unable to wri... |
@Test public void highestAlarmOf() { VType arg1 = VInt.of(0, Alarm.none(), Time.now(), Display.none()); VType arg2 = VInt.of(0, Alarm.lolo(), Time.now(), Display.none()); Alarm alarm = VTypeHelper.highestAlarmOf(arg1, arg2); assertTrue("Failed to correctly calculate highest alarm expected LOLO, got : " + alarm, Alarm.l... | public static Alarm highestAlarmOf(final VType a, VType b) { return Alarm.highestAlarmOf(java.util.List.of(a, b), false); } | VTypeHelper { public static Alarm highestAlarmOf(final VType a, VType b) { return Alarm.highestAlarmOf(java.util.List.of(a, b), false); } } | VTypeHelper { public static Alarm highestAlarmOf(final VType a, VType b) { return Alarm.highestAlarmOf(java.util.List.of(a, b), false); } } | VTypeHelper { public static Alarm highestAlarmOf(final VType a, VType b) { return Alarm.highestAlarmOf(java.util.List.of(a, b), false); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, f... | VTypeHelper { public static Alarm highestAlarmOf(final VType a, VType b) { return Alarm.highestAlarmOf(java.util.List.of(a, b), false); } final static double toDouble(final VType value); static double[] toDoubles(final VType value); static String toString(final VType value); static double toDouble(final VType value, f... |
@Test public void testFormatArrayNumbersArrayZeroLength(){ ListInteger listInteger = ArrayInteger.of(); Array array = VNumberArray.of(listInteger, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VIntArray", string); } | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatArrayZeroMax(){ ListInteger listInteger = ArrayInteger.of(1, 2, 3, 4, 5); Array array = VNumberArray.of(listInteger, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 0); assertEquals("VIntArray", string); } | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatArrayNegativeMax(){ ListInteger listInteger = ArrayInteger.of(1, 2, 3, 4, 5); Array array = VNumberArray.of(listInteger, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, -1); assertEquals("VIntArray[1, 2, 3, 4, 5]", string); } | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatArrayWithSizes(){ ListInteger sizes = ArrayInteger.of(2, 3); ListInteger listInteger = ArrayInteger.of(11, 12, 21, 22, 31, 32); Array array = VNumberArray.of(listInteger, sizes, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VIntAr... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatIntArray(){ ListInteger listInteger = ArrayInteger.of(-1, 2, 3, 4, 5); Array array = VIntArray.of(listInteger, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VIntArray[-1, 2, 3,...", string); string = VTypeHelper.formatArray(array,... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatLongArray(){ ListLong list = ArrayLong.of(-1L, 2L, 3L, 4L, 5L); Array array = VLongArray.of(list, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VLongArray[-1, 2, 3,...", string); string = VTypeHelper.formatArray(array, 10); assert... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatShortArray(){ ListShort list = ArrayShort.of((short)-1, (short)2, (short)3, (short)4, (short)5); Array array = VShortArray.of(list, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VShortArray[-1, 2, 3,...", string); string = VTypeHe... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatByteArray(){ ListByte list = ArrayByte.of((byte)-1, (byte)2, (byte)3, (byte)4, (byte)5); Array array = VByteArray.of(list, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VByteArray[-1, 2, 3,...", string); string = VTypeHelper.forma... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatBooleanArray(){ ListBoolean list = ArrayBoolean.of(true, true, false, false ,false); Array array = VBooleanArray.of(list, Alarm.none(), Time.now()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VBooleanArray[true, true, false,...", string); string = VTypeHelper.formatArra... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testGetArrayValueString() { VNumberArray vNumberArray = VByteArray.of(CollectionNumbers.toListByte((byte) 1, (byte) 2), alarm, time, display); assertEquals("[1,2]", SnapshotDataConverter.getNumberArrayValueString(vNumberArray)); vNumberArray = VUByteArray.of(CollectionNumbers.toListUByte((byte) 1, (by... | protected static String getNumberArrayValueString(VNumberArray vNumberArray) { List<Object> valueList = new ArrayList<>(); if(vNumberArray instanceof VByteArray || vNumberArray instanceof VUByteArray || vNumberArray instanceof VShortArray || vNumberArray instanceof VUShortArray || vNumberArray instanceof VIntArray || v... | SnapshotDataConverter { protected static String getNumberArrayValueString(VNumberArray vNumberArray) { List<Object> valueList = new ArrayList<>(); if(vNumberArray instanceof VByteArray || vNumberArray instanceof VUByteArray || vNumberArray instanceof VShortArray || vNumberArray instanceof VUShortArray || vNumberArray i... | SnapshotDataConverter { protected static String getNumberArrayValueString(VNumberArray vNumberArray) { List<Object> valueList = new ArrayList<>(); if(vNumberArray instanceof VByteArray || vNumberArray instanceof VUByteArray || vNumberArray instanceof VShortArray || vNumberArray instanceof VUShortArray || vNumberArray i... | SnapshotDataConverter { protected static String getNumberArrayValueString(VNumberArray vNumberArray) { List<Object> valueList = new ArrayList<>(); if(vNumberArray instanceof VByteArray || vNumberArray instanceof VUByteArray || vNumberArray instanceof VShortArray || vNumberArray instanceof VUShortArray || vNumberArray i... | SnapshotDataConverter { protected static String getNumberArrayValueString(VNumberArray vNumberArray) { List<Object> valueList = new ArrayList<>(); if(vNumberArray instanceof VByteArray || vNumberArray instanceof VUByteArray || vNumberArray instanceof VShortArray || vNumberArray instanceof VUShortArray || vNumberArray i... |
@Test public void testFormatDoubleArray(){ ListDouble list = ArrayDouble.of(-1d, 0.27, 3.0f, 4.0f, 5.0f); Array array = VDoubleArray.of(list, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VDoubleArray[-1.0, 0.27, 3.0,...", string); string = VTypeHelper.forma... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatFloatArray(){ ListFloat list = ArrayFloat.of(-1f, 0.27f, 3.0f, 4.0f, 5.0f); Array array = VDoubleArray.of(list, Alarm.none(), Time.now(), Display.none()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VFloatArray[-1.0, 0.27, 3.0,...", string); string = VTypeHelper.formatAr... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatStringArray(){ Array array = VStringArray.of(Arrays.asList("a", "b", "c", "d", "e"), Alarm.none(), Time.now()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VStringArray[a, b, c,...", string); string = VTypeHelper.formatArray(array, 10); assertEquals("VStringArray[a, b, c... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testFormatEnumArray(){ ListInteger listInteger = ArrayInteger.of(0, 1, 2, 3, 4); Array array = VEnumArray.of(listInteger, EnumDisplay.of("a", "b", "c", "d", "e"), Alarm.none(), Time.now()); String string = VTypeHelper.formatArray(array, 3); assertEquals("VEnumArray[a, b, c,...", string); string = VTyp... | public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toString(); } Lis... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... | VTypeHelper { public static String formatArray(Array array, int maxElements) { StringBuilder builder = new StringBuilder(); builder.append(VType.typeOf(array).getSimpleName()); if (maxElements < 0) { builder.append(array.getData().toString()); return builder.toString(); } else if (maxElements == 0) { return builder.toS... |
@Test public void testGetDimensionString() { VNumberArray vNumberArray = VIntArray.of(CollectionNumbers.toListInt(1, 2, 3, 4, 5, 6), CollectionNumbers.toListInt(1, 2, 3), alarm, time, display); vNumberArray.getSizes(); assertEquals("[1,2,3]", SnapshotDataConverter.getDimensionString(vNumberArray)); vNumberArray = VIntA... | protected static String getDimensionString(VNumberArray vNumberArray) { ListInteger sizes = vNumberArray.getSizes(); List<Integer> sizesAsIntList = new ArrayList<>(); for(int i = 0; i < sizes.size(); i++) { sizesAsIntList.add(sizes.getInt(i)); } ObjectMapper objectMapper = new ObjectMapper(); try { return objectMapper.... | SnapshotDataConverter { protected static String getDimensionString(VNumberArray vNumberArray) { ListInteger sizes = vNumberArray.getSizes(); List<Integer> sizesAsIntList = new ArrayList<>(); for(int i = 0; i < sizes.size(); i++) { sizesAsIntList.add(sizes.getInt(i)); } ObjectMapper objectMapper = new ObjectMapper(); tr... | SnapshotDataConverter { protected static String getDimensionString(VNumberArray vNumberArray) { ListInteger sizes = vNumberArray.getSizes(); List<Integer> sizesAsIntList = new ArrayList<>(); for(int i = 0; i < sizes.size(); i++) { sizesAsIntList.add(sizes.getInt(i)); } ObjectMapper objectMapper = new ObjectMapper(); tr... | SnapshotDataConverter { protected static String getDimensionString(VNumberArray vNumberArray) { ListInteger sizes = vNumberArray.getSizes(); List<Integer> sizesAsIntList = new ArrayList<>(); for(int i = 0; i < sizes.size(); i++) { sizesAsIntList.add(sizes.getInt(i)); } ObjectMapper objectMapper = new ObjectMapper(); tr... | SnapshotDataConverter { protected static String getDimensionString(VNumberArray vNumberArray) { ListInteger sizes = vNumberArray.getSizes(); List<Integer> sizesAsIntList = new ArrayList<>(); for(int i = 0; i < sizes.size(); i++) { sizesAsIntList.add(sizes.getInt(i)); } ObjectMapper objectMapper = new ObjectMapper(); tr... |
@Test public void testDesrializeSizes() { ListInteger sizes = SnapshotDataConverter.toSizes(SnapshotPv.builder().sizes("[1,2]").build()); assertEquals(2, sizes.size()); assertEquals(1, sizes.getInt(0)); } | protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.format("Unable to conver... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... |
@Test(expected = PVConversionException.class) public void testDeserializeBadSizes() { SnapshotDataConverter.toSizes(SnapshotPv.builder().sizes("[1,2").build()); } | protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.format("Unable to conver... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... | SnapshotDataConverter { protected static ListInteger toSizes(SnapshotPv snapshotPv) { ObjectMapper objectMapper = new ObjectMapper(); try { int[] sizes = objectMapper.readValue(snapshotPv.getSizes(), int[].class); return CollectionNumbers.toListInt(sizes); } catch (Exception e) { throw new PVConversionException(String.... |
@Test(expected = IllegalArgumentException.class) public void testCreateConfigurationNoParent() { services.createNode("x", configFromClient); } | @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id=%s does not exist.", parentsUni... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... |
@Test public void testToVType() { SnapshotPv snapshotPv = SnapshotPv.builder().alarmName("name").alarmStatus(AlarmStatus.NONE) .alarmSeverity(AlarmSeverity.NONE).dataType(SnapshotPvDataType.BYTE) .sizes(SnapshotDataConverter.SCALAR_AS_JSON).time(1000L).timens(7000).value("[1]").build(); VByte vByte = (VByte) SnapshotDa... | public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Time time = toTime(snapshot... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... |
@Test public void jsonTest() throws Exception { VLongArray vIntArray = VLongArray.of(new ArrayLong(CollectionNumbers.toListLong(-1, 2, 3)), alarm, time, display); String json1 = org.epics.vtype.json.VTypeToJson.toJson(vIntArray).toString(); VULongArray vULongArray = VULongArray.of(new ArrayULong(CollectionNumbers.toLis... | public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Time time = toTime(snapshot... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... | SnapshotDataConverter { public static VType toVType(SnapshotPv snapshotPv) { if(snapshotPv.getValue() == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); boolean isScalar = SCALAR_AS_JSON.equals(snapshotPv.getSizes()); ListInteger sizes = toSizes(snapshotPv); Alarm alarm = toAlarm(snapshotPv); Tim... |
@Test public void testFromSnapshotPv() { SnapshotPv snapshotPv = SnapshotPv.builder().alarmName("name").alarmSeverity(AlarmSeverity.NONE).alarmStatus(AlarmStatus.NONE) .snapshotId(2).dataType(SnapshotPvDataType.LONG).time(1000L).timens(7000).value("[1]").sizes("[1]").configPv(ConfigPv.builder().id(1).build()).build(); ... | public static SnapshotItem fromSnapshotPv(SnapshotPv snapshotPv, SnapshotPv readback) { if(snapshotPv == null) { return null; } SnapshotItem snapshotItem = SnapshotItem.builder() .configPv(snapshotPv.getConfigPv()) .snapshotId(snapshotPv.getSnapshotId()) .build(); if(snapshotPv.getValue() != null) { snapshotItem.setVal... | SnapshotDataConverter { public static SnapshotItem fromSnapshotPv(SnapshotPv snapshotPv, SnapshotPv readback) { if(snapshotPv == null) { return null; } SnapshotItem snapshotItem = SnapshotItem.builder() .configPv(snapshotPv.getConfigPv()) .snapshotId(snapshotPv.getSnapshotId()) .build(); if(snapshotPv.getValue() != nul... | SnapshotDataConverter { public static SnapshotItem fromSnapshotPv(SnapshotPv snapshotPv, SnapshotPv readback) { if(snapshotPv == null) { return null; } SnapshotItem snapshotItem = SnapshotItem.builder() .configPv(snapshotPv.getConfigPv()) .snapshotId(snapshotPv.getSnapshotId()) .build(); if(snapshotPv.getValue() != nul... | SnapshotDataConverter { public static SnapshotItem fromSnapshotPv(SnapshotPv snapshotPv, SnapshotPv readback) { if(snapshotPv == null) { return null; } SnapshotItem snapshotItem = SnapshotItem.builder() .configPv(snapshotPv.getConfigPv()) .snapshotId(snapshotPv.getSnapshotId()) .build(); if(snapshotPv.getValue() != nul... | SnapshotDataConverter { public static SnapshotItem fromSnapshotPv(SnapshotPv snapshotPv, SnapshotPv readback) { if(snapshotPv == null) { return null; } SnapshotItem snapshotItem = SnapshotItem.builder() .configPv(snapshotPv.getConfigPv()) .snapshotId(snapshotPv.getSnapshotId()) .build(); if(snapshotPv.getValue() != nul... |
@Test public void testRowMapper() throws Exception { ResultSet resultSet = Mockito.mock(ResultSet.class); when(resultSet.getInt("id")).thenReturn(1); when(resultSet.getString("name")).thenReturn("name"); when(resultSet.getTimestamp("created")).thenReturn(new Timestamp(System.currentTimeMillis())); when(resultSet.getTim... | @Override public Node mapRow(ResultSet resultSet, int rowIndex) throws SQLException { return Node.builder() .id(resultSet.getInt("id")) .nodeType(NodeType.valueOf(resultSet.getString("type"))) .created(resultSet.getTimestamp("created")) .lastModified(resultSet.getTimestamp("last_modified")) .name(resultSet.getString("n... | NodeRowMapper implements RowMapper<Node> { @Override public Node mapRow(ResultSet resultSet, int rowIndex) throws SQLException { return Node.builder() .id(resultSet.getInt("id")) .nodeType(NodeType.valueOf(resultSet.getString("type"))) .created(resultSet.getTimestamp("created")) .lastModified(resultSet.getTimestamp("la... | NodeRowMapper implements RowMapper<Node> { @Override public Node mapRow(ResultSet resultSet, int rowIndex) throws SQLException { return Node.builder() .id(resultSet.getInt("id")) .nodeType(NodeType.valueOf(resultSet.getString("type"))) .created(resultSet.getTimestamp("created")) .lastModified(resultSet.getTimestamp("la... | NodeRowMapper implements RowMapper<Node> { @Override public Node mapRow(ResultSet resultSet, int rowIndex) throws SQLException { return Node.builder() .id(resultSet.getInt("id")) .nodeType(NodeType.valueOf(resultSet.getString("type"))) .created(resultSet.getTimestamp("created")) .lastModified(resultSet.getTimestamp("la... | NodeRowMapper implements RowMapper<Node> { @Override public Node mapRow(ResultSet resultSet, int rowIndex) throws SQLException { return Node.builder() .id(resultSet.getInt("id")) .nodeType(NodeType.valueOf(resultSet.getString("type"))) .created(resultSet.getTimestamp("created")) .lastModified(resultSet.getTimestamp("la... |
@Test public void testSnapshotPvRowMapperNullReadback() throws Exception{ ResultSet resultSet = Mockito.mock(ResultSet.class); when(resultSet.getInt("snapshot_node_id")).thenReturn(1); when(resultSet.getBoolean("fetch_status")).thenReturn(true); when(resultSet.getString("severity")).thenReturn("NONE"); when(resultSet.g... | @Override public SnapshotPv mapRow(ResultSet resultSet, int rowIndex) throws SQLException { ConfigPv configPv = new ConfigPvRowMapper().mapRow(resultSet, rowIndex); return SnapshotPv.builder() .configPv(configPv) .snapshotId(resultSet.getInt("snapshot_node_id")) .alarmSeverity(resultSet.getString("severity") == null ? ... | SnapshotPvRowMapper implements RowMapper<SnapshotPv> { @Override public SnapshotPv mapRow(ResultSet resultSet, int rowIndex) throws SQLException { ConfigPv configPv = new ConfigPvRowMapper().mapRow(resultSet, rowIndex); return SnapshotPv.builder() .configPv(configPv) .snapshotId(resultSet.getInt("snapshot_node_id")) .a... | SnapshotPvRowMapper implements RowMapper<SnapshotPv> { @Override public SnapshotPv mapRow(ResultSet resultSet, int rowIndex) throws SQLException { ConfigPv configPv = new ConfigPvRowMapper().mapRow(resultSet, rowIndex); return SnapshotPv.builder() .configPv(configPv) .snapshotId(resultSet.getInt("snapshot_node_id")) .a... | SnapshotPvRowMapper implements RowMapper<SnapshotPv> { @Override public SnapshotPv mapRow(ResultSet resultSet, int rowIndex) throws SQLException { ConfigPv configPv = new ConfigPvRowMapper().mapRow(resultSet, rowIndex); return SnapshotPv.builder() .configPv(configPv) .snapshotId(resultSet.getInt("snapshot_node_id")) .a... | SnapshotPvRowMapper implements RowMapper<SnapshotPv> { @Override public SnapshotPv mapRow(ResultSet resultSet, int rowIndex) throws SQLException { ConfigPv configPv = new ConfigPvRowMapper().mapRow(resultSet, rowIndex); return SnapshotPv.builder() .configPv(configPv) .snapshotId(resultSet.getInt("snapshot_node_id")) .a... |
@Test public void testGetSnapshot() throws Exception{ Mockito.reset(services); when(services.getSnapshot("b")).thenReturn(snapshot); MockHttpServletRequestBuilder request = get("/snapshot/b"); MvcResult result = mockMvc.perform(request).andExpect(status().isOk()).andExpect(content().contentType(JSON)) .andReturn(); obj... | @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... |
@Test public void testGetNonExistingSnapshot() throws Exception{ when(services.getSnapshot("c")).thenThrow(new SnapshotNotFoundException("askdmdsf")); MockHttpServletRequestBuilder request = get("/snapshot/c"); mockMvc.perform(request).andExpect(status().isNotFound()); } | @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... |
@Test public void testNonExistingSnapshot() throws Exception{ when(services.getSnapshot("x")).thenThrow(new SnapshotNotFoundException("lasdfk")); MockHttpServletRequestBuilder request = get("/snapshot/x").contentType(JSON); mockMvc.perform(request).andExpect(status().isNotFound()); } | @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}") public Node getSnapshot(@PathVariable String uniqueNodeId) { return services.getSnapshot(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMapping("/snapshot/{uniqueNodeId... |
@Test public void testGetSnapshotItems() throws Exception{ SnapshotItem si = SnapshotItem.builder() .configPv(ConfigPv.builder().id(1).pvName("pvName").build()) .snapshotId(2) .build(); when(services.getSnapshotItems("si")).thenReturn(Arrays.asList(si)); MockHttpServletRequestBuilder request = get("/snapshot/si/items")... | @GetMapping("/snapshot/{uniqueNodeId}/items") public List<SnapshotItem> getSnapshotItems(@PathVariable String uniqueNodeId) { return services.getSnapshotItems(uniqueNodeId); } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}/items") public List<SnapshotItem> getSnapshotItems(@PathVariable String uniqueNodeId) { return services.getSnapshotItems(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}/items") public List<SnapshotItem> getSnapshotItems(@PathVariable String uniqueNodeId) { return services.getSnapshotItems(uniqueNodeId); } } | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}/items") public List<SnapshotItem> getSnapshotItems(@PathVariable String uniqueNodeId) { return services.getSnapshotItems(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMa... | SnapshotController extends BaseController { @GetMapping("/snapshot/{uniqueNodeId}/items") public List<SnapshotItem> getSnapshotItems(@PathVariable String uniqueNodeId) { return services.getSnapshotItems(uniqueNodeId); } @GetMapping("/snapshot/{uniqueNodeId}") Node getSnapshot(@PathVariable String uniqueNodeId); @GetMa... |
@Test public void testSaveSnapshot() throws Exception{ Mockito.reset(services); List<SnapshotItem> snapshotItems = Arrays.asList(SnapshotItem.builder().build()); when(services.saveSnapshot(Mockito.anyString(), Mockito.argThat(new ArgumentMatcher<List<SnapshotItem>>() { @Override public boolean matches(List<SnapshotItem... | @PutMapping("/snapshot/{configUniqueId}") public Node saveSnapshot(@PathVariable String configUniqueId, @RequestParam(required = true) String snapshotName, @RequestParam(required = true) String userName, @RequestParam(required = true) String comment, @RequestBody(required = true) List<SnapshotItem> snapshotItems) { if(... | SnapshotController extends BaseController { @PutMapping("/snapshot/{configUniqueId}") public Node saveSnapshot(@PathVariable String configUniqueId, @RequestParam(required = true) String snapshotName, @RequestParam(required = true) String userName, @RequestParam(required = true) String comment, @RequestBody(required = t... | SnapshotController extends BaseController { @PutMapping("/snapshot/{configUniqueId}") public Node saveSnapshot(@PathVariable String configUniqueId, @RequestParam(required = true) String snapshotName, @RequestParam(required = true) String userName, @RequestParam(required = true) String comment, @RequestBody(required = t... | SnapshotController extends BaseController { @PutMapping("/snapshot/{configUniqueId}") public Node saveSnapshot(@PathVariable String configUniqueId, @RequestParam(required = true) String snapshotName, @RequestParam(required = true) String userName, @RequestParam(required = true) String comment, @RequestBody(required = t... | SnapshotController extends BaseController { @PutMapping("/snapshot/{configUniqueId}") public Node saveSnapshot(@PathVariable String configUniqueId, @RequestParam(required = true) String snapshotName, @RequestParam(required = true) String userName, @RequestParam(required = true) String comment, @RequestBody(required = t... |
@Test public void testGetConfigNotNull() { when(nodeDAO.getNode("a")).thenReturn(configFromClient); Node config = services.getNode("a"); assertEquals(1, config.getId()); } | @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Ove... | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Ove... |
@Test public void testGetRootNode() throws Exception { when(services.getRootNode()).thenReturn(rootNode); MockHttpServletRequestBuilder request = get("/root").contentType(JSON); MvcResult result = mockMvc.perform(request).andExpect(status().isOk()).andExpect(content().contentType(JSON)) .andReturn(); String s = result.... | @GetMapping("/root") public Node getRootNode() { return services.getRootNode(); } | ConfigurationController extends BaseController { @GetMapping("/root") public Node getRootNode() { return services.getRootNode(); } } | ConfigurationController extends BaseController { @GetMapping("/root") public Node getRootNode() { return services.getRootNode(); } } | ConfigurationController extends BaseController { @GetMapping("/root") public Node getRootNode() { return services.getRootNode(); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMapping("/node/{uniqueNodeId}") Node getNode(@PathVariable f... | ConfigurationController extends BaseController { @GetMapping("/root") public Node getRootNode() { return services.getRootNode(); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMapping("/node/{uniqueNodeId}") Node getNode(@PathVariable f... |
@Test public void testCreateFolder() throws Exception { when(services.createNode("p", folderFromClient)).thenReturn(folderFromClient); MockHttpServletRequestBuilder request = put("/node/p").contentType(JSON) .content(objectMapper.writeValueAsString(folderFromClient)); MvcResult result = mockMvc.perform(request).andExpe... | @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-zero length"); } if(node.getName() == null || nod... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... |
@Test public void testCreateFolderParentIdDoesNotExist() throws Exception { when(services.createNode("p", folderFromClient)) .thenThrow(new IllegalArgumentException("Parent folder does not exist")); MockHttpServletRequestBuilder request = put("/node/p").contentType(JSON) .content(objectMapper.writeValueAsString(folderF... | @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-zero length"); } if(node.getName() == null || nod... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... |
@Test public void testCreateConfig() throws Exception { reset(services); Node config = Node.builder().nodeType(NodeType.CONFIGURATION).name("config").uniqueId("hhh") .userName("user").build(); when(services.createNode("p", config)).thenAnswer(new Answer<Node>() { public Node answer(InvocationOnMock invocation) throws T... | @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-zero length"); } if(node.getName() == null || nod... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... | ConfigurationController extends BaseController { @PutMapping("/node/{parentsUniqueId}") public Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node) { if(node.getUserName() == null || node.getUserName().isEmpty()) { throw new IllegalArgumentException("User name must be non-null and of non-... |
@Test public void testGetChildNodes() throws Exception{ reset(services); when(services.getChildNodes("p")).thenAnswer(new Answer<List<Node>>() { public List<Node> answer(InvocationOnMock invocation) throws Throwable { return Arrays.asList(config1); } }); MockHttpServletRequestBuilder request = get("/node/p/children").c... | @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBo... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBo... |
@Test public void testGetChildNodesNonExistingNode() throws Exception{ reset(services); when(services.getChildNodes("non-existing")).thenThrow(NodeNotFoundException.class); MockHttpServletRequestBuilder request = get("/node/non-existing/children").contentType(JSON); mockMvc.perform(request).andExpect(status().isNotFoun... | @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBo... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}/children") public List<Node> getChildNodes(@PathVariable final String uniqueNodeId) { return services.getChildNodes(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBo... |
@Test public void testGetNonExistingConfig() throws Exception { when(services.getNode("x")).thenThrow(new NodeNotFoundException("lasdfk")); MockHttpServletRequestBuilder request = get("/node/x").contentType(JSON); mockMvc.perform(request).andExpect(status().isNotFound()); } | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testGetSnapshots() throws Exception { when(services.getSnapshots("s")).thenReturn(Arrays.asList(snapshot)); MockHttpServletRequestBuilder request = get("/config/s/snapshots").contentType(JSON); MvcResult result = mockMvc.perform(request).andExpect(status().isOk()).andExpect(content().contentType(JSON)... | @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... |
@Test public void testGetSnapshotsForNonExistingConfig() throws Exception { when(services.getSnapshots("x")).thenThrow(new NodeNotFoundException("lasdfk")); MockHttpServletRequestBuilder request = get("/config/x/snapshots").contentType(JSON); mockMvc.perform(request).andExpect(status().isNotFound()); } | @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/snapshots") public List<Node> getSnapshots(@PathVariable String uniqueNodeId) { return services.getSnapshots(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... |
@Test public void testDeleteFolder() throws Exception { MockHttpServletRequestBuilder request = delete("/node/a"); mockMvc.perform(request).andExpect(status().isOk()); doThrow(new IllegalArgumentException()).when(services).deleteNode("a"); request = delete("/node/a"); mockMvc.perform(request).andExpect(status().isBadRe... | @DeleteMapping("/node/{uniqueNodeId}") public void deleteNode(@PathVariable final String uniqueNodeId) { services.deleteNode(uniqueNodeId); } | ConfigurationController extends BaseController { @DeleteMapping("/node/{uniqueNodeId}") public void deleteNode(@PathVariable final String uniqueNodeId) { services.deleteNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @DeleteMapping("/node/{uniqueNodeId}") public void deleteNode(@PathVariable final String uniqueNodeId) { services.deleteNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @DeleteMapping("/node/{uniqueNodeId}") public void deleteNode(@PathVariable final String uniqueNodeId) { services.deleteNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @Get... | ConfigurationController extends BaseController { @DeleteMapping("/node/{uniqueNodeId}") public void deleteNode(@PathVariable final String uniqueNodeId) { services.deleteNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @Get... |
@Test public void testGetSnapshots() { services.getSnapshots(anyString()); verify(nodeDAO, times(1)).getSnapshots(anyString()); reset(nodeDAO); } | @Override public List<Node> getSnapshots(String configUniqueId) { logger.info("Obtaining snapshot for config id={}", configUniqueId); return nodeDAO.getSnapshots(configUniqueId); } | Services implements IServices { @Override public List<Node> getSnapshots(String configUniqueId) { logger.info("Obtaining snapshot for config id={}", configUniqueId); return nodeDAO.getSnapshots(configUniqueId); } } | Services implements IServices { @Override public List<Node> getSnapshots(String configUniqueId) { logger.info("Obtaining snapshot for config id={}", configUniqueId); return nodeDAO.getSnapshots(configUniqueId); } } | Services implements IServices { @Override public List<Node> getSnapshots(String configUniqueId) { logger.info("Obtaining snapshot for config id={}", configUniqueId); return nodeDAO.getSnapshots(configUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId... | Services implements IServices { @Override public List<Node> getSnapshots(String configUniqueId) { logger.info("Obtaining snapshot for config id={}", configUniqueId); return nodeDAO.getSnapshots(configUniqueId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId... |
@Test public void testGetFolder() throws Exception { when(services.getNode("q")).thenReturn(Node.builder().id(1).uniqueId("q").build()); MockHttpServletRequestBuilder request = get("/node/q"); MvcResult result = mockMvc.perform(request).andExpect(status().isOk()).andExpect(content().contentType(JSON)) .andReturn(); obj... | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testGetConfiguration() throws Exception { Mockito.reset(services); when(services.getNode("a")).thenReturn(Node.builder().build()); MockHttpServletRequestBuilder request = get("/node/a"); MvcResult result = mockMvc.perform(request).andExpect(status().isOk()).andExpect(content().contentType(JSON)) .andR... | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testGetNonExistingConfiguration() throws Exception { Mockito.reset(services); when(services.getNode("a")).thenThrow(NodeNotFoundException.class); MockHttpServletRequestBuilder request = get("/node/a"); mockMvc.perform(request).andExpect(status().isNotFound()); } | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testGetNonExistingFolder() throws Exception { Mockito.reset(services); when(services.getNode("a")).thenThrow(NodeNotFoundException.class); MockHttpServletRequestBuilder request = get("/node/a"); mockMvc.perform(request).andExpect(status().isNotFound()); when(services.getNode("b")).thenThrow(IllegalArg... | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testMoveNode() throws Exception { when(services.moveNode("a", "b", "username")).thenReturn(Node.builder().id(2).uniqueId("a").build()); MockHttpServletRequestBuilder request = post("/node/a").param("to", "b").param("username", "username"); MvcResult result = mockMvc.perform(request).andExpect(status()... | @PostMapping("/node/{uniqueNodeId}") public Node moveNode(@PathVariable String uniqueNodeId, @RequestParam(value = "to", required = true) String to, @RequestParam(value = "username", required = true) String userName) { return services.moveNode(uniqueNodeId, to, userName); } | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}") public Node moveNode(@PathVariable String uniqueNodeId, @RequestParam(value = "to", required = true) String to, @RequestParam(value = "username", required = true) String userName) { return services.moveNode(uniqueNodeId, to, userName)... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}") public Node moveNode(@PathVariable String uniqueNodeId, @RequestParam(value = "to", required = true) String to, @RequestParam(value = "username", required = true) String userName) { return services.moveNode(uniqueNodeId, to, userName)... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}") public Node moveNode(@PathVariable String uniqueNodeId, @RequestParam(value = "to", required = true) String to, @RequestParam(value = "username", required = true) String userName) { return services.moveNode(uniqueNodeId, to, userName)... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}") public Node moveNode(@PathVariable String uniqueNodeId, @RequestParam(value = "to", required = true) String to, @RequestParam(value = "username", required = true) String userName) { return services.moveNode(uniqueNodeId, to, userName)... |
@Test public void testUpdateConfig() throws Exception { Node config = Node.builder().nodeType(NodeType.CONFIGURATION).userName("myusername").id(0).build(); List<ConfigPv> configPvList = Arrays.asList(ConfigPv.builder().id(1).pvName("name").build()); UpdateConfigHolder holder = UpdateConfigHolder.builder().config(config... | @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot update a null configuration"); } else if(updateCo... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... |
@Test public void testUpdateConfigBadConfigPv() throws Exception { Node config = Node.builder().nodeType(NodeType.CONFIGURATION).id(0).build(); UpdateConfigHolder holder = UpdateConfigHolder.builder().build(); MockHttpServletRequestBuilder request = post("/config/a/update").contentType(JSON) .content(objectMapper.write... | @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot update a null configuration"); } else if(updateCo... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... | ConfigurationController extends BaseController { @PostMapping("/config/{uniqueNodeId}/update") public ResponseEntity<Node> updateConfiguration(@PathVariable String uniqueNodeId, @RequestBody UpdateConfigHolder updateConfigHolder) { if(updateConfigHolder.getConfig() == null) { throw new IllegalArgumentException("Cannot ... |
@Test public void testGetFolderIllegalArgument() throws Exception { when(services.getNode("a")).thenThrow(IllegalArgumentException.class); MockHttpServletRequestBuilder request = get("/node/a"); mockMvc.perform(request).andExpect(status().isBadRequest()); } | @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... | ConfigurationController extends BaseController { @GetMapping("/node/{uniqueNodeId}") public Node getNode(@PathVariable final String uniqueNodeId) { return services.getNode(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody final Node node); @GetMa... |
@Test public void testUpdateNode() throws Exception { Node node = Node.builder().name("foo").uniqueId("a").build(); when(services.updateNode(node, false)).thenReturn(node); MockHttpServletRequestBuilder request = post("/node/a/update") .param("customTimeForMigration", "false") .contentType(JSON) .content(objectMapper.w... | @PostMapping("/node/{uniqueNodeId}/update") public Node updateNode(@PathVariable String uniqueNodeId, @RequestParam(value = "customTimeForMigration", required = true) String customTimeForMigration, @RequestBody Node nodeToUpdate) { return services.updateNode(nodeToUpdate, Boolean.valueOf(customTimeForMigration)); } | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}/update") public Node updateNode(@PathVariable String uniqueNodeId, @RequestParam(value = "customTimeForMigration", required = true) String customTimeForMigration, @RequestBody Node nodeToUpdate) { return services.updateNode(nodeToUpdate... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}/update") public Node updateNode(@PathVariable String uniqueNodeId, @RequestParam(value = "customTimeForMigration", required = true) String customTimeForMigration, @RequestBody Node nodeToUpdate) { return services.updateNode(nodeToUpdate... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}/update") public Node updateNode(@PathVariable String uniqueNodeId, @RequestParam(value = "customTimeForMigration", required = true) String customTimeForMigration, @RequestBody Node nodeToUpdate) { return services.updateNode(nodeToUpdate... | ConfigurationController extends BaseController { @PostMapping("/node/{uniqueNodeId}/update") public Node updateNode(@PathVariable String uniqueNodeId, @RequestParam(value = "customTimeForMigration", required = true) String customTimeForMigration, @RequestBody Node nodeToUpdate) { return services.updateNode(nodeToUpdate... |
@Test public void testGetConfigPvs() throws Exception{ ConfigPv configPv = ConfigPv.builder() .id(1) .pvName("pvname") .build(); when(services.getConfigPvs("cpv")).thenReturn(Arrays.asList(configPv)); MockHttpServletRequestBuilder request = get("/config/cpv/items"); MvcResult result = mockMvc.perform(request).andExpect... | @GetMapping("/config/{uniqueNodeId}/items") public List<ConfigPv> getConfigPvs(@PathVariable String uniqueNodeId) { return services.getConfigPvs(uniqueNodeId); } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/items") public List<ConfigPv> getConfigPvs(@PathVariable String uniqueNodeId) { return services.getConfigPvs(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/items") public List<ConfigPv> getConfigPvs(@PathVariable String uniqueNodeId) { return services.getConfigPvs(uniqueNodeId); } } | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/items") public List<ConfigPv> getConfigPvs(@PathVariable String uniqueNodeId) { return services.getConfigPvs(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... | ConfigurationController extends BaseController { @GetMapping("/config/{uniqueNodeId}/items") public List<ConfigPv> getConfigPvs(@PathVariable String uniqueNodeId) { return services.getConfigPvs(uniqueNodeId); } @PutMapping("/node/{parentsUniqueId}") Node createNode(@PathVariable String parentsUniqueId, @RequestBody fi... |
@Test public void testGetSnapshotNotFound() { when(nodeDAO.getSnapshot("s")).thenReturn(null); try { services.getSnapshot("s"); fail("Exception expected here"); } catch (Exception e) { } reset(nodeDAO); } | @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(message); } logger.info("Retrieved sna... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... |
@Test public void testGetFromPath() throws Exception{ when(services.getFromPath("/a/b/c")).thenReturn(null); MockHttpServletRequestBuilder request = get("/path?path=/a/b/c"); mockMvc.perform(request).andExpect(status().isNotFound()); request = get("/path"); mockMvc.perform(request).andExpect(status().isBadRequest()); N... | @GetMapping("/path") public List<Node> getFromPath(@RequestParam(value = "path") String path){ List<Node> nodes = services.getFromPath(path); if(nodes == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return nodes; } | ConfigurationController extends BaseController { @GetMapping("/path") public List<Node> getFromPath(@RequestParam(value = "path") String path){ List<Node> nodes = services.getFromPath(path); if(nodes == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return nodes; } } | ConfigurationController extends BaseController { @GetMapping("/path") public List<Node> getFromPath(@RequestParam(value = "path") String path){ List<Node> nodes = services.getFromPath(path); if(nodes == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return nodes; } } | ConfigurationController extends BaseController { @GetMapping("/path") public List<Node> getFromPath(@RequestParam(value = "path") String path){ List<Node> nodes = services.getFromPath(path); if(nodes == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return nodes; } @PutMapping("/node/{parentsUniqueI... | ConfigurationController extends BaseController { @GetMapping("/path") public List<Node> getFromPath(@RequestParam(value = "path") String path){ List<Node> nodes = services.getFromPath(path); if(nodes == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return nodes; } @PutMapping("/node/{parentsUniqueI... |
@Test public void testGetFullPath() throws Exception{ when(services.getFullPath("nonexisting")).thenReturn(null); MockHttpServletRequestBuilder request = get("/path/nonexsiting"); mockMvc.perform(request).andExpect(status().isNotFound()); when(services.getFullPath("existing")).thenReturn("/a/b/c"); request = get("/path... | @GetMapping("/path/{uniqueNodeId}") public String getFullPath(@PathVariable String uniqueNodeId){ String fullPath = services.getFullPath(uniqueNodeId); if(fullPath == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return fullPath; } | ConfigurationController extends BaseController { @GetMapping("/path/{uniqueNodeId}") public String getFullPath(@PathVariable String uniqueNodeId){ String fullPath = services.getFullPath(uniqueNodeId); if(fullPath == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return fullPath; } } | ConfigurationController extends BaseController { @GetMapping("/path/{uniqueNodeId}") public String getFullPath(@PathVariable String uniqueNodeId){ String fullPath = services.getFullPath(uniqueNodeId); if(fullPath == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return fullPath; } } | ConfigurationController extends BaseController { @GetMapping("/path/{uniqueNodeId}") public String getFullPath(@PathVariable String uniqueNodeId){ String fullPath = services.getFullPath(uniqueNodeId); if(fullPath == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return fullPath; } @PutMapping("/node... | ConfigurationController extends BaseController { @GetMapping("/path/{uniqueNodeId}") public String getFullPath(@PathVariable String uniqueNodeId){ String fullPath = services.getFullPath(uniqueNodeId); if(fullPath == null){ throw new ResponseStatusException(HttpStatus.NOT_FOUND); } return fullPath; } @PutMapping("/node... |
@Test public void decodeSeverity() { assertEquals(SeverityLevel.INVALID, SeverityLevelHelper.decodeSeverity(null)); VInt intValue = VInt.of(7, Alarm.disconnected(), Time.now(), Display.none()); SeverityLevel severityLevel = SeverityLevelHelper.decodeSeverity(intValue); assertEquals(SeverityLevel.INVALID, severityLevel)... | final public static SeverityLevel decodeSeverity(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm == null) return SeverityLevel.OK; switch (alarm.getSeverity()) { case NONE: return SeverityLevel.OK; case MINOR: return SeverityLevel.MINOR; case MAJOR: return SeverityLevel.MAJOR; case INVALID: ret... | SeverityLevelHelper { final public static SeverityLevel decodeSeverity(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm == null) return SeverityLevel.OK; switch (alarm.getSeverity()) { case NONE: return SeverityLevel.OK; case MINOR: return SeverityLevel.MINOR; case MAJOR: return SeverityLevel.MA... | SeverityLevelHelper { final public static SeverityLevel decodeSeverity(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm == null) return SeverityLevel.OK; switch (alarm.getSeverity()) { case NONE: return SeverityLevel.OK; case MINOR: return SeverityLevel.MINOR; case MAJOR: return SeverityLevel.MA... | SeverityLevelHelper { final public static SeverityLevel decodeSeverity(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm == null) return SeverityLevel.OK; switch (alarm.getSeverity()) { case NONE: return SeverityLevel.OK; case MINOR: return SeverityLevel.MINOR; case MAJOR: return SeverityLevel.MA... | SeverityLevelHelper { final public static SeverityLevel decodeSeverity(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm == null) return SeverityLevel.OK; switch (alarm.getSeverity()) { case NONE: return SeverityLevel.OK; case MINOR: return SeverityLevel.MINOR; case MAJOR: return SeverityLevel.MA... |
@Test public void getStatusMessage() { VInt intValue = VInt.of(7, Alarm.disconnected(), Time.now(), Display.none()); String statusMessage = SeverityLevelHelper.getStatusMessage(intValue); assertEquals("Disconnected", statusMessage); intValue = VInt.of(7, Alarm.none(), Time.now(), Display.none()); statusMessage = Severi... | final public static String getStatusMessage(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm != null) return alarm.getName(); return SeverityLevel.OK.toString(); } | SeverityLevelHelper { final public static String getStatusMessage(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm != null) return alarm.getName(); return SeverityLevel.OK.toString(); } } | SeverityLevelHelper { final public static String getStatusMessage(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm != null) return alarm.getName(); return SeverityLevel.OK.toString(); } } | SeverityLevelHelper { final public static String getStatusMessage(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm != null) return alarm.getName(); return SeverityLevel.OK.toString(); } final static SeverityLevel decodeSeverity(final VType value); final static String getStatusMessage(final VTyp... | SeverityLevelHelper { final public static String getStatusMessage(final VType value) { final Alarm alarm = Alarm.alarmOf(value); if (alarm != null) return alarm.getName(); return SeverityLevel.OK.toString(); } final static SeverityLevel decodeSeverity(final VType value); final static String getStatusMessage(final VTyp... |
@Test public void getValue() { VDouble vDouble = VDouble.of(7.7, Alarm.none(), Time.now(), Display.none()); PlotSample plotSample = new PlotSample(new AtomicInteger(0), "source", vDouble, "info"); double result = plotSample.getValue(); assertEquals(7.7, result, 0); VDoubleArray vDoubleArray = VDoubleArray.of(ArrayDoubl... | @Override public double getValue() { return org.phoebus.core.vtypes.VTypeHelper.toDouble(value, waveform_index.get()); } | PlotSample implements PlotDataItem<Instant> { @Override public double getValue() { return org.phoebus.core.vtypes.VTypeHelper.toDouble(value, waveform_index.get()); } } | PlotSample implements PlotDataItem<Instant> { @Override public double getValue() { return org.phoebus.core.vtypes.VTypeHelper.toDouble(value, waveform_index.get()); } PlotSample(final AtomicInteger waveform_index, final String source, final VType value, final String info); PlotSample(final AtomicInteger waveform_ind... | PlotSample implements PlotDataItem<Instant> { @Override public double getValue() { return org.phoebus.core.vtypes.VTypeHelper.toDouble(value, waveform_index.get()); } PlotSample(final AtomicInteger waveform_index, final String source, final VType value, final String info); PlotSample(final AtomicInteger waveform_ind... | PlotSample implements PlotDataItem<Instant> { @Override public double getValue() { return org.phoebus.core.vtypes.VTypeHelper.toDouble(value, waveform_index.get()); } PlotSample(final AtomicInteger waveform_index, final String source, final VType value, final String info); PlotSample(final AtomicInteger waveform_ind... |
@Test public void testSingle() throws Exception { List<String> names = DroppedPVNameParser.parseDroppedPVs("SomePVName"); assertThat(names, equalTo(List.of("SomePVName"))); names = DroppedPVNameParser.parseDroppedPVs("loc: assertThat(names, equalTo(List.of("loc: names = DroppedPVNameParser.parseDroppedPVs("loc: assertT... | public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos < len) { final char c ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... |
@Test public void testNewline() throws Exception { List<String> names = DroppedPVNameParser.parseDroppedPVs("pv1\npv2"); assertThat(names, equalTo(List.of("pv1", "pv2"))); names = DroppedPVNameParser.parseDroppedPVs("pv1\r\npv2"); assertThat(names, equalTo(List.of("pv1", "pv2"))); names = DroppedPVNameParser.parseDropp... | public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos < len) { final char c ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... |
@Test public void testTab() throws Exception { List<String> names = DroppedPVNameParser.parseDroppedPVs("pv1\tpv2"); assertThat(names, equalTo(List.of("pv1", "pv2"))); names = DroppedPVNameParser.parseDroppedPVs(" pv1 \t pv2 \t pv3"); assertThat(names, equalTo(List.of("pv1", "pv2", "pv3"))); } | public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos < len) { final char c ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... |
@Test public void testComma() throws Exception { List<String> names = DroppedPVNameParser.parseDroppedPVs("pv1,pv2"); assertThat(names, equalTo(List.of("pv1", "pv2"))); names = DroppedPVNameParser.parseDroppedPVs(" pv1, pv2 , pv3"); assertThat(names, equalTo(List.of("pv1", "pv2", "pv3"))); names = DroppedPVNameParser.p... | public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos < len) { final char c ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... |
@Test public void testSpace() throws Exception { List<String> names = DroppedPVNameParser.parseDroppedPVs("pv1 pv2"); assertThat(names, equalTo(List.of("pv1", "pv2"))); names = DroppedPVNameParser.parseDroppedPVs("pv1 sim: assertThat(names, equalTo(List.of("pv1", "sim: names = DroppedPVNameParser.parseDroppedPVs(" pv1 ... | public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos < len) { final char c ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... | DroppedPVNameParser { public static List<String> parseDroppedPVs(String text) throws Exception { text = text.trim(); if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length()-2); final List<String> names = new ArrayList<>(); final int len = text.length(); int start = 0, pos = 0; while (pos ... |
@Test public void testGetSnapshot() { when(nodeDAO.getSnapshot("s")).thenReturn(mock(Node.class)); Node snapshot = services.getSnapshot("s"); assertNotNull(snapshot); reset(nodeDAO); } | @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(message); } logger.info("Retrieved sna... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... | Services implements IServices { @Override public Node getSnapshot(String snapshotUniqueId) { Node snapshot = nodeDAO.getSnapshot(snapshotUniqueId); if (snapshot == null) { String message = String.format("Snapshot with id=%s not found", snapshotUniqueId); logger.error(message); throw new SnapshotNotFoundException(messag... |
@Test public void testRoundUp() throws Exception { final Instant orig = Instant.from(TimestampFormats.SECONDS_FORMAT.parse("2012-01-19 12:23:14")); String text = TimestampFormats.SECONDS_FORMAT.format(orig); System.out.println(text); assertThat(text, equalTo("2012-01-19 12:23:14")); Instant time; time = TimestampHelper... | public static Instant roundUp(final Instant time, final Duration duration) { return roundUp(time, duration.getSeconds()); } | TimestampHelper { public static Instant roundUp(final Instant time, final Duration duration) { return roundUp(time, duration.getSeconds()); } } | TimestampHelper { public static Instant roundUp(final Instant time, final Duration duration) { return roundUp(time, duration.getSeconds()); } } | TimestampHelper { public static Instant roundUp(final Instant time, final Duration duration) { return roundUp(time, duration.getSeconds()); } static Instant roundUp(final Instant time, final Duration duration); static Instant roundUp(final Instant time, final long seconds); static Timestamp toSQLTimestamp(Instant star... | TimestampHelper { public static Instant roundUp(final Instant time, final Duration duration) { return roundUp(time, duration.getSeconds()); } static Instant roundUp(final Instant time, final Duration duration); static Instant roundUp(final Instant time, final long seconds); static Timestamp toSQLTimestamp(Instant star... |
@Test public void testConverter() throws Exception { EdmModel.reloadEdmColorFile("colors.list", getClass().getResourceAsStream("/colors.list")); final File edl = new File(getClass().getResource("/Maintenance_12hr.edl").getFile()); final EdmConverter converter = new EdmConverter(edl, null); final ByteArrayOutputStream b... | public DisplayModel getDisplayModel() { return model; } | EdmConverter { public DisplayModel getDisplayModel() { return model; } } | EdmConverter { public DisplayModel getDisplayModel() { return model; } EdmConverter(final File input, final AssetLocator asset_locator); } | EdmConverter { public DisplayModel getDisplayModel() { return model; } EdmConverter(final File input, final AssetLocator asset_locator); DisplayModel getDisplayModel(); void write(final File output); int nextGroup(); void downloadAsset(final String asset); Collection<String> getIncludedDisplays(); Collection<String> ge... | EdmConverter { public DisplayModel getDisplayModel() { return model; } EdmConverter(final File input, final AssetLocator asset_locator); DisplayModel getDisplayModel(); void write(final File output); int nextGroup(); void downloadAsset(final String asset); Collection<String> getIncludedDisplays(); Collection<String> ge... |
@Test public void testCache() throws Exception { final Cache<String> cache = new Cache<>(Duration.ofSeconds(2)); final CountDownLatch set_A = new CountDownLatch(1); final AtomicReference<String> A = new AtomicReference<>(); final ExecutorService pool = Executors.newCachedThreadPool(); pool.submit(() -> { final String k... | public Cache(final Duration timeout) { this.timeout = timeout; } | Cache { public Cache(final Duration timeout) { this.timeout = timeout; } } | Cache { public Cache(final Duration timeout) { this.timeout = timeout; } Cache(final Duration timeout); } | Cache { public Cache(final Duration timeout) { this.timeout = timeout; } Cache(final Duration timeout); T getCachedOrNew(final String key, final CreateEntry<String, T> creator); Collection<String> getKeys(); void clear(); } | Cache { public Cache(final Duration timeout) { this.timeout = timeout; } Cache(final Duration timeout); T getCachedOrNew(final String key, final CreateEntry<String, T> creator); Collection<String> getKeys(); void clear(); } |
@Test public void testParse() { assertThat(Version.parse("2.0.1").getMajor(), equalTo(2)); assertThat(Version.parse("2.0.1").getMinor(), equalTo(0)); assertThat(Version.parse("2.0.1").getPatch(), equalTo(1)); } | public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_PATTERN.matcher(version); if (matcher.mat... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... |
@Test public void testError() { try { Version.parse("2"); fail("Didn't detect invalid version"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage(), containsString("Invalid version string")); } try { Version.parse("2.1.2.3"); fail("Didn't detect invalid version"); } catch (IllegalArgumentException ex) {... | public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_PATTERN.matcher(version); if (matcher.mat... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... | Version implements Comparable<Version> { public static Version parse(final String version) { Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) return new Version(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3))); matcher = SHORT_VERSION_... |
@Test public void testConverter() throws Exception { final String filename = ConverterTest.class.getResource("/Main_XXXX.adl").getFile(); if (filename.isEmpty()) throw new Exception("Cannot obtain test file"); final File output = File.createTempFile("Main_XXX", ".bob"); output.deleteOnExit(); new Converter(new File(fil... | public Converter(final File input, final File output) throws Exception { logger.log(Level.INFO, "Convert " + input + " -> " + output); final ADLWidget root = ParserADL.getNextElement(input); colorMap = getColorMap(root); logger.log(Level.FINE, "Color map: " + Arrays.toString(colorMap)); initializeDisplayModel(input.get... | Converter { public Converter(final File input, final File output) throws Exception { logger.log(Level.INFO, "Convert " + input + " -> " + output); final ADLWidget root = ParserADL.getNextElement(input); colorMap = getColorMap(root); logger.log(Level.FINE, "Color map: " + Arrays.toString(colorMap)); initializeDisplayMod... | Converter { public Converter(final File input, final File output) throws Exception { logger.log(Level.INFO, "Convert " + input + " -> " + output); final ADLWidget root = ParserADL.getNextElement(input); colorMap = getColorMap(root); logger.log(Level.FINE, "Color map: " + Arrays.toString(colorMap)); initializeDisplayMod... | Converter { public Converter(final File input, final File output) throws Exception { logger.log(Level.INFO, "Convert " + input + " -> " + output); final ADLWidget root = ParserADL.getNextElement(input); colorMap = getColorMap(root); logger.log(Level.FINE, "Color map: " + Arrays.toString(colorMap)); initializeDisplayMod... | Converter { public Converter(final File input, final File output) throws Exception { logger.log(Level.INFO, "Convert " + input + " -> " + output); final ADLWidget root = ParserADL.getNextElement(input); colorMap = getColorMap(root); logger.log(Level.FINE, "Color map: " + Arrays.toString(colorMap)); initializeDisplayMod... |
@Test public void testRGB() { assertThat(JFXUtil.webRGB(new WidgetColor(15, 255, 0)), equalTo("#0FFF00")); assertThat(JFXUtil.webRGB(new WidgetColor(0, 16, 255)), equalTo("#0010FF")); } | public static String webRGB(final WidgetColor color) { return webRGBCache.computeIfAbsent(color, col -> { if (col.getAlpha() < 255) return "rgba(" + col.getRed() + ',' + col.getGreen() + ',' + col.getBlue() + ',' + col.getAlpha()/255f + ')'; else return String.format((Locale) null, "#%02X%02X%02X", col.getRed(), col.ge... | JFXUtil extends org.phoebus.ui.javafx.JFXUtil { public static String webRGB(final WidgetColor color) { return webRGBCache.computeIfAbsent(color, col -> { if (col.getAlpha() < 255) return "rgba(" + col.getRed() + ',' + col.getGreen() + ',' + col.getBlue() + ',' + col.getAlpha()/255f + ')'; else return String.format((Loc... | JFXUtil extends org.phoebus.ui.javafx.JFXUtil { public static String webRGB(final WidgetColor color) { return webRGBCache.computeIfAbsent(color, col -> { if (col.getAlpha() < 255) return "rgba(" + col.getRed() + ',' + col.getGreen() + ',' + col.getBlue() + ',' + col.getAlpha()/255f + ')'; else return String.format((Loc... | JFXUtil extends org.phoebus.ui.javafx.JFXUtil { public static String webRGB(final WidgetColor color) { return webRGBCache.computeIfAbsent(color, col -> { if (col.getAlpha() < 255) return "rgba(" + col.getRed() + ',' + col.getGreen() + ',' + col.getBlue() + ',' + col.getAlpha()/255f + ')'; else return String.format((Loc... | JFXUtil extends org.phoebus.ui.javafx.JFXUtil { public static String webRGB(final WidgetColor color) { return webRGBCache.computeIfAbsent(color, col -> { if (col.getAlpha() < 255) return "rgba(" + col.getRed() + ',' + col.getGreen() + ',' + col.getBlue() + ',' + col.getAlpha()/255f + ')'; else return String.format((Loc... |
@Test public void testSVGHelper(){ try { Image image = SVGHelper.loadSVG(getPath("interlock.svg"), 400d, 400d); assertTrue(image.getHeight() > 0); assertTrue(image.getWidth() > 0); } catch (Exception e) { fail(e.getMessage()); } } | public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputStream, width,... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... |
@Test public void testSVGHelperPngFile(){ String path = null; try { path = getPath("interlock.png"); } catch (Exception e) { fail(e.getMessage()); return; } assertNull(SVGHelper.loadSVG(path, 400d, 400d)); } | public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputStream, width,... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... |
@Test public void testSVGHelperJpgFile(){ String path = null; try { path = getPath("interlock.jpg"); } catch (Exception e) { fail(e.getMessage()); return; } assertNull(SVGHelper.loadSVG(path, 400d, 400d)); } | public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputStream, width,... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... |
@Test(expected = IllegalArgumentException.class) public void createNewFolderNoParentSpecified() { Node folderFromClient = Node.builder().name("SomeFolder").build(); services.createNode(null, folderFromClient); } | @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id=%s does not exist.", parentsUni... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... | Services implements IServices { @Override public Node createNode(String parentsUniqueId, Node node) { Node parentFolder = nodeDAO.getNode(parentsUniqueId); if (parentFolder == null || !parentFolder.getNodeType().equals(NodeType.FOLDER)) { String message = String.format("Cannot create new folder as parent folder with id... |
@Test public void testSVGHelperGifFile() throws Exception{ String path = null; try { path = getPath("interlock.gif"); } catch (Exception e) { fail(e.getMessage()); return; } assertNull(SVGHelper.loadSVG(path, 400d, 400d)); } | public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputStream, width,... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... |
@Test public void testSVGHelperTiffFile() throws Exception{ String path = null; try { path = getPath("interlock.tiff"); } catch (Exception e) { fail(e.getMessage()); return; } assertNull(SVGHelper.loadSVG(path, 400d, 400d)); } | public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputStream, width,... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... | SVGHelper { public static Image loadSVG(String imageFileName, double width, double height){ String cachedSVGFileName = imageFileName + "_" + width + "_" + height; return ImageCache.cache(cachedSVGFileName, () -> { try(InputStream inputStream = ModelResourceUtil.openResourceStream(imageFileName)){ return loadSVG(inputSt... |
@Test(expected = UnsupportedOperationException.class) public void testRandomFile() { File file = new File(getClass().getClassLoader().getResource("random.txt").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); } | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testEmptyBOBList() { File file = new File(getClass().getClassLoader().getResource("bob/root_with_no_children.bob").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); assertTrue("Failed to parse a bob screen with no children, expected empty list but found... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testEmptyOPIList() { File file = new File(getClass().getClassLoader().getResource("opi/root_with_no_children.opi").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); assertTrue("Failed to parse a bob screen with no children, expected empty list but found... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testBOBList() { File file = new File(getClass().getClassLoader().getResource("bob/root.bob").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(new File(getClass().getClassLoader().getResource(... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testOPIList() { File file = new File(getClass().getClassLoader().getResource("opi/root.opi").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(new File(getClass().getClassLoader().getResource(... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testBOBCyclicLinksList() { File file = new File(getClass().getClassLoader().getResource("bob/cyclic/cyclic_1.bob").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(new File(getClass().getClas... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testOPICyclicLinksList() { File file = new File(getClass().getClassLoader().getResource("opi/cyclic/cyclic_1.opi").getFile()); ProcessOPI processOPI = new ProcessOPI(file); Set<File> result = processOPI.process(); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(new File(getClass().getClas... | public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi."); } }, () -> ... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... | ProcessOPI { public Set<File> process() { getExtensionByStringHandling(this.rootFile.getName()).ifPresentOrElse(ext -> { if (!ext.equalsIgnoreCase("bob") && !ext.equalsIgnoreCase("opi")) { throw new UnsupportedOperationException("File extension " + ext + " is not supported. The supported extensions are .bob and .opi.")... |
@Test public void testReset() throws Exception { System.out.println("Timeout in 4 secs?"); final ResettableTimeout timer = new ResettableTimeout(4); final ScheduledExecutorService resetter = Executors.newSingleThreadScheduledExecutor(); resetter.scheduleAtFixedRate(() -> { System.out.println("Reset.."); timer.reset(); ... | public void reset() { final ScheduledFuture<?> previous = timeout.getAndSet(timer.schedule(signal_no_more_messages, timeout_secs, TimeUnit.SECONDS)); if (previous != null) previous.cancel(false); } | ResettableTimeout { public void reset() { final ScheduledFuture<?> previous = timeout.getAndSet(timer.schedule(signal_no_more_messages, timeout_secs, TimeUnit.SECONDS)); if (previous != null) previous.cancel(false); } } | ResettableTimeout { public void reset() { final ScheduledFuture<?> previous = timeout.getAndSet(timer.schedule(signal_no_more_messages, timeout_secs, TimeUnit.SECONDS)); if (previous != null) previous.cancel(false); } ResettableTimeout(final long timeout_secs); } | ResettableTimeout { public void reset() { final ScheduledFuture<?> previous = timeout.getAndSet(timer.schedule(signal_no_more_messages, timeout_secs, TimeUnit.SECONDS)); if (previous != null) previous.cancel(false); } ResettableTimeout(final long timeout_secs); void reset(); boolean awaitTimeout(final long seconds); vo... | ResettableTimeout { public void reset() { final ScheduledFuture<?> previous = timeout.getAndSet(timer.schedule(signal_no_more_messages, timeout_secs, TimeUnit.SECONDS)); if (previous != null) previous.cancel(false); } ResettableTimeout(final long timeout_secs); void reset(); boolean awaitTimeout(final long seconds); vo... |
@Test public void testGetFolder() { when(nodeDAO.getNode("a")).thenReturn(Node.builder().id(77).uniqueId("a").build()); assertNotNull(services.getNode("a")); } | @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } } | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Ove... | Services implements IServices { @Override public Node getNode(String nodeId) { logger.info("Getting node {}", nodeId); return nodeDAO.getNode(nodeId); } @Override Node getParentNode(String uniqueNodeId); @Override List<Node> getSnapshots(String configUniqueId); @Override Node getSnapshot(String snapshotUniqueId); @Ove... |
@Test public void testURLEncoding() { String pathWithDelimiter = "OPR/TEST/sim: String pathWithColon = "OPR/TEST/SR:test:pv"; String pathWithDelimiterAndColon = "OPR/TEST/sim: String encodedPathWithDelimiter = "OPR/TEST/sim%3A%2F%2Ftest"; String encodedPathWithColon = "OPR/TEST/SR%3Atest%3Apv"; String encodedPathWithDe... | static String encodedURLPath(String path) { return String.valueOf(path).replace(": } | AlarmContext { static String encodedURLPath(String path) { return String.valueOf(path).replace(": } } | AlarmContext { static String encodedURLPath(String path) { return String.valueOf(path).replace(": } } | AlarmContext { static String encodedURLPath(String path) { return String.valueOf(path).replace(": } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void enablePV(AlarmPV ... | AlarmContext { static String encodedURLPath(String path) { return String.valueOf(path).replace(": } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void enablePV(AlarmPV ... |
@Test public void testURLDecoding() { String pathWithDelimiter = "OPR/TEST/sim: String pathWithColon = "OPR/TEST/SR:test:pv"; String pathWithDelimiterAndColon = "OPR/TEST/sim: String encodedPathWithDelimiter = "OPR/TEST/sim%3A%2F%2Ftest"; String encodedPathWithColon = "OPR/TEST/SR%3Atest%3Apv"; String encodedPathWithDe... | static String decodedURLPath(String path) { return String.valueOf(path).replace(encodecDelimiter, ": } | AlarmContext { static String decodedURLPath(String path) { return String.valueOf(path).replace(encodecDelimiter, ": } } | AlarmContext { static String decodedURLPath(String path) { return String.valueOf(path).replace(encodecDelimiter, ": } } | AlarmContext { static String decodedURLPath(String path) { return String.valueOf(path).replace(encodecDelimiter, ": } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void... | AlarmContext { static String decodedURLPath(String path) { return String.valueOf(path).replace(encodecDelimiter, ": } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void... |
@Test public void testKafkaPathDecoding() { String pathWithDelimiter = "OPR/TEST/sim: String pathWithColon = "OPR/TEST/SR:test:pv"; String pathWithDelimiterAndColon = "OPR/TEST/sim: String encodedPathWithDelimiter = "OPR/TEST/sim:\\/\\/test"; String encodedPathWithColon = "OPR/TEST/SR:test:pv"; String encodedPathWithDe... | static String decodedKafaPath(String path) { return path.replace("\\/","/"); } | AlarmContext { static String decodedKafaPath(String path) { return path.replace("\\/","/"); } } | AlarmContext { static String decodedKafaPath(String path) { return path.replace("\\/","/"); } } | AlarmContext { static String decodedKafaPath(String path) { return path.replace("\\/","/"); } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void enablePV(AlarmPV alarmP... | AlarmContext { static String decodedKafaPath(String path) { return path.replace("\\/","/"); } static synchronized void registerPV(AlarmPV alarmPV); static synchronized void releasePV(AlarmPV alarmPV); static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack); static synchronized void enablePV(AlarmPV alarmP... |
@Test public void testGivenNoExistingCategoryAddingChildFormulaToRootNodeCreatesCategory() { String categoryName = "CATEGORY"; String formula1Name = "TEST_NAME"; FormulaFunction func = createFormula(formula1Name, "TEST_DESC", categoryName); FormulaTreeRootNode rootNode = new FormulaTreeRootNode(); rootNode.addChild(fun... | public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new FormulaTreeCategoryNode(child); categories.add(newCategory); this.getC... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... |
@Test public void testGivenExistingCategoryAddingChildFormulaToRootNodeDoesNotCreateCategory() { String categoryName = "CATEGORY"; String formula1Name = "TEST_NAME"; String formula2Name = "TEST_NAME2"; FormulaFunction firstFunc = createFormula(formula1Name, "TEST_DESC", categoryName); FormulaFunction secondFunc = creat... | public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new FormulaTreeCategoryNode(child); categories.add(newCategory); this.getC... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... | FormulaTreeRootNode extends TreeItem<FormulaTreeByCategoryNode> { public void addChild(FormulaFunction child) { for (FormulaTreeCategoryNode category : categories) { if (category.getValue().getSignature().equals(child.getCategory())) { category.addChild(child); return; } } FormulaTreeCategoryNode newCategory = new Form... |
@Test public void testCompareTo() { Node folder1 = Node.builder().name("a").build(); Node folder2 = Node.builder().name("b").build(); Node folder3 = Node.builder().name("a").build(); Node config = Node.builder().nodeType(NodeType.CONFIGURATION).name("c1").build(); Node config2 = Node.builder().nodeType(NodeType.CONFIGU... | @Override public int compareTo(Node other) { if(nodeType.equals(NodeType.FOLDER) && other.getNodeType().equals(NodeType.CONFIGURATION)){ return -1; } else if(getNodeType().equals(NodeType.CONFIGURATION) && other.getNodeType().equals(NodeType.FOLDER)){ return 1; } else{ return getName().compareTo(other.getName()); } } | Node implements Comparable<Node> { @Override public int compareTo(Node other) { if(nodeType.equals(NodeType.FOLDER) && other.getNodeType().equals(NodeType.CONFIGURATION)){ return -1; } else if(getNodeType().equals(NodeType.CONFIGURATION) && other.getNodeType().equals(NodeType.FOLDER)){ return 1; } else{ return getName(... | Node implements Comparable<Node> { @Override public int compareTo(Node other) { if(nodeType.equals(NodeType.FOLDER) && other.getNodeType().equals(NodeType.CONFIGURATION)){ return -1; } else if(getNodeType().equals(NodeType.CONFIGURATION) && other.getNodeType().equals(NodeType.FOLDER)){ return 1; } else{ return getName(... | Node implements Comparable<Node> { @Override public int compareTo(Node other) { if(nodeType.equals(NodeType.FOLDER) && other.getNodeType().equals(NodeType.CONFIGURATION)){ return -1; } else if(getNodeType().equals(NodeType.CONFIGURATION) && other.getNodeType().equals(NodeType.FOLDER)){ return 1; } else{ return getName(... | Node implements Comparable<Node> { @Override public int compareTo(Node other) { if(nodeType.equals(NodeType.FOLDER) && other.getNodeType().equals(NodeType.CONFIGURATION)){ return -1; } else if(getNodeType().equals(NodeType.CONFIGURATION) && other.getNodeType().equals(NodeType.FOLDER)){ return 1; } else{ return getName(... |
@Test public void testHashCode() { Node node1 = Node.builder().uniqueId("unique").nodeType(NodeType.FOLDER).build(); Node node2 = Node.builder().uniqueId("unique").nodeType(NodeType.CONFIGURATION).build(); assertNotEquals(node1.hashCode(), node2.hashCode()); } | @Override public int hashCode() { return Objects.hash(nodeType, uniqueId); } | Node implements Comparable<Node> { @Override public int hashCode() { return Objects.hash(nodeType, uniqueId); } } | Node implements Comparable<Node> { @Override public int hashCode() { return Objects.hash(nodeType, uniqueId); } } | Node implements Comparable<Node> { @Override public int hashCode() { return Objects.hash(nodeType, uniqueId); } void putProperty(String key, String value); void removeProperty(String key); String getProperty(String key); void addTag(Tag tag); void removeTag(Tag tag); @Override boolean equals(Object other); @Override i... | Node implements Comparable<Node> { @Override public int hashCode() { return Objects.hash(nodeType, uniqueId); } void putProperty(String key, String value); void removeProperty(String key); String getProperty(String key); void addTag(Tag tag); void removeTag(Tag tag); @Override boolean equals(Object other); @Override i... |
@Test public void testEquals() { Node node1 = Node.builder().uniqueId("unique").nodeType(NodeType.FOLDER).build(); Node node2 = Node.builder().uniqueId("unique").nodeType(NodeType.CONFIGURATION).build(); Node node3 = Node.builder().uniqueId("unique").nodeType(NodeType.FOLDER).build(); assertFalse(node1.equals(null)); a... | @Override public boolean equals(Object other) { if(other == null) { return false; } if(other instanceof Node) { Node otherNode = (Node)other; return nodeType.equals(otherNode.getNodeType()) && uniqueId.equals(otherNode.getUniqueId()); } return false; } | Node implements Comparable<Node> { @Override public boolean equals(Object other) { if(other == null) { return false; } if(other instanceof Node) { Node otherNode = (Node)other; return nodeType.equals(otherNode.getNodeType()) && uniqueId.equals(otherNode.getUniqueId()); } return false; } } | Node implements Comparable<Node> { @Override public boolean equals(Object other) { if(other == null) { return false; } if(other instanceof Node) { Node otherNode = (Node)other; return nodeType.equals(otherNode.getNodeType()) && uniqueId.equals(otherNode.getUniqueId()); } return false; } } | Node implements Comparable<Node> { @Override public boolean equals(Object other) { if(other == null) { return false; } if(other instanceof Node) { Node otherNode = (Node)other; return nodeType.equals(otherNode.getNodeType()) && uniqueId.equals(otherNode.getUniqueId()); } return false; } void putProperty(String key, St... | Node implements Comparable<Node> { @Override public boolean equals(Object other) { if(other == null) { return false; } if(other instanceof Node) { Node otherNode = (Node)other; return nodeType.equals(otherNode.getNodeType()) && uniqueId.equals(otherNode.getUniqueId()); } return false; } void putProperty(String key, St... |
@Test public void testEquals() { ConfigPv configPV1 = ConfigPv.builder().pvName("a").readbackPvName("b").readOnly(true).build(); assertFalse(configPV1.equals(new Object())); assertFalse(configPV1.equals(null)); ConfigPv configPV2 = ConfigPv.builder().pvName("a").readbackPvName("b").readOnly(true).build(); ConfigPv conf... | @Override public boolean equals(Object other) { if(other instanceof ConfigPv) { ConfigPv otherConfigPv = (ConfigPv)other; return Objects.equals(pvName, otherConfigPv.getPvName()) && Objects.equals(readbackPvName, otherConfigPv.getReadbackPvName()) && Objects.equals(readOnly, otherConfigPv.isReadOnly()); } return false;... | ConfigPv implements Comparable<ConfigPv> { @Override public boolean equals(Object other) { if(other instanceof ConfigPv) { ConfigPv otherConfigPv = (ConfigPv)other; return Objects.equals(pvName, otherConfigPv.getPvName()) && Objects.equals(readbackPvName, otherConfigPv.getReadbackPvName()) && Objects.equals(readOnly, o... | ConfigPv implements Comparable<ConfigPv> { @Override public boolean equals(Object other) { if(other instanceof ConfigPv) { ConfigPv otherConfigPv = (ConfigPv)other; return Objects.equals(pvName, otherConfigPv.getPvName()) && Objects.equals(readbackPvName, otherConfigPv.getReadbackPvName()) && Objects.equals(readOnly, o... | ConfigPv implements Comparable<ConfigPv> { @Override public boolean equals(Object other) { if(other instanceof ConfigPv) { ConfigPv otherConfigPv = (ConfigPv)other; return Objects.equals(pvName, otherConfigPv.getPvName()) && Objects.equals(readbackPvName, otherConfigPv.getReadbackPvName()) && Objects.equals(readOnly, o... | ConfigPv implements Comparable<ConfigPv> { @Override public boolean equals(Object other) { if(other instanceof ConfigPv) { ConfigPv otherConfigPv = (ConfigPv)other; return Objects.equals(pvName, otherConfigPv.getPvName()) && Objects.equals(readbackPvName, otherConfigPv.getReadbackPvName()) && Objects.equals(readOnly, o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.