Skip to content

Commit d5e0791

Browse files
committed
Merge remote-tracking branch 'origin/issue/CDM-20' into issue/CDM-22a
2 parents dd457db + 8cb5c7e commit d5e0791

File tree

2 files changed

+55
-10
lines changed

2 files changed

+55
-10
lines changed

src/main/java/datastax/astra/migrate/cql/features/AbstractFeature.java

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,47 +59,83 @@ public String getAsString(Enum<?> key) {
5959

6060
@Override
6161
public String getString(Enum<?> key) {
62-
return !isEnabled ? null : strings.get(key);
62+
return !isEnabled ? null : getRawString(key);
63+
}
64+
65+
protected String getRawString(Enum<?> key) {
66+
return strings.get(key);
6367
}
6468

6569
@Override
6670
public Boolean getBoolean(Enum<?> key) {
67-
return !isEnabled ? null : booleans.get(key);
71+
return !isEnabled ? null : getRawBoolean(key);
72+
}
73+
74+
protected Boolean getRawBoolean(Enum<?> key) {
75+
return booleans.get(key);
6876
}
6977

7078
@Override
7179
public Number getNumber(Enum<?> key) {
72-
return !isEnabled ? null : numbers.get(key);
80+
return !isEnabled ? null : getRawNumber(key);
81+
}
82+
83+
protected Number getRawNumber(Enum<?> key) {
84+
return numbers.get(key);
7385
}
7486

7587
@Override
7688
public Integer getInteger(Enum<?> key) {
77-
return !isEnabled ? null : PropertyHelper.toInteger(numbers.get(key));
89+
return !isEnabled ? null : getRawInteger(key);
90+
}
91+
92+
protected Integer getRawInteger(Enum<?> key) {
93+
return PropertyHelper.toInteger(getRawNumber(key));
7894
}
7995

8096
@Override
8197
public MigrateDataType getMigrateDataType(Enum<?> key) {
82-
return !isEnabled ? null : migrateDataTypes.get(key);
98+
return !isEnabled ? null : getRawMigrateDataType(key);
99+
}
100+
101+
protected MigrateDataType getRawMigrateDataType(Enum<?> key) {
102+
return migrateDataTypes.get(key);
83103
}
84104

85105
@Override
86106
public List<String> getStringList(Enum<?> key) {
87-
return !isEnabled ? null : stringLists.get(key);
107+
return !isEnabled ? null : getRawStringList(key);
108+
}
109+
110+
protected List<String> getRawStringList(Enum<?> key) {
111+
return stringLists.get(key);
88112
}
89113

90114
@Override
91115
public List<Number> getNumberList(Enum<?> key) {
92-
return !isEnabled ? null : numberLists.get(key);
116+
return !isEnabled ? null : getRawNumberList(key);
117+
}
118+
119+
protected List<Number> getRawNumberList(Enum<?> key) {
120+
return numberLists.get(key);
93121
}
94122

95123
@Override
96124
public List<Integer> getIntegerList(Enum<?> key) {
97-
return !isEnabled ? null : PropertyHelper.toIntegerList(numberLists.get(key));
125+
return !isEnabled ? null : getRawIntegerList(key);
126+
}
127+
128+
protected List<Integer> getRawIntegerList(Enum<?> key) {
129+
return PropertyHelper.toIntegerList(getRawNumberList(key));
98130
}
99131

100132
@Override
101133
public List<MigrateDataType> getMigrateDataTypeList(Enum key) {
102-
return !isEnabled ? null : migrateDataTypeLists.get(key);
134+
return !isEnabled ? null : getRawMigrateDataTypeList(key);
135+
}
136+
137+
protected List<MigrateDataType> getRawMigrateDataTypeList(Enum key) {
138+
return migrateDataTypeLists.get(key);
103139
}
104140

105141
protected void putString(Enum<?> key, String value) {

src/test/java/datastax/astra/migrate/cql/features/AbstractFeatureTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,16 @@ public void valueSet_butDisabled() {
150150
() -> assertEquals("", testFeature.getAsString(TestProperty.MIGRATE_DATA_TYPE)),
151151
() -> assertEquals("", testFeature.getAsString(TestProperty.STRING_LIST)),
152152
() -> assertEquals("", testFeature.getAsString(TestProperty.NUMBER_LIST)),
153-
() -> assertEquals("", testFeature.getAsString(TestProperty.MIGRATE_DATA_TYPE_LIST))
153+
() -> assertEquals("", testFeature.getAsString(TestProperty.MIGRATE_DATA_TYPE_LIST)),
154+
() -> assertEquals("test", testFeature.getRawString(TestProperty.STRING)),
155+
() -> assertEquals(Integer.MAX_VALUE, testFeature.getRawNumber(TestProperty.NUMBER)),
156+
() -> assertEquals(Integer.MAX_VALUE, testFeature.getRawInteger(TestProperty.NUMBER)),
157+
() -> assertTrue(testFeature.getRawBoolean(TestProperty.BOOLEAN)),
158+
() -> assertEquals(new MigrateDataType("0"), testFeature.getRawMigrateDataType(TestProperty.MIGRATE_DATA_TYPE)),
159+
() -> assertEquals(Arrays.asList("a","b","c"), testFeature.getRawStringList(TestProperty.STRING_LIST)),
160+
() -> assertEquals(Arrays.asList(1,2,3), testFeature.getRawNumberList(TestProperty.NUMBER_LIST)),
161+
() -> assertEquals(Arrays.asList(1,2,3), testFeature.getRawIntegerList(TestProperty.NUMBER_LIST)),
162+
() -> assertEquals(Arrays.asList(new MigrateDataType("0"), new MigrateDataType("1"), new MigrateDataType("2")), testFeature.getRawMigrateDataTypeList(TestProperty.MIGRATE_DATA_TYPE_LIST))
154163
);
155164
}
156165

0 commit comments

Comments
 (0)