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 testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 1, "Size of short-short-int should be 1"); } | @Override public long getSize() { return 1L; } | ShortShortInt implements EncodableData { @Override public long getSize() { return 1L; } } | ShortShortInt implements EncodableData { @Override public long getSize() { return 1L; } private ShortShortInt(byte value); } | ShortShortInt implements EncodableData { @Override public long getSize() { return 1L; } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte getByte(); static ShortShortInt parseByte(byte va... | ShortShortInt implements EncodableData { @Override public long getSize() { return 1L; } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte getByte(); static ShortShortInt parseByte(byte va... |
@Test public void testEquals() { ShortShortInt other = ShortShortInt.parse((byte) 3); ShortShortInt similar = ShortShortInt.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return tru... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortShortInt) && (value == ((ShortShortInt) obj).value); } | ShortShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortShortInt) && (value == ((ShortShortInt) obj).value); } } | ShortShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortShortInt) && (value == ((ShortShortInt) obj).value); } private ShortShortInt(byte value); } | ShortShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortShortInt) && (value == ((ShortShortInt) obj).value); } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortIn... | ShortShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortShortInt) && (value == ((ShortShortInt) obj).value); } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortIn... |
@Test public void testHashCode() { ShortShortInt similar = ShortShortInt.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return (int) value; } | ShortShortInt implements EncodableData { @Override public int hashCode() { return (int) value; } } | ShortShortInt implements EncodableData { @Override public int hashCode() { return (int) value; } private ShortShortInt(byte value); } | ShortShortInt implements EncodableData { @Override public int hashCode() { return (int) value; } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte getByte(); static ShortShortInt parseByt... | ShortShortInt implements EncodableData { @Override public int hashCode() { return (int) value; } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte getByte(); static ShortShortInt parseByt... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(1); TEST_OBJECT.write(buf); ShortShortInt parsedObject = ShortShortInt.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static ShortShortInt parse(ByteBuf buf) { return new ShortShortInt(buf.readByte()); } | ShortShortInt implements EncodableData { public static ShortShortInt parse(ByteBuf buf) { return new ShortShortInt(buf.readByte()); } } | ShortShortInt implements EncodableData { public static ShortShortInt parse(ByteBuf buf) { return new ShortShortInt(buf.readByte()); } private ShortShortInt(byte value); } | ShortShortInt implements EncodableData { public static ShortShortInt parse(ByteBuf buf) { return new ShortShortInt(buf.readByte()); } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte get... | ShortShortInt implements EncodableData { public static ShortShortInt parse(ByteBuf buf) { return new ShortShortInt(buf.readByte()); } private ShortShortInt(byte value); @Override long getSize(); @Override void write(ByteBuf buf); static ShortShortInt parse(ByteBuf buf); static ShortShortInt parse(byte value); byte get... |
@Test(description = "Test frequently used exchanges types are defined", expectedExceptions = ValidationException.class) public void testDeclareExchangesWithEmptyName() throws ValidationException, BrokerException { exchangeRegistry.declareExchange("", DIRECT.toString(), false, true); } | void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if (Objects.isNull(exc... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 2, "Size of short-int should be 2"); } | @Override public long getSize() { return 2L; } | ShortInt implements EncodableData { @Override public long getSize() { return 2L; } } | ShortInt implements EncodableData { @Override public long getSize() { return 2L; } private ShortInt(short value); } | ShortInt implements EncodableData { @Override public long getSize() { return 2L; } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(ByteBuf buf); static ShortInt parse(shor... | ShortInt implements EncodableData { @Override public long getSize() { return 2L; } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(ByteBuf buf); static ShortInt parse(shor... |
@Test public void testEquals() { ShortInt other = ShortInt.parse((short) 3); ShortInt similar = ShortInt.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar objec... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortInt) && (value == ((ShortInt) obj).value); } | ShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortInt) && (value == ((ShortInt) obj).value); } } | ShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortInt) && (value == ((ShortInt) obj).value); } private ShortInt(short value); } | ShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortInt) && (value == ((ShortInt) obj).value); } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCo... | ShortInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortInt) && (value == ((ShortInt) obj).value); } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCo... |
@Test public void testHashCode() { ShortInt similar = ShortInt.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return value; } | ShortInt implements EncodableData { @Override public int hashCode() { return value; } } | ShortInt implements EncodableData { @Override public int hashCode() { return value; } private ShortInt(short value); } | ShortInt implements EncodableData { @Override public int hashCode() { return value; } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(ByteBuf buf); static ShortInt parse(s... | ShortInt implements EncodableData { @Override public int hashCode() { return value; } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(ByteBuf buf); static ShortInt parse(s... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(1); TEST_OBJECT.write(buf); ShortInt parsedObject = ShortInt.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static ShortInt parse(ByteBuf buf) { return new ShortInt(buf.readShort()); } | ShortInt implements EncodableData { public static ShortInt parse(ByteBuf buf) { return new ShortInt(buf.readShort()); } } | ShortInt implements EncodableData { public static ShortInt parse(ByteBuf buf) { return new ShortInt(buf.readShort()); } private ShortInt(short value); } | ShortInt implements EncodableData { public static ShortInt parse(ByteBuf buf) { return new ShortInt(buf.readShort()); } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(Byt... | ShortInt implements EncodableData { public static ShortInt parse(ByteBuf buf) { return new ShortInt(buf.readShort()); } private ShortInt(short value); @Override long getSize(); @Override void write(ByteBuf buf); short getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortInt parse(Byt... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 4, "Size of long-int should be 4"); } | @Override public long getSize() { return 4L; } | LongInt implements EncodableData { @Override public long getSize() { return 4L; } } | LongInt implements EncodableData { @Override public long getSize() { return 4L; } private LongInt(int value); } | LongInt implements EncodableData { @Override public long getSize() { return 4L; } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); static LongInt parse(int value); @O... | LongInt implements EncodableData { @Override public long getSize() { return 4L; } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); static LongInt parse(int value); @O... |
@Test public void testEquals() { LongInt other = LongInt.parse(3); LongInt similar = LongInt.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar objects"); Assert... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongInt) && (value == ((LongInt) obj).value); } | LongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongInt) && (value == ((LongInt) obj).value); } } | LongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongInt) && (value == ((LongInt) obj).value); } private LongInt(int value); } | LongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongInt) && (value == ((LongInt) obj).value); } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Ove... | LongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongInt) && (value == ((LongInt) obj).value); } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Ove... |
@Test public void testHashCode() { LongInt similar = LongInt.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return value; } | LongInt implements EncodableData { @Override public int hashCode() { return value; } } | LongInt implements EncodableData { @Override public int hashCode() { return value; } private LongInt(int value); } | LongInt implements EncodableData { @Override public int hashCode() { return value; } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); static LongInt parse(int value);... | LongInt implements EncodableData { @Override public int hashCode() { return value; } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); static LongInt parse(int value);... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(4); TEST_OBJECT.write(buf); LongInt parsedObject = LongInt.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static LongInt parse(ByteBuf buf) { return new LongInt(buf.readInt()); } | LongInt implements EncodableData { public static LongInt parse(ByteBuf buf) { return new LongInt(buf.readInt()); } } | LongInt implements EncodableData { public static LongInt parse(ByteBuf buf) { return new LongInt(buf.readInt()); } private LongInt(int value); } | LongInt implements EncodableData { public static LongInt parse(ByteBuf buf) { return new LongInt(buf.readInt()); } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); st... | LongInt implements EncodableData { public static LongInt parse(ByteBuf buf) { return new LongInt(buf.readInt()); } private LongInt(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getInt(); @Override int hashCode(); @Override boolean equals(Object obj); static LongInt parse(ByteBuf buf); st... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 4, "Size of float should be 4"); } | @Override public long getSize() { return 4L; } | Float implements EncodableData { @Override public long getSize() { return 4L; } } | Float implements EncodableData { @Override public long getSize() { return 4L; } private Float(float value); } | Float implements EncodableData { @Override public long getSize() { return 4L; } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean equals(Object obj); @O... | Float implements EncodableData { @Override public long getSize() { return 4L; } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean equals(Object obj); @O... |
@Test public void testEquals() { Float other = Float.parse(3.0f); Float similar = Float.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar objects"); Assert.asse... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Float) && (value == ((Float) obj).value); } | Float implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Float) && (value == ((Float) obj).value); } } | Float implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Float) && (value == ((Float) obj).value); } private Float(float value); } | Float implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Float) && (value == ((Float) obj).value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float pars... | Float implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Float) && (value == ((Float) obj).value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float pars... |
@Test(dataProvider = "exchangeNames", description = "declare a existing exchange with passive parameter set") public void testDeclareExistingExchangesWithPassiveParameter(String exchangeName) throws BrokerException, ValidationException { exchangeRegistry.declareExchange(exchangeName, null, true, true); exchangeRegistry... | void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if (Objects.isNull(exc... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... |
@Test public void testHashCode() { Float similar = Float.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return Objects.hashCode(value); } | Float implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } } | Float implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Float(float value); } | Float implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean e... | Float implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean e... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(8); TEST_OBJECT.write(buf); Float parsedObject = Float.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static Float parse(float value) { return new Float(value); } | Float implements EncodableData { public static Float parse(float value) { return new Float(value); } } | Float implements EncodableData { public static Float parse(float value) { return new Float(value); } private Float(float value); } | Float implements EncodableData { public static Float parse(float value) { return new Float(value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean e... | Float implements EncodableData { public static Float parse(float value) { return new Float(value); } private Float(float value); @Override long getSize(); @Override void write(ByteBuf buf); static Float parse(float value); static Float parse(ByteBuf buf); float getFloat(); @Override int hashCode(); @Override boolean e... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 8, "Size of double should be 8"); } | @Override public long getSize() { return 8L; } | Double implements EncodableData { @Override public long getSize() { return 8L; } } | Double implements EncodableData { @Override public long getSize() { return 8L; } private Double(double value); } | Double implements EncodableData { @Override public long getSize() { return 8L; } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Override boolean equals(Object ... | Double implements EncodableData { @Override public long getSize() { return 8L; } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Override boolean equals(Object ... |
@Test public void testEquals() { Double other = Double.parse(3.0d); Double similar = Double.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar objects"); Assert.... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Double) && (value == ((Double) obj).value); } | Double implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Double) && (value == ((Double) obj).value); } } | Double implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Double) && (value == ((Double) obj).value); } private Double(double value); } | Double implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Double) && (value == ((Double) obj).value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Dou... | Double implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Double) && (value == ((Double) obj).value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Dou... |
@Test public void testHashCode() { Double similar = Double.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return Objects.hashCode(value); } | Double implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } } | Double implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Double(double value); } | Double implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Override b... | Double implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Override b... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(8); TEST_OBJECT.write(buf); Double parsedObject = Double.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static Double parse(double value) { return new Double(value); } | Double implements EncodableData { public static Double parse(double value) { return new Double(value); } } | Double implements EncodableData { public static Double parse(double value) { return new Double(value); } private Double(double value); } | Double implements EncodableData { public static Double parse(double value) { return new Double(value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Overrid... | Double implements EncodableData { public static Double parse(double value) { return new Double(value); } private Double(double value); @Override long getSize(); @Override void write(ByteBuf buf); static Double parse(double value); static Double parse(ByteBuf buf); double getDouble(); @Override int hashCode(); @Overrid... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 5, "Size of Decimal should be 5"); } | @Override public long getSize() { return 1L + 4L; } | Decimal implements EncodableData { @Override public long getSize() { return 1L + 4L; } } | Decimal implements EncodableData { @Override public long getSize() { return 1L + 4L; } private Decimal(BigDecimal value); } | Decimal implements EncodableData { @Override public long getSize() { return 1L + 4L; } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override int hashCode(); @Override ... | Decimal implements EncodableData { @Override public long getSize() { return 1L + 4L; } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override int hashCode(); @Override ... |
@Test public void testEquals() { Decimal other = Decimal.parse(new BigDecimal(3.0d)); Decimal similar = Decimal.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for simila... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Decimal) && (value.equals(((Decimal) obj).value)); } | Decimal implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Decimal) && (value.equals(((Decimal) obj).value)); } } | Decimal implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Decimal) && (value.equals(((Decimal) obj).value)); } private Decimal(BigDecimal value); } | Decimal implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Decimal) && (value.equals(((Decimal) obj).value)); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal ... | Decimal implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof Decimal) && (value.equals(((Decimal) obj).value)); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal ... |
@Test public void testHashCode() { Decimal similar = Decimal.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return Objects.hashCode(value); } | Decimal implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } } | Decimal implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Decimal(BigDecimal value); } | Decimal implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override int hashCo... | Decimal implements EncodableData { @Override public int hashCode() { return Objects.hashCode(value); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override int hashCo... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(8); TEST_OBJECT.write(buf); Decimal parsedObject = Decimal.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static Decimal parse(BigDecimal value) { return new Decimal(value); } | Decimal implements EncodableData { public static Decimal parse(BigDecimal value) { return new Decimal(value); } } | Decimal implements EncodableData { public static Decimal parse(BigDecimal value) { return new Decimal(value); } private Decimal(BigDecimal value); } | Decimal implements EncodableData { public static Decimal parse(BigDecimal value) { return new Decimal(value); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override i... | Decimal implements EncodableData { public static Decimal parse(BigDecimal value) { return new Decimal(value); } private Decimal(BigDecimal value); @Override long getSize(); @Override void write(ByteBuf buf); static Decimal parse(BigDecimal value); static Decimal parse(ByteBuf buf); BigDecimal getDecimal(); @Override i... |
@Test(description = "Declare a non-existing exchange with passive parameter set", expectedExceptions = ValidationException.class) public void testDeclareNonExistingExchangesWithPassiveParameter() throws BrokerException, ValidationException { exchangeRegistry.declareExchange(NON_EXISTING_EXCHANGE, DIRECT.toString(), tru... | void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if (Objects.isNull(exc... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... | ExchangeRegistry { void declareExchange(String exchangeName, String type, boolean passive, boolean durable) throws ValidationException, BrokerException { if (exchangeName.isEmpty()) { throw new ValidationException("Exchange name cannot be empty."); } Exchange exchange = exchangeMap.get(exchangeName); if (passive) { if ... |
@Test public void testGetSize() throws Exception { Assert.assertEquals(testFieldTable.getSize(), 4 + testKey.getSize() + testValue.getSize(), "Empty table should have size 4"); } | public long getSize() { long tableEntrySize = 0L; for (Map.Entry<ShortString, FieldValue> fieldEntry : properties.entrySet()) { tableEntrySize = tableEntrySize + fieldEntry.getKey().getSize() + fieldEntry.getValue().getSize(); } size = tableEntrySize; return 4L + tableEntrySize; } | FieldTable implements EncodableData { public long getSize() { long tableEntrySize = 0L; for (Map.Entry<ShortString, FieldValue> fieldEntry : properties.entrySet()) { tableEntrySize = tableEntrySize + fieldEntry.getKey().getSize() + fieldEntry.getValue().getSize(); } size = tableEntrySize; return 4L + tableEntrySize; } ... | FieldTable implements EncodableData { public long getSize() { long tableEntrySize = 0L; for (Map.Entry<ShortString, FieldValue> fieldEntry : properties.entrySet()) { tableEntrySize = tableEntrySize + fieldEntry.getKey().getSize() + fieldEntry.getValue().getSize(); } size = tableEntrySize; return 4L + tableEntrySize; } ... | FieldTable implements EncodableData { public long getSize() { long tableEntrySize = 0L; for (Map.Entry<ShortString, FieldValue> fieldEntry : properties.entrySet()) { tableEntrySize = tableEntrySize + fieldEntry.getKey().getSize() + fieldEntry.getValue().getSize(); } size = tableEntrySize; return 4L + tableEntrySize; } ... | FieldTable implements EncodableData { public long getSize() { long tableEntrySize = 0L; for (Map.Entry<ShortString, FieldValue> fieldEntry : properties.entrySet()) { tableEntrySize = tableEntrySize + fieldEntry.getKey().getSize() + fieldEntry.getValue().getSize(); } size = tableEntrySize; return 4L + tableEntrySize; } ... |
@Test public void testParse() throws Exception { ByteBuf buf = Unpooled.buffer((int) testFieldTable.getSize()); testFieldTable.write(buf); FieldTable parsedTable = FieldTable.parse(buf); Assert.assertEquals(parsedTable, testFieldTable, "Encoding and decoding should result in the same object"); } | public static FieldTable parse(ByteBuf buf) throws Exception { long size = buf.readUnsignedInt(); long readBytes = 0L; Map<ShortString, FieldValue> properties = new HashMap<>(); while (readBytes < size) { ShortString key = ShortString.parse(buf); FieldValue value = FieldValue.parse(buf); properties.put(key, value); rea... | FieldTable implements EncodableData { public static FieldTable parse(ByteBuf buf) throws Exception { long size = buf.readUnsignedInt(); long readBytes = 0L; Map<ShortString, FieldValue> properties = new HashMap<>(); while (readBytes < size) { ShortString key = ShortString.parse(buf); FieldValue value = FieldValue.parse... | FieldTable implements EncodableData { public static FieldTable parse(ByteBuf buf) throws Exception { long size = buf.readUnsignedInt(); long readBytes = 0L; Map<ShortString, FieldValue> properties = new HashMap<>(); while (readBytes < size) { ShortString key = ShortString.parse(buf); FieldValue value = FieldValue.parse... | FieldTable implements EncodableData { public static FieldTable parse(ByteBuf buf) throws Exception { long size = buf.readUnsignedInt(); long readBytes = 0L; Map<ShortString, FieldValue> properties = new HashMap<>(); while (readBytes < size) { ShortString key = ShortString.parse(buf); FieldValue value = FieldValue.parse... | FieldTable implements EncodableData { public static FieldTable parse(ByteBuf buf) throws Exception { long size = buf.readUnsignedInt(); long readBytes = 0L; Map<ShortString, FieldValue> properties = new HashMap<>(); while (readBytes < size) { ShortString key = ShortString.parse(buf); FieldValue value = FieldValue.parse... |
@Test public void testHashCode() throws Exception { Map<ShortString, FieldValue> properties = new HashMap<>(); properties.put(testKey, testValue); FieldTable similar = new FieldTable(properties); Assert.assertEquals(similar.hashCode(), testFieldTable.hashCode(), "Hashcode should match for similar " + "data"); } | @Override public int hashCode() { return properties.hashCode(); } | FieldTable implements EncodableData { @Override public int hashCode() { return properties.hashCode(); } } | FieldTable implements EncodableData { @Override public int hashCode() { return properties.hashCode(); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); } | FieldTable implements EncodableData { @Override public int hashCode() { return properties.hashCode(); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); long getSize(); void write(ByteBuf buf); void add(ShortString propertyName, FieldValue value); @Override int hashCode(); @Override boolean equals(Ob... | FieldTable implements EncodableData { @Override public int hashCode() { return properties.hashCode(); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); long getSize(); void write(ByteBuf buf); void add(ShortString propertyName, FieldValue value); @Override int hashCode(); @Override boolean equals(Ob... |
@Test public void testEquals() throws Exception { FieldValue otherType = FieldValue.parseLongString("Test"); Map<ShortString, FieldValue> properties = new HashMap<>(); properties.put(testKey, testValue); FieldTable similar = new FieldTable(properties); Assert.assertTrue(testFieldTable.equals(testFieldTable), "equals() ... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldTable) && properties.equals(((FieldTable) obj).properties); } | FieldTable implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldTable) && properties.equals(((FieldTable) obj).properties); } } | FieldTable implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldTable) && properties.equals(((FieldTable) obj).properties); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); } | FieldTable implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldTable) && properties.equals(((FieldTable) obj).properties); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); long getSize(); void write(ByteBuf buf); voi... | FieldTable implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldTable) && properties.equals(((FieldTable) obj).properties); } FieldTable(Map<ShortString, FieldValue> properties); FieldTable(); long getSize(); void write(ByteBuf buf); voi... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 2, "Size of short-uint should be 2"); } | @Override public long getSize() { return 2L; } | ShortUint implements EncodableData { @Override public long getSize() { return 2L; } } | ShortUint implements EncodableData { @Override public long getSize() { return 2L; } private ShortUint(int value); } | ShortUint implements EncodableData { @Override public long getSize() { return 2L; } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint parse(ByteBuf buf); static ShortUint parse(int ... | ShortUint implements EncodableData { @Override public long getSize() { return 2L; } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint parse(ByteBuf buf); static ShortUint parse(int ... |
@Test public void testEquals() { ShortUint other = ShortUint.parse(3); ShortUint similar = ShortUint.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar objects")... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortUint) && (value == ((ShortUint) obj).value); } | ShortUint implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortUint) && (value == ((ShortUint) obj).value); } } | ShortUint implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortUint) && (value == ((ShortUint) obj).value); } private ShortUint(int value); } | ShortUint implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortUint) && (value == ((ShortUint) obj).value); } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCo... | ShortUint implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof ShortUint) && (value == ((ShortUint) obj).value); } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCo... |
@Test public void testHashCode() { ShortUint similar = ShortUint.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return value; } | ShortUint implements EncodableData { @Override public int hashCode() { return value; } } | ShortUint implements EncodableData { @Override public int hashCode() { return value; } private ShortUint(int value); } | ShortUint implements EncodableData { @Override public int hashCode() { return value; } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint parse(ByteBuf buf); static ShortUint parse(i... | ShortUint implements EncodableData { @Override public int hashCode() { return value; } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint parse(ByteBuf buf); static ShortUint parse(i... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(1); TEST_OBJECT.write(buf); ShortUint parsedObject = ShortUint.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static ShortUint parse(ByteBuf buf) { return new ShortUint(buf.readUnsignedShort()); } | ShortUint implements EncodableData { public static ShortUint parse(ByteBuf buf) { return new ShortUint(buf.readUnsignedShort()); } } | ShortUint implements EncodableData { public static ShortUint parse(ByteBuf buf) { return new ShortUint(buf.readUnsignedShort()); } private ShortUint(int value); } | ShortUint implements EncodableData { public static ShortUint parse(ByteBuf buf) { return new ShortUint(buf.readUnsignedShort()); } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint ... | ShortUint implements EncodableData { public static ShortUint parse(ByteBuf buf) { return new ShortUint(buf.readUnsignedShort()); } private ShortUint(int value); @Override long getSize(); @Override void write(ByteBuf buf); int getShort(); @Override int hashCode(); @Override boolean equals(Object obj); static ShortUint ... |
@Test public void testGetSize() throws Exception { Assert.assertEquals(TEST_OBJECT.getSize(), 1 + 4); } | public long getSize() { return 1 + value.getSize(); } | FieldValue implements EncodableData { public long getSize() { return 1 + value.getSize(); } } | FieldValue implements EncodableData { public long getSize() { return 1 + value.getSize(); } private FieldValue(Type type, EncodableData value); } | FieldValue implements EncodableData { public long getSize() { return 1 + value.getSize(); } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSize(); @Override void write(ByteBuf buf); static FieldValue parse(ByteBuf buf); Type getType(); EncodableData getValue(); static FieldValue parse... | FieldValue implements EncodableData { public long getSize() { return 1 + value.getSize(); } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSize(); @Override void write(ByteBuf buf); static FieldValue parse(ByteBuf buf); Type getType(); EncodableData getValue(); static FieldValue parse... |
@Test public void testEquals() throws Exception { FieldValue otherSameType = FieldValue.parseLongInt(3); FieldValue otherType = FieldValue.parseLongString("Test"); FieldValue similar = FieldValue.parseLongInt(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar object... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldValue) && type == ((FieldValue) obj).type && (value.equals(((FieldValue) obj).value)); } | FieldValue implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldValue) && type == ((FieldValue) obj).type && (value.equals(((FieldValue) obj).value)); } } | FieldValue implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldValue) && type == ((FieldValue) obj).type && (value.equals(((FieldValue) obj).value)); } private FieldValue(Type type, EncodableData value); } | FieldValue implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldValue) && type == ((FieldValue) obj).type && (value.equals(((FieldValue) obj).value)); } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSiz... | FieldValue implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof FieldValue) && type == ((FieldValue) obj).type && (value.equals(((FieldValue) obj).value)); } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSiz... |
@Test(description = "Test exchange delete operation") public void testDeleteExchange() throws BrokerException, ValidationException { exchangeRegistry.declareExchange(NON_EXISTING_EXCHANGE, DIRECT.toString(), false, false); exchangeRegistry.deleteExchange(NON_EXISTING_EXCHANGE, true); Exchange deletedExchange = exchange... | boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDurable()) { exchangeD... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... |
@Test public void testHashCode() throws Exception { FieldValue similar = FieldValue.parseLongInt(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar " + "data"); } | @Override public int hashCode() { int hash = value.hashCode(); hash += type.getChar(); return hash; } | FieldValue implements EncodableData { @Override public int hashCode() { int hash = value.hashCode(); hash += type.getChar(); return hash; } } | FieldValue implements EncodableData { @Override public int hashCode() { int hash = value.hashCode(); hash += type.getChar(); return hash; } private FieldValue(Type type, EncodableData value); } | FieldValue implements EncodableData { @Override public int hashCode() { int hash = value.hashCode(); hash += type.getChar(); return hash; } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSize(); @Override void write(ByteBuf buf); static FieldValue parse(ByteBuf buf); Type getType(); E... | FieldValue implements EncodableData { @Override public int hashCode() { int hash = value.hashCode(); hash += type.getChar(); return hash; } private FieldValue(Type type, EncodableData value); long getSize(); long getValueSize(); @Override void write(ByteBuf buf); static FieldValue parse(ByteBuf buf); Type getType(); E... |
@Test(expectedExceptions = Exception.class) public void testInvalidType() throws Exception { ByteBuf buf = Unpooled.buffer(1 + 4); buf.writeByte('Z'); FieldValue.parse(buf); } | public static FieldValue parse(ByteBuf buf) throws Exception { Type type = Type.valueOf((char) buf.readByte()); switch (type) { case BOOLEAN: return FieldValue.parseBoolean(io.ballerina.messaging.broker.common.data.types.Boolean.parse(buf)); case SHORT_SHORT_INT: return FieldValue.parseShortShortInt(ShortShortInt.parse... | FieldValue implements EncodableData { public static FieldValue parse(ByteBuf buf) throws Exception { Type type = Type.valueOf((char) buf.readByte()); switch (type) { case BOOLEAN: return FieldValue.parseBoolean(io.ballerina.messaging.broker.common.data.types.Boolean.parse(buf)); case SHORT_SHORT_INT: return FieldValue.... | FieldValue implements EncodableData { public static FieldValue parse(ByteBuf buf) throws Exception { Type type = Type.valueOf((char) buf.readByte()); switch (type) { case BOOLEAN: return FieldValue.parseBoolean(io.ballerina.messaging.broker.common.data.types.Boolean.parse(buf)); case SHORT_SHORT_INT: return FieldValue.... | FieldValue implements EncodableData { public static FieldValue parse(ByteBuf buf) throws Exception { Type type = Type.valueOf((char) buf.readByte()); switch (type) { case BOOLEAN: return FieldValue.parseBoolean(io.ballerina.messaging.broker.common.data.types.Boolean.parse(buf)); case SHORT_SHORT_INT: return FieldValue.... | FieldValue implements EncodableData { public static FieldValue parse(ByteBuf buf) throws Exception { Type type = Type.valueOf((char) buf.readByte()); switch (type) { case BOOLEAN: return FieldValue.parseBoolean(io.ballerina.messaging.broker.common.data.types.Boolean.parse(buf)); case SHORT_SHORT_INT: return FieldValue.... |
@Test public void testGetSize() { Assert.assertEquals(TEST_OBJECT.getSize(), 8, "Size of long-long-int should be 4"); } | @Override public long getSize() { return 8L; } | LongLongInt implements EncodableData { @Override public long getSize() { return 8L; } } | LongLongInt implements EncodableData { @Override public long getSize() { return 8L; } private LongLongInt(long value); } | LongLongInt implements EncodableData { @Override public long getSize() { return 8L; } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int hashCode(); @Override boolean eq... | LongLongInt implements EncodableData { @Override public long getSize() { return 8L; } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int hashCode(); @Override boolean eq... |
@Test public void testEquals() { LongLongInt other = LongLongInt.parse(3); LongLongInt similar = LongLongInt.parse(DATA_VALUE); Assert.assertTrue(TEST_OBJECT.equals(TEST_OBJECT), "equals() should return true for similar objects"); Assert.assertTrue(TEST_OBJECT.equals(similar), "equals() should return true for similar o... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongLongInt) && (value == ((LongLongInt) obj).value); } | LongLongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongLongInt) && (value == ((LongLongInt) obj).value); } } | LongLongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongLongInt) && (value == ((LongLongInt) obj).value); } private LongLongInt(long value); } | LongLongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongLongInt) && (value == ((LongLongInt) obj).value); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(lo... | LongLongInt implements EncodableData { @Override public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof LongLongInt) && (value == ((LongLongInt) obj).value); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(lo... |
@Test public void testHashCode() { LongLongInt similar = LongLongInt.parse(DATA_VALUE); Assert.assertEquals(similar.hashCode(), TEST_OBJECT.hashCode(), "Hashcode should match for similar data"); } | @Override public int hashCode() { return (int) (value ^ (value >>> 32)); } | LongLongInt implements EncodableData { @Override public int hashCode() { return (int) (value ^ (value >>> 32)); } } | LongLongInt implements EncodableData { @Override public int hashCode() { return (int) (value ^ (value >>> 32)); } private LongLongInt(long value); } | LongLongInt implements EncodableData { @Override public int hashCode() { return (int) (value ^ (value >>> 32)); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int hash... | LongLongInt implements EncodableData { @Override public int hashCode() { return (int) (value ^ (value >>> 32)); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int hash... |
@Test public void testParse() { ByteBuf buf = Unpooled.buffer(8); TEST_OBJECT.write(buf); LongLongInt parsedObject = LongLongInt.parse(buf); Assert.assertEquals(parsedObject, TEST_OBJECT, "Encoding and decoding should result in the same object"); } | public static LongLongInt parse(long value) { return new LongLongInt(value); } | LongLongInt implements EncodableData { public static LongLongInt parse(long value) { return new LongLongInt(value); } } | LongLongInt implements EncodableData { public static LongLongInt parse(long value) { return new LongLongInt(value); } private LongLongInt(long value); } | LongLongInt implements EncodableData { public static LongLongInt parse(long value) { return new LongLongInt(value); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int ... | LongLongInt implements EncodableData { public static LongLongInt parse(long value) { return new LongLongInt(value); } private LongLongInt(long value); @Override long getSize(); @Override void write(ByteBuf buf); static LongLongInt parse(long value); static LongLongInt parse(ByteBuf buf); long getLong(); @Override int ... |
@Test(expectedExceptions = { SaslException.class }, description = "Test evaluate empty response", expectedExceptionsMessageRegExp = ".*Invalid SASL/PLAIN response due to authzid null separator not found.*") public void testEvaluateEmptyResponse() throws Exception { plainSaslServer.evaluateResponse(new byte[0]); } | @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authcidNullPosition = Bytes .indexOf(Arrays.c... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... |
@Test(expectedExceptions = SaslException.class, description = "Test evaluate response without authorization separator", expectedExceptionsMessageRegExp = ".*Invalid SASL/PLAIN response due to authzid null separator not found.*") public void testEvaluateResponseWithoutAuthorizationSeparator() throws Exception { plainSas... | @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authcidNullPosition = Bytes .indexOf(Arrays.c... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... |
@Test(expectedExceptions = SaslException.class, description = "Test evaluate response without username separator", expectedExceptionsMessageRegExp = ".*Invalid SASL/PLAIN response due to authcid null separator not found.*") public void testEvaluateResponseWithoutUsernameSeparator() throws Exception { plainSaslServer .e... | @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authcidNullPosition = Bytes .indexOf(Arrays.c... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... | PlainSaslServer implements SaslServer { @Override public byte[] evaluateResponse(byte[] response) throws SaslException { int authzidNullPosition = Bytes.indexOf(response, (byte) 0); if (authzidNullPosition < 0) { throw new SaslException("Invalid SASL/PLAIN response due to authzid null separator not found"); } int authc... |
@Test(expectedExceptions = AuthServerException.class) public void testDuplicate() throws AuthServerException { AuthResource queue = new AuthResource(ResourceType.QUEUE.toString(), "queue1", true, "customer"); authResourceDao.persist(queue); } | @Override public void persist(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.storeResource(connection, authResource); authResourceCrudOperationsDao.persistUserGroupMappings(connection, authResource.getResourceType(), authResource.getResourceName(), auth... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.storeResource(connection, authResource); authResourceCrudOperationsDao.persistUserGroupMappings(connection, authResource.getRe... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.storeResource(connection, authResource); authResourceCrudOperationsDao.persistUserGroupMappings(connection, authResource.getRe... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.storeResource(connection, authResource); authResourceCrudOperationsDao.persistUserGroupMappings(connection, authResource.getRe... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.storeResource(connection, authResource); authResourceCrudOperationsDao.persistUserGroupMappings(connection, authResource.getRe... |
@Test(dataProvider = "exchangeNames", description = "try to delete built in exchanges", expectedExceptions = ValidationException.class) public void testDeleteBuiltInExchanges(String exchangeName) throws BrokerException, ValidationException { exchangeRegistry.deleteExchange(exchangeName, true); Assert.fail("built in exc... | boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDurable()) { exchangeD... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... | ExchangeRegistry { boolean deleteExchange(String exchangeName, boolean ifUnused) throws BrokerException, ValidationException { Exchange exchange = exchangeMap.get(exchangeName); if (Objects.isNull(exchange)) { return false; } if (!isBuiltInExchange(exchange)) { if (!ifUnused || exchange.isUnused()) { if (exchange.isDur... |
@Test public void testRead() throws AuthServerException { AuthResource queue = authResourceDao.read(ResourceType.QUEUE.toString(), "queue1"); Assert.assertEquals(queue.getOwner(), "customer"); Assert.assertEquals(queue.getActionsUserGroupsMap().size(), 0); AuthResource exchange = authResourceDao.read(ResourceType.EXCHA... | @Override public AuthResource read(String resourceType, String resourceName) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.read(connection, resourceType, resourceName)); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resourceName) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.read(connection, resourceType, resourceName)); } } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resourceName) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.read(connection, resourceType, resourceName)); } AuthResourceRdbmsDao(DataSource dataSource); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resourceName) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.read(connection, resourceType, resourceName)); } AuthResourceRdbmsDao(DataSource dataSource); @Ov... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resourceName) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.read(connection, resourceType, resourceName)); } AuthResourceRdbmsDao(DataSource dataSource); @Ov... |
@Test public void testReadAll() throws AuthServerException { List<AuthResource> customer = authResourceDao.readAll(ResourceType.QUEUE.toString(), "customer"); List<AuthResource> customerExchange = authResourceDao.readAll(ResourceType.EXCHANGE.toString(), "customer"); List<AuthResource> manager = authResourceDao.readAll... | @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceType, ownerId)); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... |
@Test public void testReadAllByGroups() throws AuthServerException { List<AuthResource> exchanges = authResourceDao.readAll(ResourceType.EXCHANGE.toString(), "bind", "customer", Collections.singletonList("developer")); List<AuthResource> queues = authResourceDao.readAll(ResourceType.QUEUE.toString(), "bind", "customer"... | @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceType, ownerId)); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) throws AuthServerException { return selectOperation((ThrowingFunction<Connection, List<AuthResource>, Exception>) connection -> authResourceCrudOperationsDao.readAll(connection, resourceTyp... |
@Test public void testIsExists() throws AuthServerException { boolean queue1 = authResourceDao.isExists(ResourceType.QUEUE.toString(), "queue1"); boolean queue11 = authResourceDao.isExists(ResourceType.QUEUE.toString(), "queue11"); Assert.assertEquals(queue1, true); Assert.assertEquals(queue11, false); } | @Override public boolean isExists(String resourceType, String resource) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.isExists(connection, resourceType, resource) ); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean isExists(String resourceType, String resource) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.isExists(connection, resourceType, resource) ); } } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean isExists(String resourceType, String resource) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.isExists(connection, resourceType, resource) ); } AuthResourceRdbmsDao(DataSource dataSource); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean isExists(String resourceType, String resource) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.isExists(connection, resourceType, resource) ); } AuthResourceRdbmsDao(DataSource dataSource); @Overri... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean isExists(String resourceType, String resource) throws AuthServerException { return selectOperation(connection -> authResourceCrudOperationsDao.isExists(connection, resourceType, resource) ); } AuthResourceRdbmsDao(DataSource dataSource); @Overri... |
@Test(dependsOnMethods = {"testIsExists", "testReadAllByGroups", "testReadAll", "testRead", "testDuplicate"}) public void testUpdate() throws AuthServerException { Map<String, Set<String>> actionsUserGroupsMap = new HashMap<>(); actionsUserGroupsMap.put("publish", new HashSet<>(Arrays.asList("architect", "customer", "m... | @Override public void update(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.updateOwner(connection, authResource.getResourceType(), authResource.getResourceName(), authResource.getOwner()); authResourceCrudOperationsDao.deleteUserGroupMappings(connectio... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void update(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.updateOwner(connection, authResource.getResourceType(), authResource.getResourceName(), authResource.getOwner()); authResourceC... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void update(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.updateOwner(connection, authResource.getResourceType(), authResource.getResourceName(), authResource.getOwner()); authResourceC... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void update(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.updateOwner(connection, authResource.getResourceType(), authResource.getResourceName(), authResource.getOwner()); authResourceC... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public void update(AuthResource authResource) throws AuthServerException { transaction(connection -> { authResourceCrudOperationsDao.updateOwner(connection, authResource.getResourceType(), authResource.getResourceName(), authResource.getOwner()); authResourceC... |
@Test(dependsOnMethods = "testUpdate") public void testDelete() throws AuthServerException { authResourceDao.delete(ResourceType.EXCHANGE.toString(), "exchange1"); authResourceDao.delete(ResourceType.EXCHANGE.toString(), "exchange1"); List<AuthResource> manager = authResourceDao.readAll(ResourceType.EXCHANGE.toString()... | @Override public boolean delete(String resourceType, String resource) throws AuthServerException { return transaction((ThrowingFunction<Connection, Boolean, Exception>) connection -> authResourceCrudOperationsDao.deleteResource(connection, resourceType, resource)); } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean delete(String resourceType, String resource) throws AuthServerException { return transaction((ThrowingFunction<Connection, Boolean, Exception>) connection -> authResourceCrudOperationsDao.deleteResource(connection, resourceType, resource)); } } | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean delete(String resourceType, String resource) throws AuthServerException { return transaction((ThrowingFunction<Connection, Boolean, Exception>) connection -> authResourceCrudOperationsDao.deleteResource(connection, resourceType, resource)); } Au... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean delete(String resourceType, String resource) throws AuthServerException { return transaction((ThrowingFunction<Connection, Boolean, Exception>) connection -> authResourceCrudOperationsDao.deleteResource(connection, resourceType, resource)); } Au... | AuthResourceRdbmsDao implements AuthResourceDao { @Override public boolean delete(String resourceType, String resource) throws AuthServerException { return transaction((ThrowingFunction<Connection, Boolean, Exception>) connection -> authResourceCrudOperationsDao.deleteResource(connection, resourceType, resource)); } Au... |
@Test public void testPersist() throws AuthServerException { AuthResource queue = new AuthResource(ResourceType.QUEUE.toString(), "queue1", true, "customer"); authResourceDao.persist(queue); Map<String, Set<String>> actionsUserGroupsMap = new HashMap<>(); actionsUserGroupsMap.put("bind", new HashSet<>(Arrays.asList("ar... | @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemoryResourceMap.put(resourceType, resourceName, authResou... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... |
@Test(priority = 1, expectedExceptions = AuthServerException.class) public void testDuplicate() throws AuthServerException { AuthResource queue = new AuthResource(ResourceType.QUEUE.toString(), "queue1", true, "customer"); authResourceDao.persist(queue); } | @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemoryResourceMap.put(resourceType, resourceName, authResou... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public void persist(AuthResource authResource) throws AuthServerException { String resourceType = authResource.getResourceType(); String resourceName = authResource.getResourceName(); if (!inMemoryResourceMap.contains(resourceType, resourceName)) { inMemory... |
@Test(priority = 1) public void testRead() throws AuthServerException { AuthResource queue = authResourceDao.read(ResourceType.QUEUE.toString(), "queue1"); Assert.assertEquals(queue.getOwner(), "customer"); Assert.assertEquals(queue.getActionsUserGroupsMap().size(), 0); AuthResource exchange = authResourceDao.read(Reso... | @Override public AuthResource read(String resourceType, String resource) { return inMemoryResourceMap.get(resourceType, resource); } | AuthResourceInMemoryDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resource) { return inMemoryResourceMap.get(resourceType, resource); } } | AuthResourceInMemoryDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resource) { return inMemoryResourceMap.get(resourceType, resource); } } | AuthResourceInMemoryDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resource) { return inMemoryResourceMap.get(resourceType, resource); } @Override void persist(AuthResource authResource); @Override void update(AuthResource authResource); @Override boolean delete(String ... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public AuthResource read(String resourceType, String resource) { return inMemoryResourceMap.get(resourceType, resource); } @Override void persist(AuthResource authResource); @Override void update(AuthResource authResource); @Override boolean delete(String ... |
@Test(priority = 1) public void testReadAll() throws AuthServerException { List<AuthResource> customer = authResourceDao.readAll(ResourceType.QUEUE.toString(), "customer"); List<AuthResource> customerExchange = authResourceDao.readAll(ResourceType.EXCHANGE.toString(), "customer"); List<AuthResource> manager = authResou... | @Override public List<AuthResource> readAll(String resourceType, String ownerId) { Map<String, AuthResource> resourceMap = inMemoryResourceMap.row(resourceType); if (Objects.nonNull(resourceMap)) { Collection<AuthResource> authResources = resourceMap.values(); return authResources.stream() .filter(authResource -> authR... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) { Map<String, AuthResource> resourceMap = inMemoryResourceMap.row(resourceType); if (Objects.nonNull(resourceMap)) { Collection<AuthResource> authResources = resourceMap.values(); return... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) { Map<String, AuthResource> resourceMap = inMemoryResourceMap.row(resourceType); if (Objects.nonNull(resourceMap)) { Collection<AuthResource> authResources = resourceMap.values(); return... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) { Map<String, AuthResource> resourceMap = inMemoryResourceMap.row(resourceType); if (Objects.nonNull(resourceMap)) { Collection<AuthResource> authResources = resourceMap.values(); return... | AuthResourceInMemoryDao implements AuthResourceDao { @Override public List<AuthResource> readAll(String resourceType, String ownerId) { Map<String, AuthResource> resourceMap = inMemoryResourceMap.row(resourceType); if (Objects.nonNull(resourceMap)) { Collection<AuthResource> authResources = resourceMap.values(); return... |
@Test(dataProvider = "exchangeData", description = "Test duplicate exchange persistence" , expectedExceptions = BrokerException.class) public void testDuplicatePersistence(String name, String type) throws Exception { Exchange exchange = ExchangeRegistry.ExchangeFactory.newInstance(name, Exchange.Type.from(type), bindin... | @Override public void persist(Exchange exchange) throws BrokerException { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); statement = connection.prepareStatement(RDBMSConstants.PS_INSERT_EXCHANGE); statement.setString(1, exchange.getName()); statement.setString(2, e... | ExchangeDaoImpl extends BaseDao implements ExchangeDao { @Override public void persist(Exchange exchange) throws BrokerException { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); statement = connection.prepareStatement(RDBMSConstants.PS_INSERT_EXCHANGE); statement.s... | ExchangeDaoImpl extends BaseDao implements ExchangeDao { @Override public void persist(Exchange exchange) throws BrokerException { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); statement = connection.prepareStatement(RDBMSConstants.PS_INSERT_EXCHANGE); statement.s... | ExchangeDaoImpl extends BaseDao implements ExchangeDao { @Override public void persist(Exchange exchange) throws BrokerException { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); statement = connection.prepareStatement(RDBMSConstants.PS_INSERT_EXCHANGE); statement.s... | ExchangeDaoImpl extends BaseDao implements ExchangeDao { @Override public void persist(Exchange exchange) throws BrokerException { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); statement = connection.prepareStatement(RDBMSConstants.PS_INSERT_EXCHANGE); statement.s... |
@Test public void shouldPrintHelp() throws UnsupportedEncodingException { main.execute(new String[]{"-help"}); String outString = new String(baos.toByteArray()); assertThat(outString, containsString("usage: java -jar")); assertThat(outString, containsString("-help")); } | void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting OCR...... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... |
@Test(expected=IllegalArgumentException.class) public void shouldRejectIllegalOutputFormat() { prepareOneBookWithOneImage(); OcrParameters params = validParams(); params.outputFormats = new String[]{"illegal"}; starterSut.startOcrWithParams(params); } | public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params.inputFormats); for... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... |
@Test(expected=IllegalArgumentException.class) public void shouldRejectIllegalTextType() { prepareOneBookWithOneImage(); OcrParameters params = validParams(); params.inputTextType = "illegal"; starterSut.startOcrWithParams(params); } | public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params.inputFormats); for... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... |
@Test(expected=IllegalArgumentException.class) public void shouldRejectIllegalPriority() { prepareOneBookWithOneImage(); OcrParameters params = validParams(); params.priority = "-10"; starterSut.startOcrWithParams(params); } | public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params.inputFormats); for... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... | OcrEngineStarter { public void startOcrWithParams(OcrParameters params) { OcrFactory factory = factoryProvider.createFactory(params.ocrEngine, params.props); engine = factory.createEngine(); FileAccess fileAccess = beanProvider.getFileAccess(); File[] allBookFolders = fileAccess.getAllFolders(params.inputFolder, params... |
@Test public void happyPath() { whenAskedThenFindFolders(); OcrParameters params = validParams(); String validation = validatorSut.validateParameters(params); verify(fileAccessMock).isReadableFolder("/tmp/input"); assertEquals("OK", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldNotFindInputFolder() { when(fileAccessMock.isReadableFolder("/tmp/input")).thenReturn(false); when(fileAccessMock.isWritableFolder("/tmp/output")).thenReturn(true); OcrParameters params = validParams(); String validation = validatorSut.validateParameters(params); assertThat(validation, containsS... | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldNotFindOutputFolder() { when(fileAccessMock.isReadableFolder("/tmp/input")).thenReturn(true); when(fileAccessMock.isWritableFolder("/tmp/output")).thenReturn(false); OcrParameters params = validParams(); String validation = validatorSut.validateParameters(params); assertThat(validation, contains... | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectMissingInputFormats() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.inputFormats = new String[]{}; String validation = validatorSut.validateParameters(params); assertEquals("No input formats. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectMissingInputTextType() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.inputTextType = " "; String validation = validatorSut.validateParameters(params); assertEquals("No input text type. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectMissingLanguages() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.inputLanguages = null; String validation = validatorSut.validateParameters(params); assertEquals("No input languages. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectMissingOutputFormats() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.outputFormats = null; String validation = validatorSut.validateParameters(params); assertEquals("No output formats. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDenyWrongArgument() throws UnsupportedEncodingException { main.execute(new String[]{"-wrongargument"}); String outString = new String(baos.toByteArray()); assertThat(outString, containsString("Illegal arguments. Use -help.")); } | void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting OCR...... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... |
@Test public void shouldDetectMissingPriority() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.priority = ""; String validation = validatorSut.validateParameters(params); assertEquals("No priority. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectMissingOcrEngine() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.ocrEngine = null; String validation = validatorSut.validateParameters(params); assertEquals("No OCR engine. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldDetectNullOptions() { whenAskedThenFindFolders(); OcrParameters params = validParams(); params.props = null; String validation = validatorSut.validateParameters(params); assertEquals("Properties may not be null. ", validation); } | public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(params.inputLang... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... | Validator { public String validateParameters(OcrParameters params) { fileAccess = beanProvider.getFileAccess(); String validationMessage = ""; if (!isReadable(params.inputFolder)) { validationMessage += inputFolderError(); } if (isEmpty(params.inputTextType)) { validationMessage += noInputTextType(); } if (isEmpty(para... |
@Test public void shouldAddOneImage() throws Exception { assertEquals("Number of images", 0, processSpy.getNumberOfImages()); processSpy.addImage(new URI("file:/test.tif")); assertEquals("Number of images", 1, processSpy.getNumberOfImages()); } | @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(localUri); ocrImages.add(image); } | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... |
@Test(expected=IllegalArgumentException.class) public void shouldRejectRemoteUriForImage() throws Exception { processSpy.addImage(new URI("http: } | @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(localUri); ocrImages.add(image); } | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addImage(URI localUri) { if (!localUri.getScheme().equals("file")) { throw new IllegalArgumentException("Only local files can be processed. Path was: " + localUri); } OcrImage image = new AbstractImage() {}; image.setLocalUri(local... |
@Test public void shouldAddOneOutput() throws Exception { assertEquals("Number of outputs", 0, processSpy.getAllOutputFormats().size()); processSpy.addOutput(OcrFormat.HOCR); assertEquals("Number of outputs", 1, processSpy.getAllOutputFormats().size()); } | @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constructLocalUri(format)); output.setFormat(format); ocrOutputs.add(outpu... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... |
@Test(expected=IllegalArgumentException.class) public void shouldRejectUnsupportedFormatForOutput() throws Exception { processSpy.addOutput(OcrFormat.PDF); } | @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constructLocalUri(format)); output.setFormat(format); ocrOutputs.add(outpu... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... | TesseractProcess extends AbstractProcess implements
OcrProcess { @Override public void addOutput(OcrFormat format) { if (!formats.keySet().contains(format)) { throw new IllegalArgumentException("Format is not supported by tesseract: " + format); } OcrOutput output = new AbstractOutput() {}; output.setLocalUri(constru... |
@Test public void shouldBeZeroSecondsWhenUnititialized() { assertEquals("Estimated time", 0, engineSut.getEstimatedDurationInSeconds()); } | @Override public int getEstimatedDurationInSeconds() { long durationInMillis = 0; for (OcrProcess process : processesQueue) { long imagesInProcess = process.getNumberOfImages(); durationInMillis += imagesInProcess * Integer.parseInt(props.getProperty("minMillisPerFile")); } return (int) (durationInMillis / 1000); } | AbbyyEngine extends AbstractEngine implements OcrEngine { @Override public int getEstimatedDurationInSeconds() { long durationInMillis = 0; for (OcrProcess process : processesQueue) { long imagesInProcess = process.getNumberOfImages(); durationInMillis += imagesInProcess * Integer.parseInt(props.getProperty("minMillisP... | AbbyyEngine extends AbstractEngine implements OcrEngine { @Override public int getEstimatedDurationInSeconds() { long durationInMillis = 0; for (OcrProcess process : processesQueue) { long imagesInProcess = process.getNumberOfImages(); durationInMillis += imagesInProcess * Integer.parseInt(props.getProperty("minMillisP... | AbbyyEngine extends AbstractEngine implements OcrEngine { @Override public int getEstimatedDurationInSeconds() { long durationInMillis = 0; for (OcrProcess process : processesQueue) { long imagesInProcess = process.getNumberOfImages(); durationInMillis += imagesInProcess * Integer.parseInt(props.getProperty("minMillisP... | AbbyyEngine extends AbstractEngine implements OcrEngine { @Override public int getEstimatedDurationInSeconds() { long durationInMillis = 0; for (OcrProcess process : processesQueue) { long imagesInProcess = process.getNumberOfImages(); durationInMillis += imagesInProcess * Integer.parseInt(props.getProperty("minMillisP... |
@Test public void shouldParseOutErrorMessage() throws IOException { XmlParser parserSut = new XmlParser(); String errorXml = "<XmlResult><Error>An error has occurred</Error></XmlResult>"; ByteArrayInputStream baos = new ByteArrayInputStream(errorXml.getBytes()); String errorMessage = parserSut.readErrorFromResultXml(ba... | public String readErrorFromResultXml(InputStream errorResultXml, String bookIdentifier) throws IOException { String error = null; XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = factory.createXMLStreamReader(errorResultXml); while (xmlStreamReader.hasNext()) { int event ... | XmlParser { public String readErrorFromResultXml(InputStream errorResultXml, String bookIdentifier) throws IOException { String error = null; XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = factory.createXMLStreamReader(errorResultXml); while (xmlStreamReader.hasNext()) ... | XmlParser { public String readErrorFromResultXml(InputStream errorResultXml, String bookIdentifier) throws IOException { String error = null; XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = factory.createXMLStreamReader(errorResultXml); while (xmlStreamReader.hasNext()) ... | XmlParser { public String readErrorFromResultXml(InputStream errorResultXml, String bookIdentifier) throws IOException { String error = null; XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = factory.createXMLStreamReader(errorResultXml); while (xmlStreamReader.hasNext()) ... | XmlParser { public String readErrorFromResultXml(InputStream errorResultXml, String bookIdentifier) throws IOException { String error = null; XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = factory.createXMLStreamReader(errorResultXml); while (xmlStreamReader.hasNext()) ... |
@Test public void shouldDoNothingWhenAllSubprocessesNotFinished() { when(subProcessMock1.hasFinished()).thenReturn(false); when(subProcessMock2.hasFinished()).thenReturn(false); observerSut.update(subProcessMock2); verifyZeroInteractions(parentProcessMock, mergerMock, fileAccessMock); } | public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.error("Could not merge proces... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... |
@Test public void shouldPassAllParams() throws UnsupportedEncodingException { ArgumentCaptor<OcrParameters> captor = ArgumentCaptor.forClass(OcrParameters.class); when(validatorMock.validateParameters(any(OcrParameters.class))).thenReturn("OK"); main.execute(validOptions()); verify(validatorMock).validateParameters(cap... | void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting OCR...... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... |
@Test public void shouldDoNothingWhenOneSubprocessNotFinished() { when(subProcessMock1.hasFinished()).thenReturn(false); when(subProcessMock2.hasFinished()).thenReturn(true); observerSut.update(subProcessMock2); verifyZeroInteractions(parentProcessMock, mergerMock, fileAccessMock); } | public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.error("Could not merge proces... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... |
@Test(expected=IllegalStateException.class) public void shouldBreakUpWhenOneFails() { when(subProcessMock1.hasFailed()).thenReturn(true); observerSut.update(subProcessMock1); } | public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.error("Could not merge proces... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... |
@SuppressWarnings("unchecked") @Test public void shouldMergeIntoOneAndDeleteTheParts() throws URISyntaxException, IOException { Set<OcrFormat> formats = new HashSet<OcrFormat>(); formats.add(OcrFormat.TXT); when(parentProcessMock.getAllOutputFormats()).thenReturn(formats); when(subProcessMock1.getOutputUriForFormat(Ocr... | public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.error("Could not merge proces... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... | ProcessMergingObserver { public synchronized void update(AbbyyProcess finishedSubProcess) { finishedSubProcess.setFinished(); for (AbbyyProcess sub : subProcesses) { boolean currentFinished = sub.hasFinished(); if (!currentFinished) { return; } } for (AbbyyProcess sub : subProcesses) { if(sub.hasFailed()) { logger.erro... |
@Test public void shouldCreateNewLock() throws IOException { when(hotfolderMock.exists(lockUri)).thenReturn(false); when(hotfolderMock.createTmpFile(anyString())).thenReturn(new ByteArrayOutputStream()); lockHandlerSut.createOrOverwriteLock(false); verify(hotfolderMock, never()).deleteIfExists(lockUri); verify(hotfolde... | public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lock file at " + loc... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... |
@Test(expected=ConcurrentModificationException.class) public void shouldCancelWhenLockIsPresent() throws IOException { when(hotfolderMock.exists(lockUri)).thenReturn(true); lockHandlerSut.createOrOverwriteLock(false); } | public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lock file at " + loc... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... |
@Test public void shouldOverwriteLock() throws IOException { when(hotfolderMock.exists(lockUri)).thenReturn(false); when(hotfolderMock.createTmpFile(anyString())).thenReturn(new ByteArrayOutputStream()); lockHandlerSut.createOrOverwriteLock(true); verify(hotfolderMock).deleteIfExists(lockUri); verify(hotfolderMock).cop... | public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lock file at " + loc... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... | LockFileHandler { public void createOrOverwriteLock(boolean overwriteLock) { synchronized(monitor) { try { if (overwriteLock) { hotfolder.deleteIfExists(lockUri); } boolean lockExists = hotfolder.exists(lockUri); if (lockExists) { throw new ConcurrentModificationException("Another client instance is running! See the lo... |
@Test public void shouldDeleteLock() throws IOException { lockHandlerSut.deleteLockAndCleanUp(); verify(hotfolderMock).deleteIfExists(lockUri); } | public void deleteLockAndCleanUp() { synchronized(monitor) { try { hotfolder.deleteIfExists(lockUri); } catch (IOException e) { logger.error("Error while deleting lock file: " + lockUri, e); } } } | LockFileHandler { public void deleteLockAndCleanUp() { synchronized(monitor) { try { hotfolder.deleteIfExists(lockUri); } catch (IOException e) { logger.error("Error while deleting lock file: " + lockUri, e); } } } } | LockFileHandler { public void deleteLockAndCleanUp() { synchronized(monitor) { try { hotfolder.deleteIfExists(lockUri); } catch (IOException e) { logger.error("Error while deleting lock file: " + lockUri, e); } } } } | LockFileHandler { public void deleteLockAndCleanUp() { synchronized(monitor) { try { hotfolder.deleteIfExists(lockUri); } catch (IOException e) { logger.error("Error while deleting lock file: " + lockUri, e); } } } void initConnection(String serverUrl, String user, String password); void createOrOverwriteLock(boolean ... | LockFileHandler { public void deleteLockAndCleanUp() { synchronized(monitor) { try { hotfolder.deleteIfExists(lockUri); } catch (IOException e) { logger.error("Error while deleting lock file: " + lockUri, e); } } } void initConnection(String serverUrl, String user, String password); void createOrOverwriteLock(boolean ... |
@Test public void shouldUploadToRemote() throws IOException, URISyntaxException { jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: verify(httpClientMock).executeMethod(any(PutMethod.class)); } | @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " doesn't exist."); throw new IllegalArgumentException("File " + sourceFile + " doesn't... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... |
@Test(expected=IllegalArgumentException.class) public void shouldFailWithNotExistingFile() throws IOException, URISyntaxException { when(fileAccessMock.fileExists(any(File.class))).thenReturn(false); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: } | @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " doesn't exist."); throw new IllegalArgumentException("File " + sourceFile + " doesn't... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... |
@Test(expected=IllegalStateException.class) public void shouldFailWhenIllegalStatusCode() throws IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HttpMethod.class))).thenReturn(403); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: } | @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " doesn't exist."); throw new IllegalArgumentException("File " + sourceFile + " doesn't... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... |
@Test public void shouldComplainAboutMissingOptions() throws UnsupportedEncodingException { main.execute(new String[]{"-indir", "/tmp"}); String outString = new String(baos.toByteArray()); assertThat(outString, containsString("Required options are missing. Use -help.")); } | void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting OCR...... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... | Main { void execute(String[] args) throws UnsupportedEncodingException { initOptions(args); if (terminated) { return; } OcrParameters params = transformOptions(); if (terminated) { return; } String validationMessage = paramValidator.validateParameters(params); if ("OK".equals(validationMessage)) { out.println("Starting... |
@Test public void shouldIgnoreOneIllegalStatusCode() throws IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HttpMethod.class))).thenReturn(403, 200); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: verify(httpClientMock, times(2)).executeMethod(any(PutMethod.class)); } | @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " doesn't exist."); throw new IllegalArgumentException("File " + sourceFile + " doesn't... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " do... |
@Test public void shouldDownloadToLocal() throws IOException, URISyntaxException { jackrabbitSut.download(new URI("http: verify(httpClientMock).executeMethod(any(GetMethod.class)); verify(fileAccessMock).copyStreamToFile(any(InputStream.class), any(File.class)); } | @Override public void download(URI fromRemote, URI toLocal) throws IOException { String sourceUri = fromRemote.toString(); File targetFile = new File(toLocal); GetMethod getMethod = new GetMethod(sourceUri); InputStream responseStream = null; try { responseStream = execute(getMethod); fileAccess.copyStreamToFile(respon... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void download(URI fromRemote, URI toLocal) throws IOException { String sourceUri = fromRemote.toString(); File targetFile = new File(toLocal); GetMethod getMethod = new GetMethod(sourceUri); InputStream responseStream = ... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void download(URI fromRemote, URI toLocal) throws IOException { String sourceUri = fromRemote.toString(); File targetFile = new File(toLocal); GetMethod getMethod = new GetMethod(sourceUri); InputStream responseStream = ... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void download(URI fromRemote, URI toLocal) throws IOException { String sourceUri = fromRemote.toString(); File targetFile = new File(toLocal); GetMethod getMethod = new GetMethod(sourceUri); InputStream responseStream = ... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void download(URI fromRemote, URI toLocal) throws IOException { String sourceUri = fromRemote.toString(); File targetFile = new File(toLocal); GetMethod getMethod = new GetMethod(sourceUri); InputStream responseStream = ... |
@Test public void shouldDelete() throws IOException, URISyntaxException { jackrabbitSut.delete(new URI("http: verify(httpClientMock).executeMethod(any(DeleteMethod.class)); } | @Override public void delete(URI uri) throws IOException { DeleteMethod delMethod = new DeleteMethod(uri.toString()); try { execute(delMethod); } finally { delMethod.releaseConnection(); } } | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void delete(URI uri) throws IOException { DeleteMethod delMethod = new DeleteMethod(uri.toString()); try { execute(delMethod); } finally { delMethod.releaseConnection(); } } } | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void delete(URI uri) throws IOException { DeleteMethod delMethod = new DeleteMethod(uri.toString()); try { execute(delMethod); } finally { delMethod.releaseConnection(); } } } | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void delete(URI uri) throws IOException { DeleteMethod delMethod = new DeleteMethod(uri.toString()); try { execute(delMethod); } finally { delMethod.releaseConnection(); } } void configureConnection(String serverUrl, St... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public void delete(URI uri) throws IOException { DeleteMethod delMethod = new DeleteMethod(uri.toString()); try { execute(delMethod); } finally { delMethod.releaseConnection(); } } void configureConnection(String serverUrl, St... |
@Test public void uriShouldExist() throws HttpException, IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HeadMethod.class))).thenReturn(200); assertTrue("URI must exist", jackrabbitSut.exists(new URI("http: } | @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false)); int responseCode = client.executeMethod(headMethod); if (responseCode == HttpStat... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... |
@Test public void uriShouldNotExist() throws HttpException, IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HeadMethod.class))).thenReturn(401); assertFalse("URI must not exist", jackrabbitSut.exists(new URI("http: } | @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false)); int responseCode = client.executeMethod(headMethod); if (responseCode == HttpStat... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public boolean exists(URI uri) throws IOException { HeadMethod headMethod = new HeadMethod(uri.toString()); try { headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(10, false))... |
@Test public void shouldTryToGetResponse() throws IOException, URISyntaxException { byte[] response = jackrabbitSut.getResponse(new URI("http: verify(httpClientMock).executeMethod(any(GetMethod.class)); assertFalse("Response may not be null", response == null); assertTrue("Response should be empty", response.length == ... | @Override public byte[] getResponse(URI uri) throws IOException { GetMethod getMethod = new GetMethod(uri.toString()); InputStream responseStream = null; try { responseStream = execute(getMethod); byte[] responseBytes = IOUtils.toByteArray(responseStream); return responseBytes; } finally { responseStream.close(); getMe... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public byte[] getResponse(URI uri) throws IOException { GetMethod getMethod = new GetMethod(uri.toString()); InputStream responseStream = null; try { responseStream = execute(getMethod); byte[] responseBytes = IOUtils.toByteArr... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public byte[] getResponse(URI uri) throws IOException { GetMethod getMethod = new GetMethod(uri.toString()); InputStream responseStream = null; try { responseStream = execute(getMethod); byte[] responseBytes = IOUtils.toByteArr... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public byte[] getResponse(URI uri) throws IOException { GetMethod getMethod = new GetMethod(uri.toString()); InputStream responseStream = null; try { responseStream = execute(getMethod); byte[] responseBytes = IOUtils.toByteArr... | JackrabbitHotfolder extends ServerHotfolder implements
Hotfolder, Serializable { @Override public byte[] getResponse(URI uri) throws IOException { GetMethod getMethod = new GetMethod(uri.toString()); InputStream responseStream = null; try { responseStream = execute(getMethod); byte[] responseBytes = IOUtils.toByteArr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.