33 lines
989 B
Java
33 lines
989 B
Java
package test;
|
|
|
|
import io.bootique.cli.Cli;
|
|
import io.bootique.command.CommandOutcome;
|
|
import io.bootique.command.CommandWithMetadata;
|
|
import io.bootique.meta.application.CommandMetadata;
|
|
import org.apache.cayenne.ObjectContext;
|
|
import org.apache.cayenne.configuration.server.ServerRuntime;
|
|
|
|
import javax.inject.Inject;
|
|
import javax.inject.Provider;
|
|
|
|
public class HappyCommand extends CommandWithMetadata {
|
|
@Inject
|
|
private Provider<ServerRuntime> cayenneRuntimeProvider;
|
|
|
|
@Inject
|
|
public HappyCommand(CommandMetadata.Builder metadataBuilder) {
|
|
super(metadataBuilder
|
|
.name("happy")
|
|
.description("Demo of a possible issue with Cayenne. This command shows a workaround.")
|
|
.build()
|
|
);
|
|
}
|
|
|
|
@Override
|
|
public CommandOutcome run(Cli cli) {
|
|
ObjectContext context = cayenneRuntimeProvider.get().newContext();
|
|
TestCase.runTest(context, false);
|
|
return CommandOutcome.succeeded();
|
|
}
|
|
}
|