Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3

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 @@ -60,12 +60,6 @@ public final QName getDefinitionQName() {
return definitionQName.get();
}

@Override
public final boolean isInline() {
// never inline
return false;
}

@Override
public final INSTANCE getInlineInstance() {
// never inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ public Class<? extends IBoundObject> getBoundClassForXmlQName(QName rootQName) {
public Class<? extends IBoundObject> getBoundClassForJsonName(String rootName) {
return getRootJsonName().equals(rootName) ? getClazz() : null;
}

@Override
public String toString() {
return getDefinition().getRootXmlQName().toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public interface IBoundDefinitionModelComplex
@NonNull
Map<String, IBoundProperty<?>> getJsonProperties(@Nullable Predicate<IBoundInstanceFlag> flagFilter);

@Override
default boolean isInline() {
return getBoundClass().getEnclosingClass() != null;
}

@Nullable
Method getBeforeDeserializeMethod();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ public final QName getDefinitionQName() {
return definitionQName.get();
}

@Override
public boolean isInline() {
return getBoundClass().getEnclosingClass() != null;
}

@Override
public Method getBeforeDeserializeMethod() {
return beforeDeserializeMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ public ExitStatus execute() {

IValidationResult validationResult = null;
try {
IModule module = getModule(getCommandLine(), bindingContext);
if (!cmdLine.hasOption(NO_SCHEMA_VALIDATION_OPTION)) {
IModule module = getModule(getCommandLine(), bindingContext);
// perform schema validation
validationResult = getSchemaValidationProvider(module, getCommandLine(), bindingContext)
.validateWithSchema(source, asFormat, bindingContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected IModule getModule(
MetaschemaCommands.METASCHEMA_REQUIRED_OPTION,
cwd,
bindingContext);
module = bindingContext.registerModule(module);
} catch (URISyntaxException ex) {
throw new IOException(String.format("Cannot load module as '%s' is not a valid file or URL.", ex.getInput()),
ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import gov.nist.secauto.metaschema.cli.processor.ExitCode;
import gov.nist.secauto.metaschema.cli.processor.ExitStatus;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -44,7 +45,8 @@ void evaluateResult(@NonNull ExitStatus status, @NonNull ExitCode expectedCode,
}

private static Stream<Arguments> providesValues() {
@SuppressWarnings("serial") List<Arguments> values = new LinkedList<>() {
@SuppressWarnings("serial")
List<Arguments> values = new LinkedList<>() {
{
add(Arguments.of(new String[] {}, ExitCode.INVALID_COMMAND,
NO_EXCEPTION_CLASS));
Expand Down Expand Up @@ -188,7 +190,7 @@ private static Stream<Arguments> providesValues() {
"--show-stack-trace"
},
ExitCode.FAIL, NO_EXCEPTION_CLASS));
;

}
};
return values.stream();
Expand All @@ -207,4 +209,16 @@ void testAllCommands(@NonNull String[] args, @NonNull ExitCode expectedExitCode,
evaluateResult(CLI.runCli(fullArgs), expectedExitCode, expectedThrownClass);
}
}

@Test
void test() {
String[] cliArgs = { "validate-content",
"-m",
"src/test/resources/content/215-module.xml",
"src/test/resources/content/215.xml",
"--disable-schema-validation",
"--show-stack-trace"
};
CLI.runCli(cliArgs);
}
}
Loading