Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,4 @@ public void testFeatureDefConfig() {
fail("Test failed", e);
}
}

@Test
public void testFeatureCareers() {
ConfigBuilder configBuilder = ConfigBuilder.get();
try {
FeatureDefConfig obsFeatureDefConfigObj
= configBuilder.buildFeatureDefConfig("frame-feature-careers-featureDef-offline.conf");
} catch (ConfigBuilderException e) {
fail("Test failed", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,56 +134,4 @@ public void testFeatureDefConfigFromManifest1() {
fail("Error in building config", e);
}
}

@Test(description = "Tests build of FeatureDefConfig object from a config file in external jar specified in a manifest")
public void testFeatureDefConfigFromManifest2() {
try {
FeatureDefConfig obsFeatureDefConfigObj = configBuilder.buildFeatureDefConfigFromManifest("config/manifest2.conf");

assertTrue(obsFeatureDefConfigObj.getAnchorsConfig().isPresent());
assertTrue(obsFeatureDefConfigObj.getSourcesConfig().isPresent());
assertTrue(obsFeatureDefConfigObj.getDerivationsConfig().isPresent());
} catch (ConfigBuilderException e) {
fail("Error in building config", e);
}
}

@Test(description = "Tests build of FeatureDefConfig object from local and external config files specified in a manifest")
public void testFeatureDefConfigFromManifest3() {
try {
FeatureDefConfig obsFeatureDefConfigObj = configBuilder.buildFeatureDefConfigFromManifest("config/manifest3.conf");

assertTrue(obsFeatureDefConfigObj.getAnchorsConfig().isPresent());
assertTrue(obsFeatureDefConfigObj.getSourcesConfig().isPresent());
assertTrue(obsFeatureDefConfigObj.getDerivationsConfig().isPresent());
} catch (ConfigBuilderException e) {
fail("Error in building config", e);
}
}

/*
@Test(description = "Tests build of JoinConfig object from single resource file")
public void testJoinConfigFromResource1() {
try {
JoinConfig obsJoinConfigObj1 = configBuilder.buildJoinConfig("dir1/join.conf");

assertEquals(obsJoinConfigObj1, expJoinConfigObj1);

} catch (ConfigBuilderException e) {
fail("Error in building config", e);
}
}

@Test(description = "Tests build of JoinConfig object with single configuration file specified by URL")
public void testJoinConfigFromUrl1() {
try {
URL url = new File("src/test/resources/dir1/join.conf").toURI().toURL();
JoinConfig obsJoinConfigObj1 = configBuilder.buildJoinConfig(url);

assertEquals(obsJoinConfigObj1, expJoinConfigObj1);

} catch (Throwable e) {
fail("Error in building config", e);
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ public static void init() {
_classLoader = Thread.currentThread().getContextClassLoader();
}

@Test(description = "A valid Frame config file with valid syntax should return true.")
public void testValidFrameConfigFile() {
URL url = _classLoader.getResource("frame-feature-careers-featureDef-offline.conf");

boolean configFile = FrameConfigFileChecker.isConfigFile(url);
assertTrue(configFile);
}

@Test(description = "Test that a txt file should throw exception.", expectedExceptions = ConfigBuilderException.class)
public void testTxtFile() {
URL url = _classLoader.getResource("Foo.txt");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -144,49 +144,4 @@ public void testFeatureDefAndJoinConfigSyntax() {
fail("Caught exception: " + e.getMessage(), e);
}
}

/**
* In galene library, Frame-Galene online scoring uses frame-core to read frame-galene.conf as FeatureDef conf.
* For now, we need to make sure the syntax used in frame-galene.conf is supported in validation
*/
@Test(description = "Tests syntax validation of an valid Frame-Galene scoring config")
public void testFrameGaleneScoringConfigWithValidSyntax() {
try (ConfigDataProvider cdp = new ResourceConfigDataProvider("frame-galene.conf")) {
ValidationResult obsResult = _validator.validate(FeatureDef, SYNTACTIC, cdp);
if (obsResult.getValidationStatus() != VALID) {
String details = obsResult.getDetails().orElse("");
}

assertEquals(obsResult.getValidationStatus(), VALID);

} catch (Exception e) {
fail("Caught exception: " + e.getMessage(), e);
}
}

@Test(description = "Tests build of identifying valid FrameGalene configs")
public void testFrameGaleneConfigValidCases() {
ConfigRenderOptions _renderOptions = ConfigRenderOptions.defaults()
.setComments(false)
.setOriginComments(false)
.setFormatted(true)
.setJson(true);
ConfigParseOptions _parseOptions = ConfigParseOptions.defaults()
.setSyntax(ConfigSyntax.CONF) // HOCON document
.setAllowMissing(false);
InputStream inputStream = JoinConfig.class.getClassLoader()
.getResourceAsStream("FeatureDefConfigSchema.json");
JSONObject rawSchema = new JSONObject(new JSONTokener(inputStream));
Schema schema = SchemaLoader.load(rawSchema);
Config myCfg = ConfigFactory.parseResources("frame-feature-careers-featureDef-offline.conf", _parseOptions);
String jsonStr = myCfg.root().render(_renderOptions);
JSONTokener tokener = new JSONTokener(jsonStr);
JSONObject root = new JSONObject(tokener);
try {
schema.validate(root);
} catch (ValidationException e) {
System.out.println(e.toJSON());
throw e;
}
}
}