method2testcases stringlengths 118 6.63k |
|---|
### Question:
AuthConfiguration { public void setCertificate(String certificate) { this.certificate = certificate; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); void setCertificate(String certif... |
### Question:
AuthConfiguration { public void setCertificatePassword(String certificatePassword) { this.certificatePassword = certificatePassword; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); v... |
### Question:
AuthConfiguration { public void setEnvironment(String environment) { this.environment = environment; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); void setCertificate(String certif... |
### Question:
AuthConfiguration { public void setServerId(String serverId) { this.serverId = serverId; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); void setCertificate(String certificate); Stri... |
### Question:
AuthConfiguration { public void setHttpProxyHost(String httpProxyHost) { this.httpProxyHost = httpProxyHost; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); void setCertificate(Strin... |
### Question:
AuthConfiguration { public void setHttpProxyPort(String httpProxyPort) { this.httpProxyPort = httpProxyPort; } String getClient(); void setClient(String client); String getTenant(); void setTenant(String tenant); String getKey(); void setKey(String key); String getCertificate(); void setCertificate(Strin... |
### Question:
ListMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { try { Log.info(TEMPLATES_START); printToSystemOut(TEMPLATES_FILE); Log.info(TEMPLATES_END); Log.info(BINDINGS_START); printToSystemOut(BINDINGS_FILE); Log.info(BINDINGS_END); Log.info(RESOURCES_ST... |
### Question:
LocalAuthServer { public void start() throws IOException { if (jettyServer.isStarted()) { return; } try { jettyServer.start(); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new IOException(e); } } LocalAuthServer(); URI getURI(); void start(); void stop()... |
### Question:
LocalAuthServer { public void stop() throws IOException { semaphore.release(); try { jettyServer.stop(); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new IOException(e); } } LocalAuthServer(); URI getURI(); void start(); void stop(); String waitForCode()... |
### Question:
AzureCredential { public static AzureCredential fromAuthenticationResult(AuthenticationResult result) { if (result == null) { throw new IllegalArgumentException("Parameter \"result\" cannot be null"); } final AzureCredential token = new AzureCredential(); token.setAccessTokenType(result.getAccessTokenType... |
### Question:
AzureContextExecutor { public AzureCredential execute() throws MalformedURLException, InterruptedException, ExecutionException, AzureLoginTimeoutException { final ExecutorService executorService = Executors.newSingleThreadExecutor(); try { final AuthenticationContext authenticationContext = new Authentica... |
### Question:
AzureLoginHelper { static AzureCredential oAuthLogin(AzureEnvironment env) throws AzureLoginFailureException, ExecutionException, DesktopNotSupportedException, InterruptedException { if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { throw new DesktopNotSuppor... |
### Question:
AzureLoginHelper { static AzureCredential deviceLogin(AzureEnvironment env) throws AzureLoginFailureException, MalformedURLException, InterruptedException, ExecutionException { final String currentLogLevelFieldName = "currentLogLevel"; Object logger = null; Object oldLevelValue = null; try { try { logger ... |
### Question:
AzureLoginHelper { static AzureCredential refreshToken(AzureEnvironment env, String refreshToken) throws MalformedURLException, InterruptedException, ExecutionException { if (env == null) { throw new IllegalArgumentException("Parameter 'env' cannot be null."); } if (StringUtils.isBlank(refreshToken)) { th... |
### Question:
AddMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { try { final List<FunctionTemplate> templates = loadAllFunctionTemplates(); final FunctionTemplate template = getFunctionTemplate(templates); final BindingTemplate bindingTemplate = FunctionUtils.lo... |
### Question:
AzureLoginHelper { static String authorizationUrl(AzureEnvironment env, String redirectUrl) throws URISyntaxException, MalformedURLException { if (env == null) { throw new IllegalArgumentException("Parameter 'env' cannot be null."); } if (StringUtils.isBlank(redirectUrl)) { throw new IllegalArgumentExcept... |
### Question:
AzureLoginHelper { static String baseURL(AzureEnvironment env) { return env.activeDirectoryEndpoint() + Constants.COMMON_TENANT; } private AzureLoginHelper(); }### Answer:
@Test public void testBaseURL() { String baseUrl = AzureLoginHelper.baseURL(AzureEnvironment.AZURE); assertEquals("https: baseUrl =... |
### Question:
AzureLoginHelper { static String getShortNameForAzureEnvironment(AzureEnvironment env) { return AZURE_ENVIRONMENT_MAP.get(env); } private AzureLoginHelper(); }### Answer:
@Test public void testAzureEnvironmentShortName() { assertEquals("azure", AzureLoginHelper.getShortNameForAzureEnvironment(AzureEnvi... |
### Question:
AzureAuthHelper { public static AzureCredential oAuthLogin(AzureEnvironment env) throws AzureLoginFailureException, DesktopNotSupportedException, InterruptedException, ExecutionException { return AzureLoginHelper.oAuthLogin(env); } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnviron... |
### Question:
AzureAuthHelper { public static AzureCredential deviceLogin(AzureEnvironment env) throws AzureLoginFailureException, MalformedURLException, InterruptedException, ExecutionException { return AzureLoginHelper.deviceLogin(env); } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnvironment ... |
### Question:
AzureAuthHelper { public static AzureCredential refreshToken(AzureEnvironment env, String refreshToken) throws MalformedURLException, InterruptedException, ExecutionException { return AzureLoginHelper.refreshToken(env, refreshToken); } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnv... |
### Question:
AzureAuthHelper { public static AzureEnvironment getAzureEnvironment(String environment) { if (StringUtils.isEmpty(environment)) { return AzureEnvironment.AZURE; } switch (environment.toUpperCase(Locale.ENGLISH)) { case "AZURE_CHINA": case "AZURECHINACLOUD": return AzureEnvironment.AZURE_CHINA; case "AZUR... |
### Question:
AddMojo extends AbstractFunctionMojo { protected void assureInputFromUser(final String prompt, final String initValue, final List<String> options, final Consumer<String> setter) { final String option = findElementInOptions(options, initValue); if (option != null) { Log.info(FOUND_VALID_VALUE); setter.acce... |
### Question:
AzureAuthHelper { public static boolean validateEnvironment(String environment) { if (StringUtils.isBlank(environment)) { return true; } switch (environment.toUpperCase(Locale.ENGLISH)) { case "AZURE_CHINA": case "AZURECHINACLOUD": case "AZURE_GERMANY": case "AZUREGERMANCLOUD": case "AZURE_US_GOVERNMENT":... |
### Question:
AzureAuthHelper { public static File getAzureSecretFile() { return new File(getAzureConfigFolder(), Constants.AZURE_SECRET_FILE); } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnvironment env); static AzureCredential deviceLogin(AzureEnvironment env); static AzureCredential refreshT... |
### Question:
AzureAuthHelper { public static File getAzureConfigFolder() { return StringUtils.isNotBlank(System.getenv(Constants.AZURE_CONFIG_DIR)) ? new File(System.getenv(Constants.AZURE_CONFIG_DIR)) : Paths.get(System.getProperty(Constants.USER_HOME), Constants.AZURE_FOLDER).toFile(); } private AzureAuthHelper(); ... |
### Question:
AzureAuthHelper { public static boolean existsAzureSecretFile() { final File azureSecretFile = getAzureSecretFile(); return azureSecretFile.exists() && azureSecretFile.isFile() && azureSecretFile.length() > 0; } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnvironment env); static Az... |
### Question:
AzureAuthHelper { public static AzureCredential readAzureCredentials() throws IOException { return readAzureCredentials(getAzureSecretFile()); } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnvironment env); static AzureCredential deviceLogin(AzureEnvironment env); static AzureCreden... |
### Question:
AzureAuthHelper { public static void writeAzureCredentials(AzureCredential cred, File file) throws IOException { if (cred == null) { throw new IllegalArgumentException("Parameter 'cred' cannot be null."); } if (file == null) { throw new IllegalArgumentException("Parameter 'file' cannot be null."); } FileU... |
### Question:
AzureAuthHelper { static boolean isInCloudShell() { return System.getenv(Constants.CLOUD_SHELL_ENV_KEY) != null; } private AzureAuthHelper(); static AzureCredential oAuthLogin(AzureEnvironment env); static AzureCredential deviceLogin(AzureEnvironment env); static AzureCredential refreshToken(AzureEnviron... |
### Question:
AddMojo extends AbstractFunctionMojo { protected void assureInputInBatchMode(final String input, final Function<String, Boolean> validator, final Consumer<String> setter, final boolean required) throws MojoFailureException { if (validator.apply(input)) { Log.info(FOUND_VALID_VALUE); setter.accept(input); ... |
### Question:
Volume { public Volume withPath(String path) { this.path = path; return this; } String getPath(); String getSize(); Boolean isPersist(); Volume withPath(String path); Volume withSize(String size); Volume withPersist(Boolean persist); }### Answer:
@Test public void testWithPath() { final Volume volume = ... |
### Question:
Volume { public Volume withSize(String size) { this.size = size; return this; } String getPath(); String getSize(); Boolean isPersist(); Volume withPath(String path); Volume withSize(String size); Volume withPersist(Boolean persist); }### Answer:
@Test public void testWithSize() { final Volume volume = ... |
### Question:
Volume { public Volume withPersist(Boolean persist) { this.persist = persist; return this; } String getPath(); String getSize(); Boolean isPersist(); Volume withPath(String path); Volume withSize(String size); Volume withPersist(Boolean persist); }### Answer:
@Test public void testWithPersist() { final ... |
### Question:
DeploymentSettings extends BaseSettings { public void setCpu(String cpu) { this.cpu = cpu; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void setInstanceCount(String instanceCount); void se... |
### Question:
DeploymentSettings extends BaseSettings { public void setMemoryInGB(String memoryInGB) { this.memoryInGB = memoryInGB; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void setInstanceCount(St... |
### Question:
DeploymentSettings extends BaseSettings { public void setInstanceCount(String instanceCount) { this.instanceCount = instanceCount; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void setInst... |
### Question:
DeploymentSettings extends BaseSettings { public void setDeploymentName(String deploymentName) { this.deploymentName = deploymentName; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void set... |
### Question:
DeploymentSettings extends BaseSettings { public void setJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void setInstanceCount(St... |
### Question:
DeploymentSettings extends BaseSettings { public void setRuntimeVersion(String runtimeVersion) { this.runtimeVersion = runtimeVersion; } String getCpu(); String getMemoryInGB(); String getInstanceCount(); String getDeploymentName(); void setCpu(String cpu); void setMemoryInGB(String memoryInGB); void set... |
### Question:
SpringConfiguration { public SpringConfiguration withSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String get... |
### Question:
SpringConfiguration { public SpringConfiguration withResourceGroup(String resourceGroup) { this.resourceGroup = resourceGroup; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String getActi... |
### Question:
SpringConfiguration { public SpringConfiguration withClusterName(String clusterName) { this.clusterName = clusterName; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String getActiveDeploy... |
### Question:
SpringConfiguration { public SpringConfiguration withAppName(String appName) { this.appName = appName; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String getActiveDeploymentName(); Depl... |
### Question:
SpringConfiguration { public SpringConfiguration withRuntimeVersion(String runtimeVersion) { this.runtimeVersion = runtimeVersion; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String get... |
### Question:
SpringConfiguration { public SpringConfiguration withDeployment(Deployment deployment) { this.deployment = deployment; return this; } Boolean isPublic(); String getSubscriptionId(); String getResourceGroup(); String getClusterName(); String getAppName(); String getRuntimeVersion(); String getActiveDeploy... |
### Question:
Deployment { public Deployment withCpu(Integer cpu) { this.cpu = cpu; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistentStorage(); String getJvmOp... |
### Question:
Deployment { public Deployment withMemoryInGB(Integer memoryInGB) { this.memoryInGB = memoryInGB; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersiste... |
### Question:
Deployment { public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEn... |
### Question:
Deployment { public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean i... |
### Question:
Deployment { public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersisten... |
### Question:
RunMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(comman... |
### Question:
Deployment { public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean ... |
### Question:
Deployment { public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersi... |
### Question:
AppSettings extends BaseSettings { public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppNa... |
### Question:
AppSettings extends BaseSettings { public void setClusterName(String clusterName) { this.clusterName = clusterName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String ap... |
### Question:
AppSettings extends BaseSettings { public void setAppName(String appName) { this.appName = appName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appName); String i... |
### Question:
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams(
String resource,
String primaryKey,
String primaryKeyValue,
String column,
String columnValue,
String query,
List<NameValuePair> queryArg... |
### Question:
TkFriend implements TkRegex { @Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( Stri... |
### Question:
TkIndex implements Take { @Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); } TkIndex(final Base bse); @Override Response act(final R... |
### Question:
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Req... |
### Question:
PsTwice implements Pass { @Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Override Response exit(final Response... |
### Question:
TkFavicon implements Take { @Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image... |
### Question:
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Lo... |
### Question:
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catc... |
### Question:
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.... |
### Question:
EmCatch { public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); } EmCatch(final Action act, final String usr, final String pass,
final String hst, final int prt, final long p... |
### Question:
BoutInviteMail { public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new ... |
### Question:
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) ||... |
### Question:
EmAlias implements Alias { @Override public String email() throws IOException { return this.origin.email(); } EmAlias(final Alias org, final Postman pst); @Override String name(); @Override URI photo(); @Override Locale locale(); @Override void photo(final URI uri); @Override String email(); @Override voi... |
### Question:
MkMessages implements Messages { @Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) {... |
### Question:
MkInbox implements Inbox { @Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number... |
### Question:
MkAlias implements Alias { @Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } }... |
### Question:
MkBase implements Base { public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; } MkBase(); MkBase(final Sql src);... |
### Question:
TouchBout { public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } } TouchBout(final Sql src, final long bot);... |
### Question:
MkFriends implements Friends { @Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasExceptio... |
### Question:
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), n... |
### Question:
XeMethod implements Method { @Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( Strin... |
### Question:
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOnto... |
### Question:
XeOntology implements Ontology { @Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=... |
### Question:
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up(... |
### Question:
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this... |
### Question:
Plant { @SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final Byt... |
### Question:
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; ... |
### Question:
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }### Answer:
@Test public void displaysVersionNumber() throws Exception { Main.main(new String[]{"-v"}); MatcherAssert.assertThat( this.out.toString(), Matchers.contains... |
### Question:
InstantRs extends BaseRs { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(inpu... |
### Question:
IndexRs extends BaseRs { @GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); } @GET @Path("/") Response index(); }### Answer:
@Test public void rendersFrontPage() throws Exception { final... |
### Question:
Rules implements XeFacet { @Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wr... |
### Question:
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violatio... |
### Question:
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(... |
### Question:
XeSignature implements Signature { @Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); } XeSignature(final Directives directives, final String xpath); @Override void sign(final String text); @Override void object(final String name); @Override ... |
### Question:
XeMethod implements Method { @Override public Step step(final int number) { return this.flow.step(number); } XeMethod(final Directives directives, final String xpath); @Override void attribute(final String name, final String seal); @Override Nfr nfr(final String name); @Override void sign(final String tex... |
### Question:
ParametricState { public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; member... |
### Question:
ADistribution implements IDistribution<SPACE> { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); } ADistribution(); @Override List<SPACE> generateSamples(int numberOfSamples); abstract C... |
### Question:
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResul... |
### Question:
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); @Override boolean canBeExecuted(); @Override CommandResult executeCommand(); @Override Stri... |
### Question:
RunCompleteToolChainCommand extends ACommand { public RunCompleteToolChainCommand(RunCompleteToolChainCommandConfiguration commandConfiguration) { super(ECommand.RUN_COMPLETE_TOOLCHAIN.getCommandIdentifier()); this.commandConfiguration = commandConfiguration; toolChainCommands = new ArrayList<>(); command... |
### Question:
InputControl implements Observer { @Override public void update(Observable o, Object arg) { if (o instanceof CommandLineParserView && arg instanceof String[]) { String[] userInput = (String[]) arg; handleUserInput(userInput); } else { throw new UnsupportedOperationException(String.format(ERROR_UNSUPPORTED... |
### Question:
ADatasetParser implements IDatasetParser { @Override public IDataset<?, ?, ?> parse(DatasetFile file) throws ParsingFailedException { return parsePartialOf(file, Integer.MAX_VALUE); } @Override IDataset<?, ?, ?> parse(DatasetFile file); @Override IDataset<?, ?, ?> parsePartialOf(DatasetFile file, int amo... |
### Question:
CombinedRankingAndRegressionLearningAlgorithm extends ALearningAlgorithm<CombinedRankingAndRegressionConfiguration> { @Override public CombinedRankingAndRegressionLearningModel train(IDataset<?, ?, ?> dataset) throws TrainModelsFailedException { return (CombinedRankingAndRegressionLearningModel) super.tra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.