use of io.hops.hopsworks.common.util.Settings in project hopsworks by logicalclocks.
the class FolderNameValidatorTest method testProjectNameRegexForUnderscoreFeaturestore.
@Test
public void testProjectNameRegexForUnderscoreFeaturestore() {
Settings settings = new Settings();
StringTokenizer tokenizer = new StringTokenizer(settings.getProjectNameReservedWordsTest(), ",");
HashSet<String> tokens = new HashSet<>(tokenizer.countTokens());
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken().trim());
}
Pattern projectNameRegexValidator = Pattern.compile(FolderNameValidator.getProjectNameRegexStr(tokens), Pattern.CASE_INSENSITIVE);
Matcher m = projectNameRegexValidator.matcher("a_FeaturestoreFoo");
boolean isValid = m.find();
Assert.assertFalse(isValid);
m = projectNameRegexValidator.matcher("a_FEATURESTORE");
isValid = m.find();
Assert.assertFalse(isValid);
m = projectNameRegexValidator.matcher("a_featurestore");
isValid = m.find();
Assert.assertFalse(isValid);
m = projectNameRegexValidator.matcher("featurestore_a");
isValid = m.find();
Assert.assertTrue(isValid);
}
use of io.hops.hopsworks.common.util.Settings in project hopsworks by logicalclocks.
the class FolderNameValidatorTest method testProjectNameRegex.
@Test
public void testProjectNameRegex() {
Settings settings = new Settings();
StringTokenizer tokenizer = new StringTokenizer(settings.getProjectNameReservedWordsTest(), ",");
HashSet<String> tokens = new HashSet<>(tokenizer.countTokens());
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken().trim());
}
Pattern projectNameRegexValidator = Pattern.compile(FolderNameValidator.getProjectNameRegexStr(tokens), Pattern.CASE_INSENSITIVE);
Matcher m = projectNameRegexValidator.matcher("VIEWS");
boolean isValid = m.find();
Assert.assertFalse(isValid);
m = projectNameRegexValidator.matcher("views");
isValid = m.find();
Assert.assertFalse(isValid);
m = projectNameRegexValidator.matcher("viewss");
isValid = m.find();
Assert.assertTrue(isValid);
}