use of com.abubusoft.kripton.processor.sqlite.grammars.uri.ContentUriChecker in project kripton by xcesco.
the class TestUriChecker method testExtractParameters.
@Test
public void testExtractParameters() {
String input = "content://androi.authority/test/${ input }/ test /${ detail.id}";
ContentUriChecker checker = ContentUriChecker.getInstance();
{
List<ContentUriPlaceHolder> result = checker.extract(input);
for (ContentUriPlaceHolder item : result) {
log(item.toString());
}
checkList(result, new ContentUriPlaceHolder(1, "input"), new ContentUriPlaceHolder(3, "detail.id"));
}
{
List<ContentUriPlaceHolder> result = checker.extract(input);
for (ContentUriPlaceHolder item : result) {
log(item.toString());
}
checkList(result, new ContentUriPlaceHolder(1, "input"), new ContentUriPlaceHolder(3, "detail.id"));
}
}
use of com.abubusoft.kripton.processor.sqlite.grammars.uri.ContentUriChecker in project kripton by xcesco.
the class TestUriChecker method testAuthorityWithVariableInPath.
@Test
public void testAuthorityWithVariableInPath() {
String input = "content://androi.authority/test/${ input1 }/${input2 }";
ContentUriChecker checker = ContentUriChecker.getInstance();
// check bind parameters
{
List<ContentUriPlaceHolder> aspected = new ArrayList<>();
aspected.add(new ContentUriPlaceHolder(1, "input1"));
aspected.add(new ContentUriPlaceHolder(2, "input2"));
List<ContentUriPlaceHolder> actual = checker.extract(input);
checkCollectionExactly(actual, aspected);
}
}
use of com.abubusoft.kripton.processor.sqlite.grammars.uri.ContentUriChecker in project kripton by xcesco.
the class TestUriChecker method testOK.
/**
* <p>
* OK
* </p>
*
* @throws Throwable
*/
@Test
public void testOK() throws Throwable {
String input = "content://androi.authority/test/${ input }";
log(input);
ContentUriChecker checker = ContentUriChecker.getInstance();
String actual = checker.replace(input, new UriPlaceHolderReplacerListener() {
@Override
public String onParameterName(int pathSegmentIndex, String name) {
log("segment : %s, name: [%s]", pathSegmentIndex, name);
return "?";
}
});
assertEquals(actual, "content://androi.authority/test/?");
}
use of com.abubusoft.kripton.processor.sqlite.grammars.uri.ContentUriChecker in project kripton by xcesco.
the class TestUriChecker method testAuthorityWithVariableInPathError2.
@Test(expected = AssertionError.class)
public void testAuthorityWithVariableInPathError2() {
String input = "content://androi.authority/test/#";
ContentUriChecker checker = ContentUriChecker.getInstance();
// verify sql
checker.verify(input);
// check bind parameters
{
List<ContentUriPlaceHolder> aspected = new ArrayList<>();
aspected.add(new ContentUriPlaceHolder(1, "input0"));
aspected.add(new ContentUriPlaceHolder(2, "input1"));
List<ContentUriPlaceHolder> actual = checker.extract(input);
checkCollectionExactly(actual, aspected);
}
}
Aggregations