mirror of
https://github.com/valitydev/geck.git
synced 2024-11-06 01:35:22 +00:00
JD-573: add library-parent-pom (#69)
* JD-573: add library-parent-pom Co-authored-by: Alexey Pronin <24279065+vulnbe@users.noreply.github.com>
This commit is contained in:
parent
16e3c4d3ec
commit
eac5a8a220
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@ -5,9 +5,8 @@ build('geck', 'docker-host') {
|
||||
|
||||
def javaLibPipeline
|
||||
runStage('load JavaLib pipeline') {
|
||||
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy")
|
||||
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLibInsideDocker.groovy")
|
||||
}
|
||||
|
||||
def buildImageTag = "07d3946f8f005782697de20270ac58cdcd18b011"
|
||||
javaLibPipeline(buildImageTag)
|
||||
javaLibPipeline()
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8cee874fda7c15061b4c8493a434b74b785840b5
|
||||
Subproject commit c12c9dd296912ec3c34ad443b448df98fef2556a
|
@ -7,11 +7,16 @@
|
||||
<parent>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.6.11</version>
|
||||
<version>0.6.12</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>common</artifactId>
|
||||
|
||||
<properties>
|
||||
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml</checkstyle.config.suppressions.path>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney.woody</groupId>
|
||||
|
@ -11,11 +11,11 @@ import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
||||
public class ClassFinder {
|
||||
|
||||
public static <T> Collection<Class<? extends T>> find(Collection<String> scannedPackages, String classNameSuffix, Class<T> classType) {
|
||||
public static <T> Collection<Class<? extends T>> find(Collection<String> scannedPackages,
|
||||
String classNameSuffix,
|
||||
Class<T> classType) {
|
||||
Set<Class<? extends T>> classes = new HashSet<>();
|
||||
for (String scannedPackage : scannedPackages) {
|
||||
classes.addAll(find(scannedPackage, classNameSuffix, classType));
|
||||
@ -23,7 +23,9 @@ public class ClassFinder {
|
||||
return classes;
|
||||
}
|
||||
|
||||
public static <T> Collection<Class<? extends T>> find(String scannedPackage, String classSuffix, Class<T> classType) {
|
||||
public static <T> Collection<Class<? extends T>> find(String scannedPackage,
|
||||
String classSuffix,
|
||||
Class<T> classType) {
|
||||
return new Reflections(scannedPackage)
|
||||
.getSubTypesOf(classType).stream()
|
||||
.filter(t -> t.getSimpleName().endsWith(classSuffix))
|
||||
|
@ -103,8 +103,9 @@ public final class StringUtil {
|
||||
int mask = 1 << i;
|
||||
result.append((number & mask) != 0 ? "1" : "0");
|
||||
|
||||
if (i % groupSize == 0 && i > 0)
|
||||
if (i % groupSize == 0 && i > 0) {
|
||||
result.append(" ");
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ public class TypeUtil {
|
||||
return stringToLocalDateTime(dateTimeStr, ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
public static LocalDateTime stringToLocalDateTime(String dateTimeStr, ZoneId zoneId) throws IllegalArgumentException {
|
||||
public static LocalDateTime stringToLocalDateTime(String dateTimeStr, ZoneId zoneId)
|
||||
throws IllegalArgumentException {
|
||||
try {
|
||||
return LocalDateTime.ofInstant(stringToInstant(dateTimeStr), zoneId);
|
||||
} catch (DateTimeException e) {
|
||||
|
@ -17,7 +17,9 @@ public class ClassFinderTest {
|
||||
assertNotNull(resources);
|
||||
assertTrue(resources.size() == 2);
|
||||
for (String resource : resources) {
|
||||
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)))) {
|
||||
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
|
||||
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)))
|
||||
) {
|
||||
assertEquals("{ \"tipa\": \"json\" }", bufferedReader.readLine());
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,16 @@
|
||||
<parent>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.6.11</version>
|
||||
<version>0.6.12</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>filter</artifactId>
|
||||
|
||||
<properties>
|
||||
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml</checkstyle.config.suppressions.path>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface Filter<T> {
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.filter;
|
||||
|
||||
|
||||
public interface Parser {
|
||||
|
||||
String getItem(int item);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.filter.kit.msgpack;
|
||||
|
||||
|
||||
abstract class MultiSelector extends Selector {
|
||||
|
||||
public MultiSelector(Type type) {
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.filter.Rule;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
class SelectionResult {
|
||||
final SelectionType type;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.filter.kit.msgpack;
|
||||
|
||||
|
||||
import com.rbkmoney.geck.filter.Condition;
|
||||
import com.rbkmoney.geck.filter.Rule;
|
||||
import com.rbkmoney.geck.serializer.StructHandleResult;
|
||||
|
@ -14,7 +14,6 @@ import java.util.List;
|
||||
import static com.rbkmoney.geck.filter.kit.msgpack.MatchKeySelector.MATCH_RULE;
|
||||
import static com.rbkmoney.geck.filter.kit.msgpack.SelectorParser.State.*;
|
||||
|
||||
|
||||
public class SelectorParser {
|
||||
enum State {
|
||||
EVAL_READY,
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.serializer.kit.EventFlags;
|
||||
|
||||
import static com.rbkmoney.geck.serializer.kit.EventFlags.endStruct;
|
||||
|
||||
|
||||
class StructSelector extends Selector {
|
||||
private final Rule rule;
|
||||
|
||||
|
@ -10,7 +10,6 @@ import java.util.function.Supplier;
|
||||
|
||||
import static com.rbkmoney.geck.serializer.StructHandleResult.*;
|
||||
|
||||
|
||||
class StructVisitor {
|
||||
private final Supplier<Selector.Config[]> cnfSupplier;
|
||||
private Selector.Config config;
|
||||
@ -113,7 +112,7 @@ class StructVisitor {
|
||||
return currConfig.context;
|
||||
}
|
||||
currConfig = currConfig.prevConfig;
|
||||
} while (currConfig != null);
|
||||
return currConfig == null ? null : currConfig.context;
|
||||
} while (currConfig != null);//NOSONAR
|
||||
return currConfig == null ? null : currConfig.context;//NOSONAR
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.filter.Parser;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class PathParser implements Parser {
|
||||
|
||||
private final String[] items;
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.filter.Parser;
|
||||
import com.rbkmoney.geck.filter.Rule;
|
||||
import com.rbkmoney.geck.filter.parser.PathParser;
|
||||
|
||||
|
||||
public class PathConditionRule implements Rule {
|
||||
|
||||
private final Parser parser;
|
||||
|
@ -14,10 +14,7 @@ import java.util.List;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class
|
||||
|
||||
PathConditionFilterTest {
|
||||
public class PathConditionFilterTest {
|
||||
|
||||
List<TestObject> testObjectList = new ArrayList<>();
|
||||
|
||||
|
@ -6,7 +6,15 @@ import com.rbkmoney.geck.filter.Rule;
|
||||
import com.rbkmoney.geck.filter.condition.EqualsCondition;
|
||||
import com.rbkmoney.geck.filter.condition.IsNullCondition;
|
||||
import com.rbkmoney.geck.filter.rule.ConditionRule;
|
||||
import com.rbkmoney.geck.filter.test.filter.*;
|
||||
import com.rbkmoney.geck.filter.test.filter.IData;
|
||||
import com.rbkmoney.geck.filter.test.filter.IDataCollection;
|
||||
import com.rbkmoney.geck.filter.test.filter.ILvl2Data;
|
||||
import com.rbkmoney.geck.filter.test.filter.ILvlData;
|
||||
import com.rbkmoney.geck.filter.test.filter.IStatusCanceled;
|
||||
import com.rbkmoney.geck.filter.test.filter.IStatusPaid;
|
||||
import com.rbkmoney.geck.filter.test.filter.Invoice;
|
||||
import com.rbkmoney.geck.filter.test.filter.InvoiceStatus;
|
||||
import com.rbkmoney.geck.filter.test.filter.MapTest;
|
||||
import com.rbkmoney.geck.serializer.kit.json.JsonHandler;
|
||||
import com.rbkmoney.geck.serializer.kit.msgpack.MsgPackHandler;
|
||||
import com.rbkmoney.geck.serializer.kit.msgpack.MsgPackProcessor;
|
||||
@ -15,66 +23,119 @@ import org.apache.thrift.TBase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
public class SelectorParserTest {
|
||||
|
||||
private static Invoice createInvoice(int invId, String details, String dataVal, InvoiceStatus invoiceStatus) {
|
||||
Invoice invoice = new Invoice(invId, invoiceStatus,
|
||||
new IData(dataVal) {{
|
||||
setDataOptVal("opt_data");
|
||||
}},
|
||||
new ILvlData() {{
|
||||
setLvl2Data1(new ILvl2Data("lvl21val1", "lvl21val2"));
|
||||
setLvl2Data2(new ILvl2Data("lvl22val1", "lvl22val2"));
|
||||
}}
|
||||
);
|
||||
invoice.setIDetails(details);
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
private static InvoiceStatus iPaidStatus(String date) {
|
||||
return InvoiceStatus.paid(new IStatusPaid(date) {
|
||||
{
|
||||
setValue("pvalue");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static InvoiceStatus iCanceledStatus(String details) {
|
||||
return InvoiceStatus.canceled(new IStatusCanceled(details) {
|
||||
{
|
||||
setValue("cvalue");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1LvlParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("id", new ConditionRule(new EqualsCondition(1L))), preparePaidSample1(""));
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("id", new ConditionRule(new EqualsCondition(1L))),
|
||||
preparePaidSample1(""));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2LvlNotNullParserParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("status.paid", new ConditionRule(new IsNullCondition().not())), preparePaidSample1(""));
|
||||
List<Rule> rules =
|
||||
applyRules(new SelectorParser().parse("status.paid", new ConditionRule(new IsNullCondition().not())),
|
||||
preparePaidSample1(""));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3LvlParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("status.canceled.details", new ConditionRule(new EqualsCondition("fail"))), prepareCanceledSample1("fail", ""));
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("status.canceled.details", new ConditionRule(new EqualsCondition("fail"))),
|
||||
prepareCanceledSample1("fail", ""));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnyNameParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("*", new ConditionRule(new EqualsCondition("i_details_p"))), preparePaidSample1(""));
|
||||
List<Rule> rules =
|
||||
applyRules(new SelectorParser().parse("*", new ConditionRule(new EqualsCondition("i_details_p"))),
|
||||
preparePaidSample1(""));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3LvlMiddleAnyNameParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("status.*.value", new ConditionRule(new EqualsCondition("pvalue"))), preparePaidSample1(""));
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("status.*.value", new ConditionRule(new EqualsCondition("pvalue"))),
|
||||
preparePaidSample1(""));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3LvlTailAnyNameParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("data.*", new ConditionRule(new EqualsCondition("data_val"))), preparePaidSample1("data_val"));
|
||||
List<Rule> rules =
|
||||
applyRules(new SelectorParser().parse("data.*", new ConditionRule(new EqualsCondition("data_val"))),
|
||||
preparePaidSample1("data_val"));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2LvlAnyNameParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("lvl_data.*.*", new ConditionRule(new EqualsCondition("lvl22val2"))), preparePaidSample1("data_val"));
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("lvl_data.*.*", new ConditionRule(new EqualsCondition("lvl22val2"))),
|
||||
preparePaidSample1("data_val"));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnyElemParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("data_coll.data_list.[*].data_val", new ConditionRule(new EqualsCondition("1"))), preparePaidSample2("value", true, 2));
|
||||
List<Rule> rules = applyRules(new SelectorParser()
|
||||
.parse("data_coll.data_list.[*].data_val", new ConditionRule(new EqualsCondition("1"))),
|
||||
preparePaidSample2("value", true, 2));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArrayNotExistsParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice2("value", true, 2);
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[]", new ConditionRule(obj -> true)), prepareSample(invoice));
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[]", new ConditionRule(obj -> true)),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@ -82,7 +143,8 @@ public class SelectorParserTest {
|
||||
public void testArrayExistsParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice2("value", true, 2);
|
||||
invoice.setIList(new ArrayList<>());
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[]", new ConditionRule(obj -> true)), prepareSample(invoice));
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[]", new ConditionRule(obj -> true)),
|
||||
prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@ -91,115 +153,93 @@ public class SelectorParserTest {
|
||||
Invoice invoice = createInvoice(1, "", "", InvoiceStatus.paid(new IStatusPaid()));
|
||||
invoice.setIList(Arrays.asList(0, 1, 2, 3));
|
||||
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[*]", new ConditionRule(new EqualsCondition(2L))), prepareSample(invoice));
|
||||
List<Rule> rules =
|
||||
applyRules(new SelectorParser().parse("i_list.[*]", new ConditionRule(new EqualsCondition(2L))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
|
||||
invoice.setIList(Arrays.asList());
|
||||
rules = applyRules(new SelectorParser().parse("i_list.[*]", new ConditionRule(new EqualsCondition(2L))), prepareSample(invoice));
|
||||
rules = applyRules(new SelectorParser().parse("i_list.[*]", new ConditionRule(new EqualsCondition(2L))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapExistsParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {{
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}", new ConditionRule(obj -> true)), prepareSample(invoice));
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {
|
||||
{
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}", new ConditionRule(obj -> true)),
|
||||
prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {{
|
||||
put(1, new IData("val1"));
|
||||
put(2, new IData("val2"));
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))), prepareSample(invoice));
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {
|
||||
{
|
||||
put(1, new IData("val1"));
|
||||
put(2, new IData("val2"));
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {{
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))), prepareSample(invoice));
|
||||
invoice.setIMap(new LinkedHashMap<Integer, IData>() {
|
||||
{
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))), prepareSample(invoice));
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("i_map.{*}.data_val", new ConditionRule(new EqualsCondition("val2"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testObjMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setObjMap(new LinkedHashMap(){{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("obj_map.{*}.data_val", new ConditionRule(new EqualsCondition("val3"))), prepareSample(invoice));
|
||||
invoice.setObjMap(new LinkedHashMap() {
|
||||
{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("obj_map.{*}.data_val", new ConditionRule(new EqualsCondition("val3"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2ObjMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setObjMap(new LinkedHashMap(){{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("obj_map.{*}.data_val", new ConditionRule(new EqualsCondition("val3"))), prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3ObjMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setObjMap(new LinkedHashMap(){{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}});
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("obj_map.{canceled}.data_val", new ConditionRule(new EqualsCondition("val2"))), prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
rules = applyRules(new SelectorParser().parse("obj_map.{canceled}.data_val", new ConditionRule(new EqualsCondition("val3"))), prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListMapKeyParser() throws IOException {
|
||||
MapTest mapTest = new MapTest();
|
||||
mapTest.setLstKeyMap(new HashMap<List<IData>, Integer>(){{
|
||||
put(Arrays.asList(), -1);
|
||||
}});
|
||||
|
||||
List<Rule> rules = null;/*applyRules(new SelectorParser().parse("lst_key_map.{[]}", new ConditionRule(new EqualsCondition(-1L))), prepareSample(mapTest));
|
||||
assertEquals(1, rules.size());*/
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{*}", new ConditionRule(new EqualsCondition(-1L))), prepareSample(mapTest));
|
||||
assertEquals(1, rules.size());
|
||||
|
||||
|
||||
mapTest.setLstKeyMap(new HashMap<List<IData>, Integer>(){{
|
||||
put(Arrays.asList(), 0);
|
||||
}});
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{[]}", new ConditionRule(new EqualsCondition(-1L))), prepareSample(mapTest));
|
||||
assertEquals(0, rules.size());
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{*}", new ConditionRule(new EqualsCondition(-1L))), prepareSample(mapTest));
|
||||
assertEquals(0, rules.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapNotExistsParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}", new ConditionRule(obj -> true)), prepareSample(invoice));
|
||||
invoice.setObjMap(new LinkedHashMap() {
|
||||
{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(
|
||||
new SelectorParser().parse("obj_map.{*}.data_val", new ConditionRule(new EqualsCondition("val3"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@ -209,10 +249,23 @@ public class SelectorParserTest {
|
||||
assertEquals(1, rules.size());
|
||||
}*/
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testBadFormat2MapExistsParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}.something", new ConditionRule(obj -> true)), preparePaidSample2("value", true, 2));
|
||||
@Test
|
||||
public void test3ObjMapKeyParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
invoice.setObjMap(new LinkedHashMap() {
|
||||
{
|
||||
put(iPaidStatus("p"), new IData("val1"));
|
||||
put(iCanceledStatus("c"), new IData("val2"));
|
||||
}
|
||||
});
|
||||
List<Rule> rules = applyRules(new SelectorParser()
|
||||
.parse("obj_map.{canceled}.data_val", new ConditionRule(new EqualsCondition("val2"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(1, rules.size());
|
||||
rules = applyRules(new SelectorParser()
|
||||
.parse("obj_map.{canceled}.data_val", new ConditionRule(new EqualsCondition("val3"))),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
/*@Test(expected = IllegalArgumentException.class)
|
||||
@ -221,9 +274,58 @@ public class SelectorParserTest {
|
||||
assertEquals(1, rules.size());
|
||||
}*/
|
||||
|
||||
@Test
|
||||
public void testListMapKeyParser() throws IOException {
|
||||
MapTest mapTest = new MapTest();
|
||||
mapTest.setLstKeyMap(new HashMap<List<IData>, Integer>() {
|
||||
{
|
||||
put(Arrays.asList(), -1);
|
||||
}
|
||||
});
|
||||
|
||||
List<Rule> rules = null;/*applyRules(new SelectorParser().parse("lst_key_map.{[]}", new ConditionRule(new EqualsCondition(-1L))), prepareSample(mapTest));
|
||||
assertEquals(1, rules.size());*/
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{*}", new ConditionRule(new EqualsCondition(-1L))),
|
||||
prepareSample(mapTest));
|
||||
assertEquals(1, rules.size());
|
||||
|
||||
|
||||
mapTest.setLstKeyMap(new HashMap<List<IData>, Integer>() {
|
||||
{
|
||||
put(Arrays.asList(), 0);
|
||||
}
|
||||
});
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{[]}", new ConditionRule(new EqualsCondition(-1L))),
|
||||
prepareSample(mapTest));
|
||||
assertEquals(0, rules.size());
|
||||
|
||||
rules = applyRules(new SelectorParser().parse("lst_key_map.{*}", new ConditionRule(new EqualsCondition(-1L))),
|
||||
prepareSample(mapTest));
|
||||
assertEquals(0, rules.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapNotExistsParser() throws IOException {
|
||||
Invoice invoice = preparePaidInvoice1("value");
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}", new ConditionRule(obj -> true)),
|
||||
prepareSample(invoice));
|
||||
assertEquals(0, rules.size());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testBadFormat2MapExistsParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_map.{}.something", new ConditionRule(obj -> true)),
|
||||
preparePaidSample2("value", true, 2));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testBadFormat2ArrayExistsParser() throws IOException {
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[].something", new ConditionRule(obj -> true)), preparePaidSample2("value", true, 2));
|
||||
List<Rule> rules = applyRules(new SelectorParser().parse("i_list.[].something", new ConditionRule(obj -> true)),
|
||||
preparePaidSample2("value", true, 2));
|
||||
assertEquals(1, rules.size());
|
||||
}
|
||||
|
||||
@ -271,41 +373,15 @@ public class SelectorParserTest {
|
||||
private void printJson(TBase object) throws IOException {
|
||||
JsonNode node = new TBaseProcessor().process(object, new JsonHandler(true));
|
||||
|
||||
System.out.printf("%nData: %n %s %n =========================================================%n", new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(node));
|
||||
System.out.printf("%nData: %n %s %n =========================================================%n",
|
||||
new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(node));
|
||||
}
|
||||
|
||||
private void setIDataCollection(Invoice invoice, boolean useList, int elemCount) {
|
||||
Collection<IData> collection = useList ? new ArrayList<>() : new HashSet<>();
|
||||
IntStream.range(0, elemCount).forEach(i -> collection.add(new IData("" + i)));
|
||||
invoice.setDataColl(useList ? IDataCollection.data_list((List<IData>) collection) : IDataCollection.data_set((Set<IData>) collection));
|
||||
}
|
||||
|
||||
|
||||
private static Invoice createInvoice(int invId, String details, String dataVal, InvoiceStatus invoiceStatus) {
|
||||
Invoice invoice = new Invoice(invId, invoiceStatus,
|
||||
new IData(dataVal) {{
|
||||
setDataOptVal("opt_data");
|
||||
}},
|
||||
new ILvlData() {{
|
||||
setLvl2Data1(new ILvl2Data("lvl21val1", "lvl21val2"));
|
||||
setLvl2Data2(new ILvl2Data("lvl22val1", "lvl22val2"));
|
||||
}}
|
||||
);
|
||||
invoice.setIDetails(details);
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
private static InvoiceStatus iPaidStatus(String date) {
|
||||
return InvoiceStatus.paid(new IStatusPaid(date) {{
|
||||
setValue("pvalue");
|
||||
}});
|
||||
}
|
||||
|
||||
private static InvoiceStatus iCanceledStatus(String details) {
|
||||
return InvoiceStatus.canceled(new IStatusCanceled(details) {{
|
||||
setValue("cvalue");
|
||||
}});
|
||||
invoice.setDataColl(useList ? IDataCollection.data_list((List<IData>) collection) :
|
||||
IDataCollection.data_set((Set<IData>) collection));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
public class PathParserTest {
|
||||
|
||||
@Test
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
@ -17,7 +11,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class Fail implements org.apache.thrift.TBase<Fail, Fail._Fields>, java.io.Serializable, Cloneable, Comparable<Fail> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Fail");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
@ -17,7 +11,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class Ids implements org.apache.thrift.TBase<Ids, Ids._Fields>, java.io.Serializable, Cloneable, Comparable<Ids> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Ids");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
@ -15,7 +9,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class Ok implements org.apache.thrift.TBase<Ok, Ok._Fields>, java.io.Serializable, Cloneable, Comparable<Ok> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Ok");
|
||||
|
@ -1,16 +1,9 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
public class Status extends org.apache.thrift.TUnion<Status, Status._Fields> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Status");
|
||||
private static final org.apache.thrift.protocol.TField OK_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("ok_status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
@ -17,7 +11,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class TestObject implements org.apache.thrift.TBase<TestObject, TestObject._Fields>, java.io.Serializable, Cloneable, Comparable<TestObject> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TestObject");
|
||||
|
@ -1,12 +1,5 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
|
||||
import org.apache.thrift.TEnum;
|
||||
|
||||
public enum Type implements TEnum {
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
@ -16,7 +10,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class Unknown implements org.apache.thrift.TBase<Unknown, Unknown._Fields>, java.io.Serializable, Cloneable, Comparable<Unknown> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Unknown");
|
||||
|
@ -1,16 +1,9 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
public class UnknownType extends org.apache.thrift.TUnion<UnknownType, UnknownType._Fields> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UnknownType");
|
||||
private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
@ -16,7 +10,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class IData implements org.apache.thrift.TBase<IData, IData._Fields>, java.io.Serializable, Cloneable, Comparable<IData> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IData");
|
||||
|
@ -1,16 +1,9 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
public class IDataCollection extends org.apache.thrift.TUnion<IDataCollection, IDataCollection._Fields> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IDataCollection");
|
||||
private static final org.apache.thrift.protocol.TField DATA_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("data_list", org.apache.thrift.protocol.TType.LIST, (short)1);
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
@ -16,7 +10,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class ILvl2Data implements org.apache.thrift.TBase<ILvl2Data, ILvl2Data._Fields>, java.io.Serializable, Cloneable, Comparable<ILvl2Data> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ILvl2Data");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
@ -15,7 +9,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class ILvlData implements org.apache.thrift.TBase<ILvlData, ILvlData._Fields>, java.io.Serializable, Cloneable, Comparable<ILvlData> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ILvlData");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
@ -16,7 +10,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class IStatusCanceled implements org.apache.thrift.TBase<IStatusCanceled, IStatusCanceled._Fields>, java.io.Serializable, Cloneable, Comparable<IStatusCanceled> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IStatusCanceled");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
@ -15,7 +9,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class IStatusPaid implements org.apache.thrift.TBase<IStatusPaid, IStatusPaid._Fields>, java.io.Serializable, Cloneable, Comparable<IStatusPaid> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IStatusPaid");
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
@ -16,7 +10,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class Invoice implements org.apache.thrift.TBase<Invoice, Invoice._Fields>, java.io.Serializable, Cloneable, Comparable<Invoice> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Invoice");
|
||||
|
@ -1,16 +1,9 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
public class InvoiceStatus extends org.apache.thrift.TUnion<InvoiceStatus, InvoiceStatus._Fields> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvoiceStatus");
|
||||
private static final org.apache.thrift.protocol.TField PAID_FIELD_DESC = new org.apache.thrift.protocol.TField("paid", org.apache.thrift.protocol.TType.STRUCT, (short)1);
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package com.rbkmoney.geck.filter.test.filter;
|
||||
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
@ -15,7 +9,6 @@ import org.apache.thrift.scheme.TupleScheme;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
|
||||
public class MapTest implements org.apache.thrift.TBase<MapTest, MapTest._Fields>, java.io.Serializable, Cloneable, Comparable<MapTest> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("MapTest");
|
||||
|
@ -7,11 +7,16 @@
|
||||
<parent>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.6.11</version>
|
||||
<version>0.6.12</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>migrator</artifactId>
|
||||
|
||||
<properties>
|
||||
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml</checkstyle.config.suppressions.path>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public class MigrationException extends Exception {
|
||||
public MigrationException() {
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public interface MigrationManager {
|
||||
<I, O> O migrate(I src, ThriftSpec thriftSpec, SerializerSpec<I, O> serializerSpec) throws MigrationException;
|
||||
<T> T migrate(T src, ThriftDef thriftDef, SerializerDef<T> serializerDef) throws MigrationException;
|
||||
|
@ -11,7 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class MigrationManagerBuilder {
|
||||
private Map<String, Migrator> migratorsMap = new HashMap<>();
|
||||
private List<MigrationPointProvider> providers = new ArrayList<>();
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public class MigrationPoint {
|
||||
private final long id;
|
||||
private final ThriftSpec thriftSpec;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public interface MigrationSpec<T> {
|
||||
T getSpec();
|
||||
String getType();
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface MigrationStore {
|
||||
List<MigrationPoint> getMigrations(ThriftSpec thriftSpec) throws MigrationException;
|
||||
int getLastVersion() throws MigrationException;
|
||||
|
@ -3,7 +3,6 @@ package com.rbkmoney.geck.migrator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public enum MigrationType {
|
||||
JOLT("JOLT"),
|
||||
JOBJECT("JOBJECT"),
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public interface Migrator {
|
||||
/**
|
||||
* @param serializerSpec specifies input data format and expected output data format
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class SerializerDef<T> {
|
||||
private final String type;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.migrator;
|
||||
|
||||
|
||||
public interface SerializerSpec<I, O> {
|
||||
SerializerDef<I> getInDef();
|
||||
SerializerDef<O> getOutDef();
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class ThriftDef {
|
||||
public static final int NO_VERSION = -1;
|
||||
private final String type;
|
||||
@ -30,8 +29,8 @@ public class ThriftDef {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof ThriftDef)) return false;
|
||||
ThriftDef thriftDef = (ThriftDef) o;
|
||||
return getVersion() == thriftDef.getVersion() &&
|
||||
Objects.equals(getType(), thriftDef.getType());
|
||||
return getVersion() == thriftDef.getVersion()
|
||||
&& Objects.equals(getType(), thriftDef.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class ThriftSpec {
|
||||
private final ThriftDef inDef;
|
||||
private final ThriftDef outDef;
|
||||
@ -25,8 +24,8 @@ public class ThriftSpec {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof ThriftSpec)) return false;
|
||||
ThriftSpec that = (ThriftSpec) o;
|
||||
return Objects.equals(inDef, that.inDef) &&
|
||||
Objects.equals(outDef, that.outDef);
|
||||
return Objects.equals(inDef, that.inDef)
|
||||
&& Objects.equals(outDef, that.outDef);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,6 @@ import com.rbkmoney.geck.serializer.StructProcessor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public abstract class AbstractMigrator implements Migrator {
|
||||
private final SerializerProvider serializerProvider;
|
||||
|
||||
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
public class BaseMigrationManager implements MigrationManager {
|
||||
private final ConcurrentHashMap<ThriftSpec, List<MigrationPoint>> cache = new ConcurrentHashMap<>();
|
||||
private final Map<String, Migrator> migrators = new HashMap<>();
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator.kit;
|
||||
|
||||
import com.rbkmoney.geck.migrator.MigrationSpec;
|
||||
|
||||
|
||||
public class BaseMigrationSpec<T> implements MigrationSpec<T> {
|
||||
private final T spec;
|
||||
private final String type;
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.migrator.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class BaseMigrationStore implements MigrationStore {
|
||||
|
||||
private final List<MigrationPointProvider> providers;
|
||||
|
@ -12,7 +12,6 @@ import com.rbkmoney.geck.serializer.kit.object.ObjectProcessor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BaseSerializerProvider implements SerializerProvider {
|
||||
private final List<SerializerProvider> providers;
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class BaseSerializerSpec<I, O> implements SerializerSpec<I, O> {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof BaseSerializerSpec)) return false;
|
||||
BaseSerializerSpec that = (BaseSerializerSpec) o;
|
||||
return Objects.equals(inDef, that.inDef) &&
|
||||
Objects.equals(outDef, that.outDef);
|
||||
return Objects.equals(inDef, that.inDef)
|
||||
&& Objects.equals(outDef, that.outDef);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface MigrationPointProvider {
|
||||
/**
|
||||
* Get all thrift version transitions known to this provider. If provider knows about specific thrift version but doesn't have migration spec,
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.migrator.SerializerSpec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class MutableSerializerSpec<I, O> implements SerializerSpec<I, O> {
|
||||
private SerializerDef<I> inDef;
|
||||
private SerializerDef<O> outDef;
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.migrator.kit;
|
||||
|
||||
import com.rbkmoney.geck.migrator.ThriftDef;
|
||||
|
||||
|
||||
public class MutableThriftDef extends ThriftDef {
|
||||
private int version;
|
||||
private String type;
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.migrator.ThriftDef;
|
||||
import com.rbkmoney.geck.serializer.StructHandler;
|
||||
import com.rbkmoney.geck.serializer.StructProcessor;
|
||||
|
||||
|
||||
public interface SerializerProvider {
|
||||
<S> StructProcessor<S> getStructProcessor(SerializerDef<S> sDef, ThriftDef srcTypeDef);
|
||||
<R> StructHandler<R> getStructHandler(SerializerDef<R> sDef, ThriftDef resTypeDef);
|
||||
|
@ -4,7 +4,6 @@ import com.bazaarvoice.jolt.Chainr;
|
||||
import com.rbkmoney.geck.migrator.*;
|
||||
import com.rbkmoney.geck.migrator.kit.AbstractMigrator;
|
||||
|
||||
|
||||
public class JoltMigrator extends AbstractMigrator {
|
||||
public static final SerializerDef<Object> SERIALIZER_DEF = new SerializerDef<>(MigrationType.JOLT.getKey());
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.rbkmoney.geck.migrator.kit.jolt;
|
||||
import com.bazaarvoice.jolt.Chainr;
|
||||
import com.rbkmoney.geck.migrator.ThriftSpec;
|
||||
|
||||
|
||||
public class JoltSpec {
|
||||
|
||||
private final ThriftSpec thriftSpec;
|
||||
|
@ -6,7 +6,6 @@ import com.rbkmoney.geck.migrator.MigrationType;
|
||||
import com.rbkmoney.geck.migrator.SerializerSpec;
|
||||
import com.rbkmoney.geck.migrator.kit.AbstractMigrator;
|
||||
|
||||
|
||||
public class NopMigrator extends AbstractMigrator {
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,6 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class ObjectMigrationPointProvider extends SimpleMigrationPointProvider {
|
||||
private static final Logger log = LoggerFactory.getLogger(ObjectMigrationPointProvider.class);
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.rbkmoney.geck.common.util.TypeUtil;
|
||||
import com.rbkmoney.geck.migrator.*;
|
||||
import com.rbkmoney.geck.migrator.kit.AbstractMigrator;
|
||||
|
||||
|
||||
public class ObjectMigrator extends AbstractMigrator {
|
||||
public static final SerializerDef<Object> SERIALIZER_DEF = new SerializerDef<>(MigrationType.JOBJECT.getKey());
|
||||
@Override
|
||||
|
@ -11,7 +11,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class TestBaseMigrationManager {
|
||||
|
||||
@Test
|
||||
|
@ -16,7 +16,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
public class JoltMigratorTest {
|
||||
|
||||
@Test
|
||||
|
@ -6,7 +6,6 @@ import com.rbkmoney.geck.migrator.ThriftSpec;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class ObjectMigration3Spec implements ObjectSpec {
|
||||
@Override
|
||||
public Object apply(Object in) throws MigrationException {
|
||||
|
@ -12,7 +12,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class TestObjectMigration {
|
||||
|
||||
@Test
|
||||
|
@ -7,7 +7,6 @@ import com.rbkmoney.geck.migrator.kit.object.ObjectSpec;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class ObjectMigration0Spec implements ObjectSpec {
|
||||
@Override
|
||||
public Object apply(Object in) throws MigrationException {
|
||||
|
@ -7,7 +7,6 @@ import com.rbkmoney.geck.migrator.kit.object.ObjectSpec;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class ObjectMigration4Spec implements ObjectSpec {
|
||||
@Override
|
||||
public Object apply(Object in) throws MigrationException {
|
||||
|
6
pom.xml
6
pom.xml
@ -6,13 +6,13 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<artifactId>library-parent-pom</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.6.11</version>
|
||||
<version>0.6.12</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Geck</name>
|
||||
|
@ -7,12 +7,17 @@
|
||||
<parent>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.6.11</version>
|
||||
<version>0.6.12</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>serializer</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml</checkstyle.config.suppressions.path>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney.geck</groupId>
|
||||
@ -43,6 +48,11 @@
|
||||
<groupId>com.bazaarvoice.jolt</groupId>
|
||||
<artifactId>json-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@ -75,7 +85,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.9.0</version>
|
||||
<version>3.12.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -9,7 +9,6 @@ import org.apache.thrift.TBase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class Geck {
|
||||
|
||||
public static String toJson(TBase src) {
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public interface StructHandler<R> {
|
||||
|
||||
byte DEFAULT_FIELD_ID = Byte.MIN_VALUE;
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public interface StructProcessor<S> {
|
||||
|
||||
<R> R process(S value, StructHandler<R> handler) throws IOException;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.rbkmoney.geck.serializer.kit;
|
||||
|
||||
|
||||
public class EventFlags {
|
||||
public static final byte nop = 0;
|
||||
public static final byte startStruct = 1;
|
||||
|
@ -3,7 +3,6 @@ package com.rbkmoney.geck.serializer.kit;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public enum StructType {
|
||||
MAP("map"),
|
||||
SET("set"),
|
||||
|
@ -13,7 +13,6 @@ import com.rbkmoney.geck.serializer.kit.StructType;
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
public class JsonHandler implements StructHandler<JsonNode> {
|
||||
|
||||
public static final String KEY = "key";
|
||||
|
@ -11,7 +11,6 @@ import java.util.Base64;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class JsonProcessor implements StructProcessor<JsonNode> {
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,6 @@ import org.apache.thrift.TBase;
|
||||
import org.apache.thrift.TEnum;
|
||||
import org.apache.thrift.TFieldIdEnum;
|
||||
|
||||
|
||||
public class FixedValueGenerator implements ValueGenerator {
|
||||
@Override
|
||||
public byte getByte() {
|
||||
|
@ -11,7 +11,6 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class MockTBaseProcessor extends TBaseProcessor {
|
||||
|
||||
private final MockMode mode;
|
||||
|
@ -6,7 +6,6 @@ import org.apache.thrift.TFieldIdEnum;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class RandomValueGenerator implements ValueGenerator {
|
||||
|
||||
public int randomNumber(int bitSize) {
|
||||
|
@ -4,7 +4,6 @@ import org.apache.thrift.TBase;
|
||||
import org.apache.thrift.TEnum;
|
||||
import org.apache.thrift.TFieldIdEnum;
|
||||
|
||||
|
||||
public interface ValueGenerator {
|
||||
byte getByte();
|
||||
|
||||
|
@ -13,7 +13,6 @@ import org.msgpack.core.buffer.ArrayBufferOutput;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
public abstract class MsgPackHandler<R> implements StructHandler<R> {
|
||||
|
||||
private final boolean useDictionary;
|
||||
|
@ -17,7 +17,6 @@ import java.io.IOException;
|
||||
import static com.rbkmoney.geck.serializer.StructHandleResult.*;
|
||||
import static com.rbkmoney.geck.serializer.kit.EventFlags.*;
|
||||
|
||||
|
||||
public abstract class MsgPackProcessor<S> implements StructProcessor<S> {
|
||||
private final TCharObjectHashMap<String> dictionary;
|
||||
private final char noDictEntryValue = 0;
|
||||
|
@ -13,7 +13,6 @@ import java.util.*;
|
||||
import static com.rbkmoney.geck.serializer.kit.EventFlags.*;
|
||||
import static com.rbkmoney.geck.serializer.kit.object.ObjectHandlerConstants.*;
|
||||
|
||||
|
||||
public class ObjectHandler implements StructHandler<Object> {
|
||||
private final ByteStack state = new ByteStack(nop);
|
||||
private final ObjectStack context = new ObjectStack(null);
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.serializer.kit.object;
|
||||
|
||||
import com.rbkmoney.geck.serializer.kit.StructType;
|
||||
|
||||
|
||||
class ObjectHandlerConstants {
|
||||
public static final char ESCAPE_CHAR = '\\';
|
||||
public static final char TYPE_DELIMITER = '@';
|
||||
|
@ -12,7 +12,6 @@ import java.util.*;
|
||||
|
||||
import static com.rbkmoney.geck.serializer.kit.object.ObjectHandlerConstants.TYPE_DELIMITER;
|
||||
|
||||
|
||||
public class ObjectProcessor implements StructProcessor<Object> {
|
||||
@Override
|
||||
public <R> R process(Object value, StructHandler<R> handler) throws IOException {
|
||||
|
@ -18,7 +18,6 @@ import java.util.*;
|
||||
|
||||
import static com.rbkmoney.geck.serializer.kit.EventFlags.*;
|
||||
|
||||
|
||||
public class TBaseHandler<R extends TBase> implements StructHandler<R> {
|
||||
|
||||
private final Class<R> parentClass;
|
||||
|
@ -17,7 +17,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class TBaseProcessor implements StructProcessor<TBase> {
|
||||
|
||||
private final boolean checkRequiredFields;
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.serializer.kit.tbase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TDomainToStringErrorHandler extends TErrorHandler<String> {
|
||||
private StringBuilder builder;
|
||||
private final String CODE_NAME = "code";
|
||||
|
@ -4,7 +4,6 @@ import com.rbkmoney.geck.serializer.StructHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
abstract class TErrorHandler<R> implements StructHandler<R> {
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.damsel.payment_processing.errors.PaymentFailure;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TErrorUtil {
|
||||
public static Failure toGeneral(PaymentFailure failure) {
|
||||
try {
|
||||
|
@ -5,7 +5,6 @@ import com.rbkmoney.geck.serializer.StructProcessor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TTypedStringToDomainErrorProcessor implements StructProcessor<String> {
|
||||
@Override
|
||||
public <R> R process(String value, StructHandler<R> handler) throws IOException {
|
||||
|
@ -7,7 +7,6 @@ import com.rbkmoney.geck.serializer.exception.BadFormatException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TTypedToDomainErrorHandler extends TErrorHandler<Failure> {
|
||||
private Failure failure;
|
||||
private ObjectStack<SubFailure> subFailures = new ObjectStack<>();
|
||||
|
@ -2,7 +2,6 @@ package com.rbkmoney.geck.serializer.kit.tbase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TTypedToStringErrorHandler extends TDomainToStringErrorHandler {
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,6 @@ package com.rbkmoney.geck.serializer.kit.tbase;
|
||||
import org.apache.thrift.meta_data.FieldValueMetaData;
|
||||
import org.apache.thrift.protocol.TType;
|
||||
|
||||
|
||||
public enum ThriftType {
|
||||
|
||||
NULL(-1),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user