repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Stratio/bdt | src/main/java/com/stratio/qa/specs/DatabaseSpec.java | DatabaseSpec.elasticSearchIndexContainsDocument | @Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$")
public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception {
Assertions.assertThat((commonspec.getElas... | java | @Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$")
public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception {
Assertions.assertThat((commonspec.getElas... | [
"@",
"Then",
"(",
"\"^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$\"",
")",
"public",
"void",
"elasticSearchIndexContainsDocument",
"(",
"String",
"indexName",
",",
"String",
"mappingName",
",",
"String",
"columnNam... | Check that an elasticsearch index contains a specific document
@param indexName
@param columnName
@param columnValue | [
"Check",
"that",
"an",
"elasticsearch",
"index",
"contains",
"a",
"specific",
"document"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L873-L882 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/LdapSpec.java | LdapSpec.searchLDAP | @When("^I search in LDAP using the filter '(.+?)' and the baseDn '(.+?)'$")
public void searchLDAP(String filter, String baseDn) throws Exception {
this.commonspec.setPreviousLdapResults(commonspec.getLdapUtils().search(new SearchRequest(baseDn, filter)));
} | java | @When("^I search in LDAP using the filter '(.+?)' and the baseDn '(.+?)'$")
public void searchLDAP(String filter, String baseDn) throws Exception {
this.commonspec.setPreviousLdapResults(commonspec.getLdapUtils().search(new SearchRequest(baseDn, filter)));
} | [
"@",
"When",
"(",
"\"^I search in LDAP using the filter '(.+?)' and the baseDn '(.+?)'$\"",
")",
"public",
"void",
"searchLDAP",
"(",
"String",
"filter",
",",
"String",
"baseDn",
")",
"throws",
"Exception",
"{",
"this",
".",
"commonspec",
".",
"setPreviousLdapResults",
... | Search for a LDAP object | [
"Search",
"for",
"a",
"LDAP",
"object"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/LdapSpec.java#L53-L56 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/LdapSpec.java | LdapSpec.ldapEntryContains | @Then("^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$")
public void ldapEntryContains(String attributeName, String expectedValue) {
if (this.commonspec.getPreviousLdapResults().isPresent()) {
Assertions.assertThat(this.commonspec.getPreviousLdapResults().get().getEntry().... | java | @Then("^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$")
public void ldapEntryContains(String attributeName, String expectedValue) {
if (this.commonspec.getPreviousLdapResults().isPresent()) {
Assertions.assertThat(this.commonspec.getPreviousLdapResults().get().getEntry().... | [
"@",
"Then",
"(",
"\"^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$\"",
")",
"public",
"void",
"ldapEntryContains",
"(",
"String",
"attributeName",
",",
"String",
"expectedValue",
")",
"{",
"if",
"(",
"this",
".",
"commonspec",
".",
"getPreviousLda... | Checks if the previous LDAP search contained a single Entry with a specific attribute and an expected value
@param attributeName The name of the attribute to look for in the LdapEntry
@param expectedValue The expected value of the attribute | [
"Checks",
"if",
"the",
"previous",
"LDAP",
"search",
"contained",
"a",
"single",
"Entry",
"with",
"a",
"specific",
"attribute",
"and",
"an",
"expected",
"value"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/LdapSpec.java#L64-L71 | train |
Stratio/bdt | src/main/java/com/stratio/qa/data/BrowsersDataProvider.java | BrowsersDataProvider.availableBrowsers | @DataProvider(parallel = true)
public static Iterator<String[]> availableBrowsers(ITestContext context, Constructor<?> testConstructor)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
List<String> browsers = gridBrowsers(map);
return buildIterator(br... | java | @DataProvider(parallel = true)
public static Iterator<String[]> availableBrowsers(ITestContext context, Constructor<?> testConstructor)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
List<String> browsers = gridBrowsers(map);
return buildIterator(br... | [
"@",
"DataProvider",
"(",
"parallel",
"=",
"true",
")",
"public",
"static",
"Iterator",
"<",
"String",
"[",
"]",
">",
"availableBrowsers",
"(",
"ITestContext",
"context",
",",
"Constructor",
"<",
"?",
">",
"testConstructor",
")",
"throws",
"Exception",
"{",
... | Get the browsers available in a selenium grid.
@param context context
@param testConstructor testConstructor
@return an iterator
@throws Exception exception | [
"Get",
"the",
"browsers",
"available",
"in",
"a",
"selenium",
"grid",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/data/BrowsersDataProvider.java#L55-L63 | train |
Stratio/bdt | src/main/java/com/stratio/qa/data/BrowsersDataProvider.java | BrowsersDataProvider.availableUniqueBrowsers | @DataProvider(parallel = true)
public static Iterator<String[]> availableUniqueBrowsers(ITestContext context, Constructor<?> testConstructor)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
List<String> browsers = gridBrowsers(map);
HashSet<String> h... | java | @DataProvider(parallel = true)
public static Iterator<String[]> availableUniqueBrowsers(ITestContext context, Constructor<?> testConstructor)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
List<String> browsers = gridBrowsers(map);
HashSet<String> h... | [
"@",
"DataProvider",
"(",
"parallel",
"=",
"true",
")",
"public",
"static",
"Iterator",
"<",
"String",
"[",
"]",
">",
"availableUniqueBrowsers",
"(",
"ITestContext",
"context",
",",
"Constructor",
"<",
"?",
">",
"testConstructor",
")",
"throws",
"Exception",
"... | Get unique browsers available in a selenium grid.
@param context context
@param testConstructor testConstructor
@return an iterator
@throws Exception exception | [
"Get",
"unique",
"browsers",
"available",
"in",
"a",
"selenium",
"grid",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/data/BrowsersDataProvider.java#L74-L87 | train |
Stratio/bdt | src/main/java/com/stratio/qa/data/BrowsersDataProvider.java | BrowsersDataProvider.buildIterator | private static Iterator<String[]> buildIterator(List<String> browsers) {
List<String[]> lData = Lists.newArrayList();
for (String s : browsers) {
lData.add(new String[]{s});
}
if (lData.size() == 0) {
lData.add(new String[]{""});
}
return lData... | java | private static Iterator<String[]> buildIterator(List<String> browsers) {
List<String[]> lData = Lists.newArrayList();
for (String s : browsers) {
lData.add(new String[]{s});
}
if (lData.size() == 0) {
lData.add(new String[]{""});
}
return lData... | [
"private",
"static",
"Iterator",
"<",
"String",
"[",
"]",
">",
"buildIterator",
"(",
"List",
"<",
"String",
">",
"browsers",
")",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"lData",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Strin... | Build an String Iterator from String List.
@param browsers browsers
@return an iterator | [
"Build",
"an",
"String",
"Iterator",
"from",
"String",
"List",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/data/BrowsersDataProvider.java#L133-L146 | train |
Stratio/bdt | src/main/java/com/stratio/qa/aspects/BrowsersDataProviderAspect.java | BrowsersDataProviderAspect.availableBrowsersCalls | @Around(value = "availableBrowsersCallPointcut()")
public Object availableBrowsersCalls(ProceedingJoinPoint pjp)
throws Throwable {
if (pjp.getArgs().length > 0) {
if (pjp.getArgs()[0] instanceof ITestContext) {
if (Arrays.asList(((ITestContext) pjp.getArgs()[0]).get... | java | @Around(value = "availableBrowsersCallPointcut()")
public Object availableBrowsersCalls(ProceedingJoinPoint pjp)
throws Throwable {
if (pjp.getArgs().length > 0) {
if (pjp.getArgs()[0] instanceof ITestContext) {
if (Arrays.asList(((ITestContext) pjp.getArgs()[0]).get... | [
"@",
"Around",
"(",
"value",
"=",
"\"availableBrowsersCallPointcut()\"",
")",
"public",
"Object",
"availableBrowsersCalls",
"(",
"ProceedingJoinPoint",
"pjp",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"pjp",
".",
"getArgs",
"(",
")",
".",
"length",
">",
"0",
... | If a System property with FORCE_BROWSER exists then Methods in
BrowsersDataProvider will return its value.
@param pjp ProceedingJoinPoint
@return Object
@throws Throwable exception | [
"If",
"a",
"System",
"property",
"with",
"FORCE_BROWSER",
"exists",
"then",
"Methods",
"in",
"BrowsersDataProvider",
"will",
"return",
"its",
"value",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/aspects/BrowsersDataProviderAspect.java#L50-L70 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/ZookeeperSpec.java | ZookeeperSpec.connectToZk | @Given("^I connect to Zookeeper at '(.+)'$")
public void connectToZk(String zookeeperHosts) throws InterruptedException {
commonspec.getZookeeperSecClient().setZookeeperSecConnection(zookeeperHosts, 3000);
commonspec.getZookeeperSecClient().connectZk();
} | java | @Given("^I connect to Zookeeper at '(.+)'$")
public void connectToZk(String zookeeperHosts) throws InterruptedException {
commonspec.getZookeeperSecClient().setZookeeperSecConnection(zookeeperHosts, 3000);
commonspec.getZookeeperSecClient().connectZk();
} | [
"@",
"Given",
"(",
"\"^I connect to Zookeeper at '(.+)'$\"",
")",
"public",
"void",
"connectToZk",
"(",
"String",
"zookeeperHosts",
")",
"throws",
"InterruptedException",
"{",
"commonspec",
".",
"getZookeeperSecClient",
"(",
")",
".",
"setZookeeperSecConnection",
"(",
"... | Connect to zookeeper.
@param zookeeperHosts as host:port (comma separated)
@throws InterruptedException exception | [
"Connect",
"to",
"zookeeper",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/ZookeeperSpec.java#L44-L48 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/ZookeeperSpec.java | ZookeeperSpec.createZNode | @When("^I create the zNode '(.+?)'( with content '(.+?)')? which (IS|IS NOT) ephemeral$")
public void createZNode(String path, String foo, String content, boolean ephemeral) throws Exception {
if (content != null) {
commonspec.getZookeeperSecClient().zCreate(path, content, ephemeral);
} ... | java | @When("^I create the zNode '(.+?)'( with content '(.+?)')? which (IS|IS NOT) ephemeral$")
public void createZNode(String path, String foo, String content, boolean ephemeral) throws Exception {
if (content != null) {
commonspec.getZookeeperSecClient().zCreate(path, content, ephemeral);
} ... | [
"@",
"When",
"(",
"\"^I create the zNode '(.+?)'( with content '(.+?)')? which (IS|IS NOT) ephemeral$\"",
")",
"public",
"void",
"createZNode",
"(",
"String",
"path",
",",
"String",
"foo",
",",
"String",
"content",
",",
"boolean",
"ephemeral",
")",
"throws",
"Exception",
... | Create zPath and domcument
@param path path at zookeeper
@param foo a dummy match group
@param content if it has content it should be defined
@param ephemeral if it's created as ephemeral or not | [
"Create",
"zPath",
"and",
"domcument"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/ZookeeperSpec.java#L78-L85 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.connect | public void connect(String secured) {
buildCluster(secured);
this.cassandraqueryUtils = new CassandraQueryUtils();
this.metadata = this.cluster.getMetadata();
LOGGER.debug("Connected to cluster (" + host + "): "
+ metadata.getClusterName() + "\n");
this.session = ... | java | public void connect(String secured) {
buildCluster(secured);
this.cassandraqueryUtils = new CassandraQueryUtils();
this.metadata = this.cluster.getMetadata();
LOGGER.debug("Connected to cluster (" + host + "): "
+ metadata.getClusterName() + "\n");
this.session = ... | [
"public",
"void",
"connect",
"(",
"String",
"secured",
")",
"{",
"buildCluster",
"(",
"secured",
")",
";",
"this",
".",
"cassandraqueryUtils",
"=",
"new",
"CassandraQueryUtils",
"(",
")",
";",
"this",
".",
"metadata",
"=",
"this",
".",
"cluster",
".",
"get... | Connect to Cassandra host. | [
"Connect",
"to",
"Cassandra",
"host",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L68-L75 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.executeQueriesList | public void executeQueriesList(List<String> queriesList) {
for (String query : queriesList) {
this.session.execute(query);
}
} | java | public void executeQueriesList(List<String> queriesList) {
for (String query : queriesList) {
this.session.execute(query);
}
} | [
"public",
"void",
"executeQueriesList",
"(",
"List",
"<",
"String",
">",
"queriesList",
")",
"{",
"for",
"(",
"String",
"query",
":",
"queriesList",
")",
"{",
"this",
".",
"session",
".",
"execute",
"(",
"query",
")",
";",
"}",
"}"
] | Execute a list of queries over Cassandra.
@param queriesList | [
"Execute",
"a",
"list",
"of",
"queries",
"over",
"Cassandra",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L92-L97 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.reconnect | public void reconnect() {
metadata = cluster.getMetadata();
LOGGER.debug("Connected to cluster (" + host + "): "
+ metadata.getClusterName() + "\n");
this.session = this.cluster.connect();
} | java | public void reconnect() {
metadata = cluster.getMetadata();
LOGGER.debug("Connected to cluster (" + host + "): "
+ metadata.getClusterName() + "\n");
this.session = this.cluster.connect();
} | [
"public",
"void",
"reconnect",
"(",
")",
"{",
"metadata",
"=",
"cluster",
".",
"getMetadata",
"(",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Connected to cluster (\"",
"+",
"host",
"+",
"\"): \"",
"+",
"metadata",
".",
"getClusterName",
"(",
")",
"+",
"\"\... | Reconnect to Cassandra host. | [
"Reconnect",
"to",
"Cassandra",
"host",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L102-L107 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.disconnect | public void disconnect() throws DBException {
if (this.session == null) {
throw new DBException("The Cassandra is null");
}
if (this.cluster.isClosed()) {
throw new DBException("The cluster has been closed");
}
this.session.close();
this.cluster.cl... | java | public void disconnect() throws DBException {
if (this.session == null) {
throw new DBException("The Cassandra is null");
}
if (this.cluster.isClosed()) {
throw new DBException("The cluster has been closed");
}
this.session.close();
this.cluster.cl... | [
"public",
"void",
"disconnect",
"(",
")",
"throws",
"DBException",
"{",
"if",
"(",
"this",
".",
"session",
"==",
"null",
")",
"{",
"throw",
"new",
"DBException",
"(",
"\"The Cassandra is null\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"cluster",
".",
"is... | Disconnect from Cassandra host.
@throws DBException | [
"Disconnect",
"from",
"Cassandra",
"host",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L114-L123 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.getMetadata | public Metadata getMetadata() throws DBException {
if (!this.cluster.isClosed()) {
this.metadata = cluster.getMetadata();
return this.metadata;
} else {
throw new DBException("The cluster has been closed");
}
} | java | public Metadata getMetadata() throws DBException {
if (!this.cluster.isClosed()) {
this.metadata = cluster.getMetadata();
return this.metadata;
} else {
throw new DBException("The cluster has been closed");
}
} | [
"public",
"Metadata",
"getMetadata",
"(",
")",
"throws",
"DBException",
"{",
"if",
"(",
"!",
"this",
".",
"cluster",
".",
"isClosed",
"(",
")",
")",
"{",
"this",
".",
"metadata",
"=",
"cluster",
".",
"getMetadata",
"(",
")",
";",
"return",
"this",
".",... | Get the metadata of the Cassandra Cluster.
@return Metadata
@throws DBException | [
"Get",
"the",
"metadata",
"of",
"the",
"Cassandra",
"Cluster",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L131-L138 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.buildCluster | public void buildCluster(String secured) {
if (secured == null) {
this.cluster = Cluster.builder().addContactPoint(this.host).build();
this.cluster.getConfiguration().getQueryOptions()
.setConsistencyLevel(ConsistencyLevel.ONE);
} else {
try {
... | java | public void buildCluster(String secured) {
if (secured == null) {
this.cluster = Cluster.builder().addContactPoint(this.host).build();
this.cluster.getConfiguration().getQueryOptions()
.setConsistencyLevel(ConsistencyLevel.ONE);
} else {
try {
... | [
"public",
"void",
"buildCluster",
"(",
"String",
"secured",
")",
"{",
"if",
"(",
"secured",
"==",
"null",
")",
"{",
"this",
".",
"cluster",
"=",
"Cluster",
".",
"builder",
"(",
")",
".",
"addContactPoint",
"(",
"this",
".",
"host",
")",
".",
"build",
... | Build a Cassandra cluster. | [
"Build",
"a",
"Cassandra",
"cluster",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L144-L156 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.createKeyspace | public void createKeyspace(String keyspace) {
Map<String, String> replicationSimpleOneExtra = new HashMap<>();
replicationSimpleOneExtra.put("'class'", "'SimpleStrategy'");
replicationSimpleOneExtra.put("'replication_factor'", "1");
String query = this.cassandraqueryUtils.createKeyspaceQ... | java | public void createKeyspace(String keyspace) {
Map<String, String> replicationSimpleOneExtra = new HashMap<>();
replicationSimpleOneExtra.put("'class'", "'SimpleStrategy'");
replicationSimpleOneExtra.put("'replication_factor'", "1");
String query = this.cassandraqueryUtils.createKeyspaceQ... | [
"public",
"void",
"createKeyspace",
"(",
"String",
"keyspace",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"replicationSimpleOneExtra",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"replicationSimpleOneExtra",
".",
"put",
"(",
"\"'class'\"",
",",
"\"'Si... | Create a keyspace in Cassandra.
@param keyspace | [
"Create",
"a",
"keyspace",
"in",
"Cassandra",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L172-L182 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.createTableWithData | public void createTableWithData(String table, Map<String, String> colums, ArrayList<String> pk) {
String query = this.cassandraqueryUtils.createTable(table, colums, pk);
LOGGER.debug(query);
executeQuery(query);
} | java | public void createTableWithData(String table, Map<String, String> colums, ArrayList<String> pk) {
String query = this.cassandraqueryUtils.createTable(table, colums, pk);
LOGGER.debug(query);
executeQuery(query);
} | [
"public",
"void",
"createTableWithData",
"(",
"String",
"table",
",",
"Map",
"<",
"String",
",",
"String",
">",
"colums",
",",
"ArrayList",
"<",
"String",
">",
"pk",
")",
"{",
"String",
"query",
"=",
"this",
".",
"cassandraqueryUtils",
".",
"createTable",
... | Create a table in Cassandra.
@param table
@param colums | [
"Create",
"a",
"table",
"in",
"Cassandra",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L190-L194 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.insertData | public void insertData(String table, Map<String, Object> fields) {
String query = this.cassandraqueryUtils.insertData(table, fields);
LOGGER.debug(query);
executeQuery(query);
} | java | public void insertData(String table, Map<String, Object> fields) {
String query = this.cassandraqueryUtils.insertData(table, fields);
LOGGER.debug(query);
executeQuery(query);
} | [
"public",
"void",
"insertData",
"(",
"String",
"table",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"fields",
")",
"{",
"String",
"query",
"=",
"this",
".",
"cassandraqueryUtils",
".",
"insertData",
"(",
"table",
",",
"fields",
")",
";",
"LOGGER",
"."... | Insert data in a keyspace.
@param table
@param fields | [
"Insert",
"data",
"in",
"a",
"keyspace",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L202-L206 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.existsKeyspace | public boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true;
... | java | public boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true;
... | [
"public",
"boolean",
"existsKeyspace",
"(",
"String",
"keyspace",
",",
"boolean",
"showLog",
")",
"{",
"this",
".",
"metadata",
"=",
"cluster",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"metadata",
".",
"getKeyspaces",
"(",
")"... | Checks if a keyspace exists in Cassandra.
@param keyspace
@param showLog
@return boolean | [
"Checks",
"if",
"a",
"keyspace",
"exists",
"in",
"Cassandra",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L215-L225 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.getKeyspaces | public List<String> getKeyspaces() {
ArrayList<String> result = new ArrayList<String>();
this.metadata = this.cluster.getMetadata();
if (!(metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : this.metadata.getKeyspaces()) {
result.add(k.getName());
... | java | public List<String> getKeyspaces() {
ArrayList<String> result = new ArrayList<String>();
this.metadata = this.cluster.getMetadata();
if (!(metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : this.metadata.getKeyspaces()) {
result.add(k.getName());
... | [
"public",
"List",
"<",
"String",
">",
"getKeyspaces",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"this",
".",
"metadata",
"=",
"this",
".",
"cluster",
".",
"getMetadata",
"(",
... | Get a list of the existing keyspaces in Cassandra.
@return {@code List<String>} | [
"Get",
"a",
"list",
"of",
"the",
"existing",
"keyspaces",
"in",
"Cassandra",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L232-L241 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.existsTable | public boolean existsTable(String keyspace, String table, boolean showLog) {
this.metadata = this.cluster.getMetadata();
if (!(this.metadata.getKeyspace(keyspace).getTables().isEmpty())) {
for (TableMetadata t : this.metadata.getKeyspace(keyspace).getTables()) {
if (t.getNam... | java | public boolean existsTable(String keyspace, String table, boolean showLog) {
this.metadata = this.cluster.getMetadata();
if (!(this.metadata.getKeyspace(keyspace).getTables().isEmpty())) {
for (TableMetadata t : this.metadata.getKeyspace(keyspace).getTables()) {
if (t.getNam... | [
"public",
"boolean",
"existsTable",
"(",
"String",
"keyspace",
",",
"String",
"table",
",",
"boolean",
"showLog",
")",
"{",
"this",
".",
"metadata",
"=",
"this",
".",
"cluster",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"meta... | Checks if a keyspace contains an especific table.
@param keyspace
@param table
@param showLog
@return boolean | [
"Checks",
"if",
"a",
"keyspace",
"contains",
"an",
"especific",
"table",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L281-L292 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.getTables | public List<String> getTables(String keyspace) {
ArrayList<String> result = new ArrayList<String>();
this.metadata = this.cluster.getMetadata();
if ((!existsKeyspace(keyspace, false)) || (this.metadata.getKeyspace(keyspace).getTables().isEmpty())) {
return result;
}
f... | java | public List<String> getTables(String keyspace) {
ArrayList<String> result = new ArrayList<String>();
this.metadata = this.cluster.getMetadata();
if ((!existsKeyspace(keyspace, false)) || (this.metadata.getKeyspace(keyspace).getTables().isEmpty())) {
return result;
}
f... | [
"public",
"List",
"<",
"String",
">",
"getTables",
"(",
"String",
"keyspace",
")",
"{",
"ArrayList",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"this",
".",
"metadata",
"=",
"this",
".",
"cluster",
".",
... | Get tables of a keyspace.
@param keyspace
@return {@code List<String>} | [
"Get",
"tables",
"of",
"a",
"keyspace",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L300-L310 | train |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.loadScript | public static List<String> loadScript(String path) {
List<String> result = new ArrayList<String>();
URL url = CassandraUtils.class.getResource(path);
LOGGER.debug(url.toString());
LOGGER.info("Loading script from: " + url);
try (BufferedReader br = new BufferedReader(new InputStr... | java | public static List<String> loadScript(String path) {
List<String> result = new ArrayList<String>();
URL url = CassandraUtils.class.getResource(path);
LOGGER.debug(url.toString());
LOGGER.info("Loading script from: " + url);
try (BufferedReader br = new BufferedReader(new InputStr... | [
"public",
"static",
"List",
"<",
"String",
">",
"loadScript",
"(",
"String",
"path",
")",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"URL",
"url",
"=",
"CassandraUtils",
".",
"class",
".",
"... | Load the lines of a CQL script containing one statement per line into a
list. l
@param path The path of the CQL script.
@return The contents of the script. | [
"Load",
"the",
"lines",
"of",
"a",
"CQL",
"script",
"containing",
"one",
"statement",
"per",
"line",
"into",
"a",
"list",
".",
"l"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L361-L378 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.matchesOrContains | public static Pattern matchesOrContains(String expectedMessage) {
Pattern pattern;
if (expectedMessage.startsWith("regex:")) {
String regex = expectedMessage.substring(expectedMessage.indexOf("regex:") + 6, expectedMessage.length());
pattern = Pattern.compile(regex);
} el... | java | public static Pattern matchesOrContains(String expectedMessage) {
Pattern pattern;
if (expectedMessage.startsWith("regex:")) {
String regex = expectedMessage.substring(expectedMessage.indexOf("regex:") + 6, expectedMessage.length());
pattern = Pattern.compile(regex);
} el... | [
"public",
"static",
"Pattern",
"matchesOrContains",
"(",
"String",
"expectedMessage",
")",
"{",
"Pattern",
"pattern",
";",
"if",
"(",
"expectedMessage",
".",
"startsWith",
"(",
"\"regex:\"",
")",
")",
"{",
"String",
"regex",
"=",
"expectedMessage",
".",
"substri... | Checks if a given string matches a regular expression or contains a string
@param expectedMessage message used for comparing
@return boolean | [
"Checks",
"if",
"a",
"given",
"string",
"matches",
"a",
"regular",
"expression",
"or",
"contains",
"a",
"string"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L148-L157 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.retrieveData | public String retrieveData(String baseData, String type) {
String result;
InputStream stream = getClass().getClassLoader().getResourceAsStream(baseData);
Writer writer = new StringWriter();
char[] buffer = new char[1024];
Reader reader;
if (stream == null) {
... | java | public String retrieveData(String baseData, String type) {
String result;
InputStream stream = getClass().getClassLoader().getResourceAsStream(baseData);
Writer writer = new StringWriter();
char[] buffer = new char[1024];
Reader reader;
if (stream == null) {
... | [
"public",
"String",
"retrieveData",
"(",
"String",
"baseData",
",",
"String",
"type",
")",
"{",
"String",
"result",
";",
"InputStream",
"stream",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"baseData",
")",
";... | Returns the information contained in file passed as parameter
@param baseData path to file to be read
@param type type of information, it can be: json|string
@return String | [
"Returns",
"the",
"information",
"contained",
"in",
"file",
"passed",
"as",
"parameter"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L669-L709 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.removeNulls | public JsonObject removeNulls(JsonObject object) {
for (int j = 0; j < object.names().size(); j++) {
if (JsonType.OBJECT.equals(object.get(object.names().get(j)).getType())) {
removeNulls(object.get(object.names().get(j)).asObject());
} else {
if (object.g... | java | public JsonObject removeNulls(JsonObject object) {
for (int j = 0; j < object.names().size(); j++) {
if (JsonType.OBJECT.equals(object.get(object.names().get(j)).getType())) {
removeNulls(object.get(object.names().get(j)).asObject());
} else {
if (object.g... | [
"public",
"JsonObject",
"removeNulls",
"(",
"JsonObject",
"object",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"object",
".",
"names",
"(",
")",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"if",
"(",
"JsonType",
".",
"OBJECT"... | Eliminates null occurrences, replacing them with "TO_BE_NULL"
@param object JsonObject containing json where to replace null ocurrences
@return JsonObject | [
"Eliminates",
"null",
"occurrences",
"replacing",
"them",
"with",
"TO_BE_NULL"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1060-L1071 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.setPreviousElement | public void setPreviousElement(String element, String value) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
Reflections reflections = new Reflections("com.stratio... | java | public void setPreviousElement(String element, String value) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
Reflections reflections = new Reflections("com.stratio... | [
"public",
"void",
"setPreviousElement",
"(",
"String",
"element",
",",
"String",
"value",
")",
"throws",
"NoSuchFieldException",
",",
"SecurityException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"ClassNotFoundExcep... | Saves the value in the attribute in class extending CommonG.
@param element attribute in class where to store the value
@param value value to be stored
@throws NoSuchFieldException exception
@throws SecurityException exception
@throws IllegalArgumentException exception
@throws IllegalAccessException ... | [
"Saves",
"the",
"value",
"in",
"the",
"attribute",
"in",
"class",
"extending",
"CommonG",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1361-L1372 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.isUUID | private boolean isUUID(String uuid) {
try {
UUID.fromString(uuid);
return true;
} catch (Exception ex) {
return false;
}
} | java | private boolean isUUID(String uuid) {
try {
UUID.fromString(uuid);
return true;
} catch (Exception ex) {
return false;
}
} | [
"private",
"boolean",
"isUUID",
"(",
"String",
"uuid",
")",
"{",
"try",
"{",
"UUID",
".",
"fromString",
"(",
"uuid",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Check if a string is a UUID
@param uuid - UUID value
@return true if it is a UUID or false if it is not an UUID | [
"Check",
"if",
"a",
"string",
"is",
"a",
"UUID"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1511-L1518 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.isThisDateValid | private boolean isThisDateValid(String dateToValidate, String dateFromat) {
if (dateToValidate == null) {
return false;
}
SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
sdf.setLenient(false);
try {
//if not valid, it will throw ParseException
... | java | private boolean isThisDateValid(String dateToValidate, String dateFromat) {
if (dateToValidate == null) {
return false;
}
SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
sdf.setLenient(false);
try {
//if not valid, it will throw ParseException
... | [
"private",
"boolean",
"isThisDateValid",
"(",
"String",
"dateToValidate",
",",
"String",
"dateFromat",
")",
"{",
"if",
"(",
"dateToValidate",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"... | Check is a String is a valid timestamp format
@param dateToValidate
@param dateFromat
@return true/false | [
"Check",
"is",
"a",
"String",
"is",
"a",
"valid",
"timestamp",
"format"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1526-L1540 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.resultsMustBeElasticsearch | public void resultsMustBeElasticsearch(DataTable expectedResults) throws Exception {
if (getElasticsearchResults() != null) {
List<List<String>> expectedResultList = expectedResults.raw();
//Check size
assertThat(expectedResultList.size() - 1).overridingErrorMessage(
... | java | public void resultsMustBeElasticsearch(DataTable expectedResults) throws Exception {
if (getElasticsearchResults() != null) {
List<List<String>> expectedResultList = expectedResults.raw();
//Check size
assertThat(expectedResultList.size() - 1).overridingErrorMessage(
... | [
"public",
"void",
"resultsMustBeElasticsearch",
"(",
"DataTable",
"expectedResults",
")",
"throws",
"Exception",
"{",
"if",
"(",
"getElasticsearchResults",
"(",
")",
"!=",
"null",
")",
"{",
"List",
"<",
"List",
"<",
"String",
">>",
"expectedResultList",
"=",
"ex... | Checks the different results of a previous query to Elasticsearch database
@param expectedResults A DataTable Object with all data needed for check the results. The DataTable must contains at least 2 columns:
a) A field column from the result
b) Occurrences column (Integer type)
<p>
Example:
|latitude| longitude|place... | [
"Checks",
"the",
"different",
"results",
"of",
"a",
"previous",
"query",
"to",
"Elasticsearch",
"database"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1732-L1755 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.runLocalCommand | public void runLocalCommand(String command) throws Exception {
String result = "";
String line;
Process p;
try {
p = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", command});
p.waitFor();
} catch (java.io.IOException e) {
this.command... | java | public void runLocalCommand(String command) throws Exception {
String result = "";
String line;
Process p;
try {
p = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", command});
p.waitFor();
} catch (java.io.IOException e) {
this.command... | [
"public",
"void",
"runLocalCommand",
"(",
"String",
"command",
")",
"throws",
"Exception",
"{",
"String",
"result",
"=",
"\"\"",
";",
"String",
"line",
";",
"Process",
"p",
";",
"try",
"{",
"p",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
... | Runs a command locally
@param command command used to be run locally | [
"Runs",
"a",
"command",
"locally"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1762-L1791 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.removeJSONPathElement | public String removeJSONPathElement(String jsonString, String expr) {
Configuration conf = Configuration.builder().jsonProvider(new GsonJsonProvider()).mappingProvider(new GsonMappingProvider()).build();
DocumentContext context = JsonPath.using(conf).parse(jsonString);
context.delete(expr);
... | java | public String removeJSONPathElement(String jsonString, String expr) {
Configuration conf = Configuration.builder().jsonProvider(new GsonJsonProvider()).mappingProvider(new GsonMappingProvider()).build();
DocumentContext context = JsonPath.using(conf).parse(jsonString);
context.delete(expr);
... | [
"public",
"String",
"removeJSONPathElement",
"(",
"String",
"jsonString",
",",
"String",
"expr",
")",
"{",
"Configuration",
"conf",
"=",
"Configuration",
".",
"builder",
"(",
")",
".",
"jsonProvider",
"(",
"new",
"GsonJsonProvider",
"(",
")",
")",
".",
"mappin... | Remove a subelement in a JsonPath
@param jsonString String of the json
@param expr regex to be removed | [
"Remove",
"a",
"subelement",
"in",
"a",
"JsonPath"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1911-L1917 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.replaceJSONPathElement | public String replaceJSONPathElement(String jsonString, String key, String value) {
return JsonPath.parse(jsonString).set(key, value).jsonString();
} | java | public String replaceJSONPathElement(String jsonString, String key, String value) {
return JsonPath.parse(jsonString).set(key, value).jsonString();
} | [
"public",
"String",
"replaceJSONPathElement",
"(",
"String",
"jsonString",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"JsonPath",
".",
"parse",
"(",
"jsonString",
")",
".",
"set",
"(",
"key",
",",
"value",
")",
".",
"jsonString",
"("... | The function searches over the array by certain field value,
and replaces occurences with the parameter provided.
@param jsonString Original json object
@param key Key to search
@param value Value to replace key with | [
"The",
"function",
"searches",
"over",
"the",
"array",
"by",
"certain",
"field",
"value",
"and",
"replaces",
"occurences",
"with",
"the",
"parameter",
"provided",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1927-L1929 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.parseJSONSchema | public JSONObject parseJSONSchema(JSONObject schema) throws Exception {
JSONObject json = new JSONObject();
String name = "";
JSONObject properties = schema;
// Check if key 'properties' exists
if (schema.has("properties")) {
// Obtain properties
properti... | java | public JSONObject parseJSONSchema(JSONObject schema) throws Exception {
JSONObject json = new JSONObject();
String name = "";
JSONObject properties = schema;
// Check if key 'properties' exists
if (schema.has("properties")) {
// Obtain properties
properti... | [
"public",
"JSONObject",
"parseJSONSchema",
"(",
"JSONObject",
"schema",
")",
"throws",
"Exception",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"String",
"name",
"=",
"\"\"",
";",
"JSONObject",
"properties",
"=",
"schema",
";",
"// Chec... | Generate deployment json from schema
@param schema schema obtained from deploy-api
@return JSONObject deployment json | [
"Generate",
"deployment",
"json",
"from",
"schema"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L2184-L2233 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.matchJsonToSchema | public boolean matchJsonToSchema(JSONObject schema, JSONObject json) throws Exception {
SchemaLoader.builder()
.useDefaults(true)
.schemaJson(schema)
.build()
.load()
.build()
.validate(json);
return tr... | java | public boolean matchJsonToSchema(JSONObject schema, JSONObject json) throws Exception {
SchemaLoader.builder()
.useDefaults(true)
.schemaJson(schema)
.build()
.load()
.build()
.validate(json);
return tr... | [
"public",
"boolean",
"matchJsonToSchema",
"(",
"JSONObject",
"schema",
",",
"JSONObject",
"json",
")",
"throws",
"Exception",
"{",
"SchemaLoader",
".",
"builder",
"(",
")",
".",
"useDefaults",
"(",
"true",
")",
".",
"schemaJson",
"(",
"schema",
")",
".",
"bu... | Check json matches schema
@param schema schema obtained from deploy-api
@param json json to be checked
@return boolean whether the json matches the schema or not | [
"Check",
"json",
"matches",
"schema"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L2242-L2251 | train |
Stratio/bdt | src/main/java/com/stratio/qa/assertions/SeleniumAssert.java | SeleniumAssert.assertThat | public static SeleniumAssert assertThat(CommonG commong, List<WebElement> actual) {
return new SeleniumAssert(commong, actual);
} | java | public static SeleniumAssert assertThat(CommonG commong, List<WebElement> actual) {
return new SeleniumAssert(commong, actual);
} | [
"public",
"static",
"SeleniumAssert",
"assertThat",
"(",
"CommonG",
"commong",
",",
"List",
"<",
"WebElement",
">",
"actual",
")",
"{",
"return",
"new",
"SeleniumAssert",
"(",
"commong",
",",
"actual",
")",
";",
"}"
] | Checks a selenium list of WebElements.
@param commong common object that contains relevant execution info
@param actual webElement used in assert
@return SeleniumAssert | [
"Checks",
"a",
"selenium",
"list",
"of",
"WebElements",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/assertions/SeleniumAssert.java#L205-L207 | train |
Stratio/bdt | src/main/java/com/stratio/qa/assertions/SeleniumAssert.java | SeleniumAssert.contains | public SeleniumAssert contains(CharSequence... values) {
if (actual instanceof WebDriver) {
Strings.instance().assertContains(info,
((WebDriver) actual).getPageSource(), values);
} else if (actual instanceof WebElement) {
Strings.instance().assertContains(info... | java | public SeleniumAssert contains(CharSequence... values) {
if (actual instanceof WebDriver) {
Strings.instance().assertContains(info,
((WebDriver) actual).getPageSource(), values);
} else if (actual instanceof WebElement) {
Strings.instance().assertContains(info... | [
"public",
"SeleniumAssert",
"contains",
"(",
"CharSequence",
"...",
"values",
")",
"{",
"if",
"(",
"actual",
"instanceof",
"WebDriver",
")",
"{",
"Strings",
".",
"instance",
"(",
")",
".",
"assertContains",
"(",
"info",
",",
"(",
"(",
"WebDriver",
")",
"ac... | Checks if a webDriver or WebElement has values.
@param values char sequence compared
@return SeleniumAssert | [
"Checks",
"if",
"a",
"webDriver",
"or",
"WebElement",
"has",
"values",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/assertions/SeleniumAssert.java#L246-L255 | train |
Stratio/bdt | src/main/java/com/stratio/qa/assertions/SeleniumAssert.java | SeleniumAssert.isTextField | public SeleniumAssert isTextField(Condition<WebElement> cond) {
if (actual instanceof List) {
Conditions.instance().equals(cond);
}
return this;
} | java | public SeleniumAssert isTextField(Condition<WebElement> cond) {
if (actual instanceof List) {
Conditions.instance().equals(cond);
}
return this;
} | [
"public",
"SeleniumAssert",
"isTextField",
"(",
"Condition",
"<",
"WebElement",
">",
"cond",
")",
"{",
"if",
"(",
"actual",
"instanceof",
"List",
")",
"{",
"Conditions",
".",
"instance",
"(",
")",
".",
"equals",
"(",
"cond",
")",
";",
"}",
"return",
"thi... | Checks if a WebElement is a TextField.
@param cond webElement used in condition
@return SeleniumAssert | [
"Checks",
"if",
"a",
"WebElement",
"is",
"a",
"TextField",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/assertions/SeleniumAssert.java#L264-L269 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/FileSpec.java | FileSpec.readFromCSV | @When("^I read info from csv file '(.+?)' with separator '(.+?)'$")
public void readFromCSV(String csvFile, String separator) throws Exception {
//By default separator is a coma
char sep = ',';
if (separator.length() > 1) {
switch (separator) {
case "\\t":
... | java | @When("^I read info from csv file '(.+?)' with separator '(.+?)'$")
public void readFromCSV(String csvFile, String separator) throws Exception {
//By default separator is a coma
char sep = ',';
if (separator.length() > 1) {
switch (separator) {
case "\\t":
... | [
"@",
"When",
"(",
"\"^I read info from csv file '(.+?)' with separator '(.+?)'$\"",
")",
"public",
"void",
"readFromCSV",
"(",
"String",
"csvFile",
",",
"String",
"separator",
")",
"throws",
"Exception",
"{",
"//By default separator is a coma",
"char",
"sep",
"=",
"'",
... | Read csv file and store result in list of maps
@param csvFile | [
"Read",
"csv",
"file",
"and",
"store",
"result",
"in",
"list",
"of",
"maps"
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L48-L86 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/FileSpec.java | FileSpec.readFileToVariable | @When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$")
public void readFileToVariable(String baseData, String type, String envVar, DataTable modifications) throws Exception {
// Retrieve data
String retrievedData = commonspec.retrieveData(baseData, type);
... | java | @When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$")
public void readFileToVariable(String baseData, String type, String envVar, DataTable modifications) throws Exception {
// Retrieve data
String retrievedData = commonspec.retrieveData(baseData, type);
... | [
"@",
"When",
"(",
"\"^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$\"",
")",
"public",
"void",
"readFileToVariable",
"(",
"String",
"baseData",
",",
"String",
"type",
",",
"String",
"envVar",
",",
"DataTable",
"modifications",
")",
"throw... | Read the file passed as parameter, perform the modifications specified and save the result in the environment
variable passed as parameter.
@param baseData file to read
@param type whether the info in the file is a 'json' or a simple 'string'
@param envVar name of the variable where to store the r... | [
"Read",
"the",
"file",
"passed",
"as",
"parameter",
"perform",
"the",
"modifications",
"specified",
"and",
"save",
"the",
"result",
"in",
"the",
"environment",
"variable",
"passed",
"as",
"parameter",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L171-L182 | train |
Stratio/bdt | src/main/java/com/stratio/qa/specs/FileSpec.java | FileSpec.readFileToVariableNoDataTable | @When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)'$")
public void readFileToVariableNoDataTable(String baseData, String type, String envVar) throws Exception {
// Retrieve data
String retrievedData = commonspec.retrieveData(baseData, type);
// Save in environ... | java | @When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)'$")
public void readFileToVariableNoDataTable(String baseData, String type, String envVar) throws Exception {
// Retrieve data
String retrievedData = commonspec.retrieveData(baseData, type);
// Save in environ... | [
"@",
"When",
"(",
"\"^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)'$\"",
")",
"public",
"void",
"readFileToVariableNoDataTable",
"(",
"String",
"baseData",
",",
"String",
"type",
",",
"String",
"envVar",
")",
"throws",
"Exception",
"{",
"// Retr... | Read the file passed as parameter and save the result in the environment
variable passed as parameter.
@param baseData file to read
@param type whether the info in the file is a 'json' or a simple 'string'
@param envVar name of the variable where to store the result | [
"Read",
"the",
"file",
"passed",
"as",
"parameter",
"and",
"save",
"the",
"result",
"in",
"the",
"environment",
"variable",
"passed",
"as",
"parameter",
"."
] | 55324d19e7497764ad3dd7139923e13eb9841d75 | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L192-L199 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java | ClipboardUtils.getClipboardText | public static String getClipboardText(final Context context) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = clipboard.getPrimaryClip();
if(clipData != null && clipData.getItemCount() > 0) {
final ... | java | public static String getClipboardText(final Context context) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = clipboard.getPrimaryClip();
if(clipData != null && clipData.getItemCount() > 0) {
final ... | [
"public",
"static",
"String",
"getClipboardText",
"(",
"final",
"Context",
"context",
")",
"{",
"final",
"ClipboardManager",
"clipboard",
"=",
"(",
"ClipboardManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"CLIPBOARD_SERVICE",
")",
";",
"fi... | Get the current text from the clipboard.
@return Clipboard text or {@code null} if clipboard is empty or unavailable. | [
"Get",
"the",
"current",
"text",
"from",
"the",
"clipboard",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java#L17-L27 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java | ClipboardUtils.setClipboardText | public static void setClipboardText(final Context context, final String text) {
if(text != null) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = ClipData.newPlainText(text, text);
clipboard... | java | public static void setClipboardText(final Context context, final String text) {
if(text != null) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = ClipData.newPlainText(text, text);
clipboard... | [
"public",
"static",
"void",
"setClipboardText",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"final",
"ClipboardManager",
"clipboard",
"=",
"(",
"ClipboardManager",
")",
"context",
"... | Set the clipboard text.
@param text Text to put in the clipboard. | [
"Set",
"the",
"clipboard",
"text",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java#L34-L40 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.closeKeyboard | public static void closeKeyboard(Context context, View field) {
try {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(field.getWindowToken(), 0);
} catch (Exception ex) {
Log.e("Caffeine... | java | public static void closeKeyboard(Context context, View field) {
try {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(field.getWindowToken(), 0);
} catch (Exception ex) {
Log.e("Caffeine... | [
"public",
"static",
"void",
"closeKeyboard",
"(",
"Context",
"context",
",",
"View",
"field",
")",
"{",
"try",
"{",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"INPUT_METHOD_SERVICE",
... | Go away keyboard, nobody likes you.
@param context The current Context or Activity that this method is called from.
@param field field that holds the keyboard focus. | [
"Go",
"away",
"keyboard",
"nobody",
"likes",
"you",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L141-L148 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.showKeyboard | public static void showKeyboard(Context context, View field){
try {
field.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT);
} catch (Excepti... | java | public static void showKeyboard(Context context, View field){
try {
field.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT);
} catch (Excepti... | [
"public",
"static",
"void",
"showKeyboard",
"(",
"Context",
"context",
",",
"View",
"field",
")",
"{",
"try",
"{",
"field",
".",
"requestFocus",
"(",
")",
";",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"context",
".",
"getSystemService"... | Show the pop-up keyboard
@param context Activity/Context.
@param field field that requests focus. | [
"Show",
"the",
"pop",
"-",
"up",
"keyboard"
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L156-L164 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.viewToImage | public static Bitmap viewToImage(Context context, WebView viewToBeConverted) {
int extraSpace = 2000; //because getContentHeight doesn't always return the full screen height.
int height = viewToBeConverted.getContentHeight() + extraSpace;
Bitmap viewBitmap = Bitmap.createBitmap(viewToBeConverte... | java | public static Bitmap viewToImage(Context context, WebView viewToBeConverted) {
int extraSpace = 2000; //because getContentHeight doesn't always return the full screen height.
int height = viewToBeConverted.getContentHeight() + extraSpace;
Bitmap viewBitmap = Bitmap.createBitmap(viewToBeConverte... | [
"public",
"static",
"Bitmap",
"viewToImage",
"(",
"Context",
"context",
",",
"WebView",
"viewToBeConverted",
")",
"{",
"int",
"extraSpace",
"=",
"2000",
";",
"//because getContentHeight doesn't always return the full screen height.",
"int",
"height",
"=",
"viewToBeConverted... | Convert view to an image. Can be used to make animations smoother.
@param context The current Context or Activity that this method is called from.
@param viewToBeConverted View to convert to a Bitmap.
@return Bitmap object that can be put in an ImageView. Will look like the converted viewToBeConverted. | [
"Convert",
"view",
"to",
"an",
"image",
".",
"Can",
"be",
"used",
"to",
"make",
"animations",
"smoother",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L173-L192 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java | IntentUtils.launchWebBrowser | public static void launchWebBrowser(final Context context, final String url) {
if (context != null && url != null && !"".equals(url)) {
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (browserIntent.resolveActivity(context.getPackageManager()) != null) {
... | java | public static void launchWebBrowser(final Context context, final String url) {
if (context != null && url != null && !"".equals(url)) {
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (browserIntent.resolveActivity(context.getPackageManager()) != null) {
... | [
"public",
"static",
"void",
"launchWebBrowser",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"url",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
"&&",
"url",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"url",
")",
")",
"{",
"... | Start Intent to launch web browser. | [
"Start",
"Intent",
"to",
"launch",
"web",
"browser",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L37-L49 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java | IntentUtils.isAppInstalled | public static boolean isAppInstalled(final Context context, final String packageName){
try {
context.getPackageManager().getPackageInfo(packageName, 0);
return true;
} catch (Exception e) {
return false;
}
} | java | public static boolean isAppInstalled(final Context context, final String packageName){
try {
context.getPackageManager().getPackageInfo(packageName, 0);
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isAppInstalled",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"packageName",
")",
"{",
"try",
"{",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getPackageInfo",
"(",
"packageName",
",",
"0",
")",
";",
"r... | Check if app for the given package name is installed on this device. | [
"Check",
"if",
"app",
"for",
"the",
"given",
"package",
"name",
"is",
"installed",
"on",
"this",
"device",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L54-L61 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java | IntentUtils.launchCameraIntent | public static void launchCameraIntent(final Activity context, final Uri outputDestination, final int requestCode){
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputDestination);
if (intent.resolveActivity(context.getPackageManager(... | java | public static void launchCameraIntent(final Activity context, final Uri outputDestination, final int requestCode){
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputDestination);
if (intent.resolveActivity(context.getPackageManager(... | [
"public",
"static",
"void",
"launchCameraIntent",
"(",
"final",
"Activity",
"context",
",",
"final",
"Uri",
"outputDestination",
",",
"final",
"int",
"requestCode",
")",
"{",
"final",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"MediaStore",
".",
"ACTION_IMAG... | Launch camera on the device using android's ACTION_IMAGE_CAPTURE intent.
@param outputDestination Save image to this location. | [
"Launch",
"camera",
"on",
"the",
"device",
"using",
"android",
"s",
"ACTION_IMAGE_CAPTURE",
"intent",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L67-L74 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java | IntentUtils.launchAppForPackage | public static boolean launchAppForPackage(final Context context, final String packageName) {
try {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = packageManager.getLaunchIntentForPackage(packageName);
intent.addCategory(Intent.CATEGOR... | java | public static boolean launchAppForPackage(final Context context, final String packageName) {
try {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = packageManager.getLaunchIntentForPackage(packageName);
intent.addCategory(Intent.CATEGOR... | [
"public",
"static",
"boolean",
"launchAppForPackage",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"packageName",
")",
"{",
"try",
"{",
"final",
"PackageManager",
"packageManager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"final",
... | Tries to launch the application for a given package name.
@return true if launch succeeded, otherwise false. | [
"Tries",
"to",
"launch",
"the",
"application",
"for",
"a",
"given",
"package",
"name",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L94-L105 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java | ActivityUtils.launchActivity | public static void launchActivity(Activity context, Class<? extends Activity> activity, boolean closeCurrentActivity, Map<String, String> params) {
Intent intent = new Intent(context, activity);
if (params != null) {
Bundle bundle = new Bundle();
for (Entry<String, String> param... | java | public static void launchActivity(Activity context, Class<? extends Activity> activity, boolean closeCurrentActivity, Map<String, String> params) {
Intent intent = new Intent(context, activity);
if (params != null) {
Bundle bundle = new Bundle();
for (Entry<String, String> param... | [
"public",
"static",
"void",
"launchActivity",
"(",
"Activity",
"context",
",",
"Class",
"<",
"?",
"extends",
"Activity",
">",
"activity",
",",
"boolean",
"closeCurrentActivity",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"Intent",
"in... | Launch an Activity.
@param context The current Context or Activity that this method is called from.
@param activity The new Activity to open.
@param closeCurrentActivity whether or not the current activity should close.
@param params Parameters to add to the intent as a Bundle. | [
"Launch",
"an",
"Activity",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java#L30-L45 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java | ActivityUtils.turnScreenOn | public static void turnScreenOn(Activity context) {
try {
Window window = context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.Layou... | java | public static void turnScreenOn(Activity context) {
try {
Window window = context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.Layou... | [
"public",
"static",
"void",
"turnScreenOn",
"(",
"Activity",
"context",
")",
"{",
"try",
"{",
"Window",
"window",
"=",
"context",
".",
"getWindow",
"(",
")",
";",
"window",
".",
"addFlags",
"(",
"WindowManager",
".",
"LayoutParams",
".",
"FLAG_DISMISS_KEYGUARD... | Force screen to turn on if the phone is asleep.
@param context The current Context or Activity that this method is called from | [
"Force",
"screen",
"to",
"turn",
"on",
"if",
"the",
"phone",
"is",
"asleep",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java#L89-L98 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/MiscUtils.java | MiscUtils.isValidEmail | public final static boolean isValidEmail(String email) {
if (email == null) {
return false;
} else {
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
}
} | java | public final static boolean isValidEmail(String email) {
if (email == null) {
return false;
} else {
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
}
} | [
"public",
"final",
"static",
"boolean",
"isValidEmail",
"(",
"String",
"email",
")",
"{",
"if",
"(",
"email",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"android",
".",
"util",
".",
"Patterns",
".",
"EMAIL_ADDRESS",
".",
... | Uses androids android.util.Patterns.EMAIL_ADDRESS to check if an email address is valid.
@param email Address to check
@return true if the <code>email</code> is a valid email address. | [
"Uses",
"androids",
"android",
".",
"util",
".",
"Patterns",
".",
"EMAIL_ADDRESS",
"to",
"check",
"if",
"an",
"email",
"address",
"is",
"valid",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/MiscUtils.java#L85-L91 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/MiscUtils.java | MiscUtils.isValidURL | public final static boolean isValidURL(String url) {
if (url == null) {
return false;
} else {
return Patterns.WEB_URL.matcher(url).matches();
}
} | java | public final static boolean isValidURL(String url) {
if (url == null) {
return false;
} else {
return Patterns.WEB_URL.matcher(url).matches();
}
} | [
"public",
"final",
"static",
"boolean",
"isValidURL",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"Patterns",
".",
"WEB_URL",
".",
"matcher",
"(",
"url",
")",
".",
"mat... | Uses androids android.util.Patterns.WEB_URL to check if an url is valid.
@param url Address to check
@return true if the <code>url</code> is a valid web address. | [
"Uses",
"androids",
"android",
".",
"util",
".",
"Patterns",
".",
"WEB_URL",
"to",
"check",
"if",
"an",
"url",
"is",
"valid",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/MiscUtils.java#L113-L119 | train |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java | ToastUtils.quickToast | public static Toast quickToast(Context context, String message, boolean longLength) {
final Toast toast;
if (longLength) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
} else {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
}
... | java | public static Toast quickToast(Context context, String message, boolean longLength) {
final Toast toast;
if (longLength) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
} else {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
}
... | [
"public",
"static",
"Toast",
"quickToast",
"(",
"Context",
"context",
",",
"String",
"message",
",",
"boolean",
"longLength",
")",
"{",
"final",
"Toast",
"toast",
";",
"if",
"(",
"longLength",
")",
"{",
"toast",
"=",
"Toast",
".",
"makeText",
"(",
"context... | Display a toast with the given message.
@param context The current Context or Activity that this method is called from
@param message Message to display
@param longLength if true, will use Toast.LENGTH_LONG (approx 3.5 sec) instead of
@return Toast object that is being displayed. Note,show() has already been cal... | [
"Display",
"a",
"toast",
"with",
"the",
"given",
"message",
"."
] | e2265cab474a6397f4d75b1ed928c356a7b9672e | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java#L33-L42 | train |
cettia/cettia-java-server | server/src/main/java/io/cettia/ClusteredServer.java | ClusteredServer.onpublish | public Server onpublish(Action<Map<String, Object>> action) {
publishActions.add(action);
return this;
} | java | public Server onpublish(Action<Map<String, Object>> action) {
publishActions.add(action);
return this;
} | [
"public",
"Server",
"onpublish",
"(",
"Action",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"action",
")",
"{",
"publishActions",
".",
"add",
"(",
"action",
")",
";",
"return",
"this",
";",
"}"
] | Adds an action to be called with a message to be published to every node in the cluster. | [
"Adds",
"an",
"action",
"to",
"be",
"called",
"with",
"a",
"message",
"to",
"be",
"published",
"to",
"every",
"node",
"in",
"the",
"cluster",
"."
] | 040d29ea4b44c0157fe678b5064b40d0855315fa | https://github.com/cettia/cettia-java-server/blob/040d29ea4b44c0157fe678b5064b40d0855315fa/server/src/main/java/io/cettia/ClusteredServer.java#L55-L58 | train |
cettia/cettia-java-server | server/src/main/java/io/cettia/ServerSocketPredicates.java | ServerSocketPredicates.tag | public static ServerSocketPredicate tag(String... tags) {
return socket -> socket.tags().containsAll(Arrays.asList(tags));
} | java | public static ServerSocketPredicate tag(String... tags) {
return socket -> socket.tags().containsAll(Arrays.asList(tags));
} | [
"public",
"static",
"ServerSocketPredicate",
"tag",
"(",
"String",
"...",
"tags",
")",
"{",
"return",
"socket",
"->",
"socket",
".",
"tags",
"(",
")",
".",
"containsAll",
"(",
"Arrays",
".",
"asList",
"(",
"tags",
")",
")",
";",
"}"
] | Returns a predicate that tests the socket tags against the given tags. | [
"Returns",
"a",
"predicate",
"that",
"tests",
"the",
"socket",
"tags",
"against",
"the",
"given",
"tags",
"."
] | 040d29ea4b44c0157fe678b5064b40d0855315fa | https://github.com/cettia/cettia-java-server/blob/040d29ea4b44c0157fe678b5064b40d0855315fa/server/src/main/java/io/cettia/ServerSocketPredicates.java#L40-L42 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Router.java | Router.addRoute | public static void addRoute(MangooRoute route) {
Objects.requireNonNull(route, Required.ROUTE.toString());
Preconditions.checkArgument(routes.size() <= MAX_ROUTES, "Maximum of " + MAX_ROUTES + " routes reached");
routes.add(route);
if (route instanceof RequestRoute) {
... | java | public static void addRoute(MangooRoute route) {
Objects.requireNonNull(route, Required.ROUTE.toString());
Preconditions.checkArgument(routes.size() <= MAX_ROUTES, "Maximum of " + MAX_ROUTES + " routes reached");
routes.add(route);
if (route instanceof RequestRoute) {
... | [
"public",
"static",
"void",
"addRoute",
"(",
"MangooRoute",
"route",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"route",
",",
"Required",
".",
"ROUTE",
".",
"toString",
"(",
")",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"routes",
".",
"s... | Adds a new route to the router
@param route The route to add | [
"Adds",
"a",
"new",
"route",
"to",
"the",
"router"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Router.java#L41-L53 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Router.java | Router.getReverseRoute | public static RequestRoute getReverseRoute(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return reverseRoutes.get(key.toLowerCase(Locale.ENGLISH));
} | java | public static RequestRoute getReverseRoute(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return reverseRoutes.get(key.toLowerCase(Locale.ENGLISH));
} | [
"public",
"static",
"RequestRoute",
"getReverseRoute",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"return",
"reverseRoutes",
".",
"get",
"(",
"key",
".",
... | Retrieves a reverse route by its controller class and controller method
@param key The controller class and method in the form ControllerClass:ControllerMethod
@return A route object based on the given controller and method or null if none found | [
"Retrieves",
"a",
"reverse",
"route",
"by",
"its",
"controller",
"class",
"and",
"controller",
"method"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Router.java#L123-L126 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java | WebSocketService.addChannel | public void addChannel(WebSocketChannel channel) {
Objects.requireNonNull(channel, Required.CHANNEL.toString());
final String url = RequestUtils.getWebSocketURL(channel);
Set<WebSocketChannel> channels = getChannels(url);
if (channels == null) {
channels = new HashSet<>();
... | java | public void addChannel(WebSocketChannel channel) {
Objects.requireNonNull(channel, Required.CHANNEL.toString());
final String url = RequestUtils.getWebSocketURL(channel);
Set<WebSocketChannel> channels = getChannels(url);
if (channels == null) {
channels = new HashSet<>();
... | [
"public",
"void",
"addChannel",
"(",
"WebSocketChannel",
"channel",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"channel",
",",
"Required",
".",
"CHANNEL",
".",
"toString",
"(",
")",
")",
";",
"final",
"String",
"url",
"=",
"RequestUtils",
".",
"getWebS... | Adds a new channel to the manager
@param channel channel The channel to put | [
"Adds",
"a",
"new",
"channel",
"to",
"the",
"manager"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java#L40-L52 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java | WebSocketService.getChannels | public Set<WebSocketChannel> getChannels(String uri) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<WebSocketChannel> channels = this.cache.get(Default.WSS_CACHE_PREFIX.toString() + uri);
return (channels == null) ? new HashSet<>() : channels;
} | java | public Set<WebSocketChannel> getChannels(String uri) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<WebSocketChannel> channels = this.cache.get(Default.WSS_CACHE_PREFIX.toString() + uri);
return (channels == null) ? new HashSet<>() : channels;
} | [
"public",
"Set",
"<",
"WebSocketChannel",
">",
"getChannels",
"(",
"String",
"uri",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"uri",
",",
"Required",
".",
"URI",
".",
"toString",
"(",
")",
")",
";",
"final",
"Set",
"<",
"WebSocketChannel",
">",
"c... | Retrieves all channels under a given URL
@param uri The URI resource for the channels
@return A Set of channels for the URI resource | [
"Retrieves",
"all",
"channels",
"under",
"a",
"given",
"URL"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java#L74-L80 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/ConcurrentService.java | ConcurrentService.submit | public <T> Future<T> submit(Runnable runnable, T result) {
return this.executorService.submit(runnable, result);
} | java | public <T> Future<T> submit(Runnable runnable, T result) {
return this.executorService.submit(runnable, result);
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submit",
"(",
"Runnable",
"runnable",
",",
"T",
"result",
")",
"{",
"return",
"this",
".",
"executorService",
".",
"submit",
"(",
"runnable",
",",
"result",
")",
";",
"}"
] | Submits a Runnable task for execution and returns a Future representing
that task. The Future's get method will return the given result upon
successful completion.
@param <T> JavaDoc requires this (just ignore it)
@param runnable the task to submit
@param result the result to return
@return a Future representing pend... | [
"Submits",
"a",
"Runnable",
"task",
"for",
"execution",
"and",
"returns",
"a",
"Future",
"representing",
"that",
"task",
".",
"The",
"Future",
"s",
"get",
"method",
"will",
"return",
"the",
"given",
"result",
"upon",
"successful",
"completion",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/ConcurrentService.java#L55-L57 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/i18n/Messages.java | Messages.reload | public void reload(Locale locale) {
this.bundle = ResourceBundle.getBundle(Default.BUNDLE_NAME.toString(), locale);
} | java | public void reload(Locale locale) {
this.bundle = ResourceBundle.getBundle(Default.BUNDLE_NAME.toString(), locale);
} | [
"public",
"void",
"reload",
"(",
"Locale",
"locale",
")",
"{",
"this",
".",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"Default",
".",
"BUNDLE_NAME",
".",
"toString",
"(",
")",
",",
"locale",
")",
";",
"}"
] | Refreshes the resource bundle by reloading the bundle with the default locale
@param locale The locale to use | [
"Refreshes",
"the",
"resource",
"bundle",
"by",
"reloading",
"the",
"bundle",
"with",
"the",
"default",
"locale"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/i18n/Messages.java#L32-L34 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.withRedirect | public static Response withRedirect(String redirectTo) {
Objects.requireNonNull(redirectTo, Required.REDIRECT_TO.toString());
return new Response(redirectTo);
} | java | public static Response withRedirect(String redirectTo) {
Objects.requireNonNull(redirectTo, Required.REDIRECT_TO.toString());
return new Response(redirectTo);
} | [
"public",
"static",
"Response",
"withRedirect",
"(",
"String",
"redirectTo",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"redirectTo",
",",
"Required",
".",
"REDIRECT_TO",
".",
"toString",
"(",
")",
")",
";",
"return",
"new",
"Response",
"(",
"redirectTo"... | Creates a response object with a given url to redirect to
@param redirectTo The URL to redirect to
@return A response object {@link io.mangoo.routing.Response} | [
"Creates",
"a",
"response",
"object",
"with",
"a",
"given",
"url",
"to",
"redirect",
"to"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L217-L221 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andTemplate | public Response andTemplate(String template) {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
this.template = template;
return this;
} | java | public Response andTemplate(String template) {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
this.template = template;
return this;
} | [
"public",
"Response",
"andTemplate",
"(",
"String",
"template",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"template",
",",
"Required",
".",
"TEMPLATE",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"template",
"=",
"template",
";",
"return",
"th... | Sets a specific template to use for the response
@param template The path to the template (e.g. /mytemplate/template.ftl)
@return A response object {@link io.mangoo.routing.Response} | [
"Sets",
"a",
"specific",
"template",
"to",
"use",
"for",
"the",
"response"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L229-L234 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andCharset | public Response andCharset(String charset) {
Objects.requireNonNull(charset, Required.CHARSET.toString());
this.charset = charset;
return this;
} | java | public Response andCharset(String charset) {
Objects.requireNonNull(charset, Required.CHARSET.toString());
this.charset = charset;
return this;
} | [
"public",
"Response",
"andCharset",
"(",
"String",
"charset",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"charset",
",",
"Required",
".",
"CHARSET",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"charset",
"=",
"charset",
";",
"return",
"this",
... | Sets a specific charset to the response
@param charset The charset to use
@return A response object {@link io.mangoo.routing.Response} | [
"Sets",
"a",
"specific",
"charset",
"to",
"the",
"response"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L256-L261 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andCookie | public Response andCookie(Cookie cookie) {
Objects.requireNonNull(cookie, Required.COOKIE.toString());
this.cookies.add(cookie);
return this;
} | java | public Response andCookie(Cookie cookie) {
Objects.requireNonNull(cookie, Required.COOKIE.toString());
this.cookies.add(cookie);
return this;
} | [
"public",
"Response",
"andCookie",
"(",
"Cookie",
"cookie",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"cookie",
",",
"Required",
".",
"COOKIE",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"cookies",
".",
"add",
"(",
"cookie",
")",
";",
"re... | Adds an additional Cookie to the response which is passed to the client
@param cookie The cookie to add
@return A response object {@link io.mangoo.routing.Response} | [
"Adds",
"an",
"additional",
"Cookie",
"to",
"the",
"response",
"which",
"is",
"passed",
"to",
"the",
"client"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L311-L316 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andBinaryFile | @SuppressFBWarnings(justification = "null check of file on entry point of method", value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public Response andBinaryFile(Path file) {
Objects.requireNonNull(file, Required.FILE.toString());
try (InputStream inputStream = Files.newInputStream(file)) {
... | java | @SuppressFBWarnings(justification = "null check of file on entry point of method", value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public Response andBinaryFile(Path file) {
Objects.requireNonNull(file, Required.FILE.toString());
try (InputStream inputStream = Files.newInputStream(file)) {
... | [
"@",
"SuppressFBWarnings",
"(",
"justification",
"=",
"\"null check of file on entry point of method\"",
",",
"value",
"=",
"\"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE\"",
")",
"public",
"Response",
"andBinaryFile",
"(",
"Path",
"file",
")",
"{",
"Objects",
".",
"requireNonNu... | Sends a binary file to the client skipping rendering
@param file The file to send
@return A response object {@link io.mangoo.routing.Response} | [
"Sends",
"a",
"binary",
"file",
"to",
"the",
"client",
"skipping",
"rendering"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L342-L356 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andBinaryContent | public Response andBinaryContent(byte [] content) {
Objects.requireNonNull(content, Required.CONTENT.toString());
this.binaryContent = content.clone();
this.binary = true;
this.rendered = false;
return this;
} | java | public Response andBinaryContent(byte [] content) {
Objects.requireNonNull(content, Required.CONTENT.toString());
this.binaryContent = content.clone();
this.binary = true;
this.rendered = false;
return this;
} | [
"public",
"Response",
"andBinaryContent",
"(",
"byte",
"[",
"]",
"content",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"content",
",",
"Required",
".",
"CONTENT",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"binaryContent",
"=",
"content",
".",... | Sends binary content to the client skipping rendering
@param content The content to to send
@return A response object {@link io.mangoo.routing.Response} | [
"Sends",
"binary",
"content",
"to",
"the",
"client",
"skipping",
"rendering"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L364-L372 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andHeader | public Response andHeader(HttpString key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.headers.put(key, value);
return this;
} | java | public Response andHeader(HttpString key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.headers.put(key, value);
return this;
} | [
"public",
"Response",
"andHeader",
"(",
"HttpString",
"key",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"headers",
".",
"put",
"(",
"key... | Adds an additional header to the request response. If an header
key already exists, it will we overwritten with the latest value.
@param key The header constant from Headers class (e.g. Header.CONTENT_TYPE.toString())
@param value The header value
@return A response object {@link io.mangoo.routing.Response} | [
"Adds",
"an",
"additional",
"header",
"to",
"the",
"request",
"response",
".",
"If",
"an",
"header",
"key",
"already",
"exists",
"it",
"will",
"we",
"overwritten",
"with",
"the",
"latest",
"value",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L411-L416 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andContent | public Response andContent(Map<String, Object> content) {
Objects.requireNonNull(content, Required.CONTENT.toString());
this.content.putAll(content);
return this;
} | java | public Response andContent(Map<String, Object> content) {
Objects.requireNonNull(content, Required.CONTENT.toString());
this.content.putAll(content);
return this;
} | [
"public",
"Response",
"andContent",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"content",
",",
"Required",
".",
"CONTENT",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"content",
".",
... | Adds an additional content map to the content rendered in the template.
Already existing values with the same key are overwritten.
@param content The content map to add
@return A response object {@link io.mangoo.routing.Response} | [
"Adds",
"an",
"additional",
"content",
"map",
"to",
"the",
"content",
"rendered",
"in",
"the",
"template",
".",
"Already",
"existing",
"values",
"with",
"the",
"same",
"key",
"are",
"overwritten",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L425-L430 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/Response.java | Response.andHeaders | public Response andHeaders(Map<HttpString, String> headers) {
Objects.requireNonNull(headers, Required.HEADERS.toString());
this.headers.putAll(headers);
return this;
} | java | public Response andHeaders(Map<HttpString, String> headers) {
Objects.requireNonNull(headers, Required.HEADERS.toString());
this.headers.putAll(headers);
return this;
} | [
"public",
"Response",
"andHeaders",
"(",
"Map",
"<",
"HttpString",
",",
"String",
">",
"headers",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"headers",
",",
"Required",
".",
"HEADERS",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"headers",
".... | Adds an additional header map to the response.
Already existing values with the same key are overwritten.
@param headers The headers map to add
@return A response object {@link io.mangoo.routing.Response} | [
"Adds",
"an",
"additional",
"header",
"map",
"to",
"the",
"response",
".",
"Already",
"existing",
"values",
"with",
"the",
"same",
"key",
"are",
"overwritten",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/Response.java#L439-L444 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java | RequestRoute.respondeWith | public RequestRoute respondeWith(String method) {
Objects.requireNonNull(method, Required.CONTROLLER_METHOD.toString());
this.controllerMethod = method;
return this;
} | java | public RequestRoute respondeWith(String method) {
Objects.requireNonNull(method, Required.CONTROLLER_METHOD.toString());
this.controllerMethod = method;
return this;
} | [
"public",
"RequestRoute",
"respondeWith",
"(",
"String",
"method",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"method",
",",
"Required",
".",
"CONTROLLER_METHOD",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"controllerMethod",
"=",
"method",
";",
... | Sets the controller method to response on request
@param method The controller method
@return RequestRoute instance | [
"Sets",
"the",
"controller",
"method",
"to",
"response",
"on",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java#L66-L70 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java | RequestRoute.withControllerClass | public void withControllerClass(Class<?> clazz) {
Objects.requireNonNull(clazz, Required.CONTROLLER_CLASS.toString());
this.controllerClass = clazz;
} | java | public void withControllerClass(Class<?> clazz) {
Objects.requireNonNull(clazz, Required.CONTROLLER_CLASS.toString());
this.controllerClass = clazz;
} | [
"public",
"void",
"withControllerClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"clazz",
",",
"Required",
".",
"CONTROLLER_CLASS",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"controllerClass",
"=",
"cl... | Sets the controller class of this request
@param clazz The controller class | [
"Sets",
"the",
"controller",
"class",
"of",
"this",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java#L88-L91 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java | RequestRoute.withHttpMethod | public void withHttpMethod(Http method) {
Objects.requireNonNull(method, Required.METHOD.toString());
this.method = method;
} | java | public void withHttpMethod(Http method) {
Objects.requireNonNull(method, Required.METHOD.toString());
this.method = method;
} | [
"public",
"void",
"withHttpMethod",
"(",
"Http",
"method",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"method",
",",
"Required",
".",
"METHOD",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"method",
"=",
"method",
";",
"}"
] | Sets the HTTP method of this request
@param method The controller method | [
"Sets",
"the",
"HTTP",
"method",
"of",
"this",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/RequestRoute.java#L98-L101 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java | Request.getHeader | public String getHeader(HttpString headerName) {
return (this.httpServerExchange.getRequestHeaders().get(headerName) == null) ? null : this.httpServerExchange.getRequestHeaders().get(headerName).element();
} | java | public String getHeader(HttpString headerName) {
return (this.httpServerExchange.getRequestHeaders().get(headerName) == null) ? null : this.httpServerExchange.getRequestHeaders().get(headerName).element();
} | [
"public",
"String",
"getHeader",
"(",
"HttpString",
"headerName",
")",
"{",
"return",
"(",
"this",
".",
"httpServerExchange",
".",
"getRequestHeaders",
"(",
")",
".",
"get",
"(",
"headerName",
")",
"==",
"null",
")",
"?",
"null",
":",
"this",
".",
"httpSer... | Retrieves a specific header value by its name
@param headerName The name of the header to retrieve
@return The value of the header or null if none found | [
"Retrieves",
"a",
"specific",
"header",
"value",
"by",
"its",
"name"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java#L168-L170 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java | Request.addAttribute | public void addAttribute(String key, Object value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.attributes.put(key, value);
} | java | public void addAttribute(String key, Object value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.attributes.put(key, value);
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"attributes",
".",
"put",
"(",
"key",... | Adds an attribute to the internal attributes map
@param key The key to store the attribute
@param value The value to store | [
"Adds",
"an",
"attribute",
"to",
"the",
"internal",
"attributes",
"map"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java#L242-L245 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java | Request.getAttribute | public Object getAttribute(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.attributes.get(key);
} | java | public Object getAttribute(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.attributes.get(key);
} | [
"public",
"Object",
"getAttribute",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"return",
"this",
".",
"attributes",
".",
"get",
"(",
"key",
")",
";",
... | Returns an object attribute from a given key
@param key The key the attribute is stored
@return Object the value from the attribues map | [
"Returns",
"an",
"object",
"attribute",
"from",
"a",
"given",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java#L284-L287 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java | ServerSentEventService.addConnection | public void addConnection(ServerSentEventConnection connection) {
Objects.requireNonNull(connection, Required.CONNECTION.toString());
final String url = RequestUtils.getServerSentEventURL(connection);
Set<ServerSentEventConnection> uriConnections = getConnections(url);
if (uriConnection... | java | public void addConnection(ServerSentEventConnection connection) {
Objects.requireNonNull(connection, Required.CONNECTION.toString());
final String url = RequestUtils.getServerSentEventURL(connection);
Set<ServerSentEventConnection> uriConnections = getConnections(url);
if (uriConnection... | [
"public",
"void",
"addConnection",
"(",
"ServerSentEventConnection",
"connection",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"connection",
",",
"Required",
".",
"CONNECTION",
".",
"toString",
"(",
")",
")",
";",
"final",
"String",
"url",
"=",
"RequestUtil... | Adds a new connection to the manager
@param connection The connection to put | [
"Adds",
"a",
"new",
"connection",
"to",
"the",
"manager"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java#L41-L53 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java | ServerSentEventService.send | public void send(String uri, String data) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = getConnections(uri);
if (uriConnections != null) {
uriConnections.stream()
.filter(ServerSentEventConnection::isOpe... | java | public void send(String uri, String data) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = getConnections(uri);
if (uriConnections != null) {
uriConnections.stream()
.filter(ServerSentEventConnection::isOpe... | [
"public",
"void",
"send",
"(",
"String",
"uri",
",",
"String",
"data",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"uri",
",",
"Required",
".",
"URI",
".",
"toString",
"(",
")",
")",
";",
"final",
"Set",
"<",
"ServerSentEventConnection",
">",
"uriCo... | Sends data to all connections for a given URI resource
@param uri The URI resource for the connection
@param data The event data | [
"Sends",
"data",
"to",
"all",
"connections",
"for",
"a",
"given",
"URI",
"resource"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java#L61-L71 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java | ServerSentEventService.getConnections | public Set<ServerSentEventConnection> getConnections(String uri) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = this.cache.get(Default.SSE_CACHE_PREFIX.toString() + uri);
return (uriConnections == null) ? new HashSet<>() : uriConne... | java | public Set<ServerSentEventConnection> getConnections(String uri) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = this.cache.get(Default.SSE_CACHE_PREFIX.toString() + uri);
return (uriConnections == null) ? new HashSet<>() : uriConne... | [
"public",
"Set",
"<",
"ServerSentEventConnection",
">",
"getConnections",
"(",
"String",
"uri",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"uri",
",",
"Required",
".",
"URI",
".",
"toString",
"(",
")",
")",
";",
"final",
"Set",
"<",
"ServerSentEventCon... | Retrieves all connection resources under a given URL
@param uri The URI resource for the connections
@return A Set of connections for the URI resource | [
"Retrieves",
"all",
"connection",
"resources",
"under",
"a",
"given",
"URL"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java#L119-L125 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Flash.java | Flash.put | public void put(String key, String value) {
if (validCharacters(key) && validCharacters(value)) {
this.values.put(key, value);
}
} | java | public void put(String key, String value) {
if (validCharacters(key) && validCharacters(value)) {
this.values.put(key, value);
}
} | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"validCharacters",
"(",
"key",
")",
"&&",
"validCharacters",
"(",
"value",
")",
")",
"{",
"this",
".",
"values",
".",
"put",
"(",
"key",
",",
"value",
")",
... | Adds a value with a specific key to the flash overwriting an
existing value
@param key The key
@param value The value | [
"Adds",
"a",
"value",
"with",
"a",
"specific",
"key",
"to",
"the",
"flash",
"overwriting",
"an",
"existing",
"value"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Flash.java#L86-L90 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Flash.java | Flash.validCharacters | private boolean validCharacters(String value) {
if (INVALID_CHARACTERS.contains(value)) {
LOG.error("Flash key or value can not contain the following characters: spaces, |, & or :");
return false;
}
return true;
} | java | private boolean validCharacters(String value) {
if (INVALID_CHARACTERS.contains(value)) {
LOG.error("Flash key or value can not contain the following characters: spaces, |, & or :");
return false;
}
return true;
} | [
"private",
"boolean",
"validCharacters",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"INVALID_CHARACTERS",
".",
"contains",
"(",
"value",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Flash key or value can not contain the following characters: spaces, |, & or :\"",
")",... | Checks if the given value contains characters that are not allowed
in the key or value of a flash cookie
@param value The value to check
@return True if the given string is valid, false otherwise | [
"Checks",
"if",
"the",
"given",
"value",
"contains",
"characters",
"that",
"are",
"not",
"allowed",
"in",
"the",
"key",
"or",
"value",
"of",
"a",
"flash",
"cookie"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Flash.java#L138-L145 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java | MangooUtils.getVersion | public static String getVersion() {
String version = Default.VERSION_UNKNOW.toString();
try (InputStream inputStream = Resources.getResource(Default.VERSION_PROPERTIES.toString()).openStream()) {
final Properties properties = new Properties();
properties.load(inputStream);
... | java | public static String getVersion() {
String version = Default.VERSION_UNKNOW.toString();
try (InputStream inputStream = Resources.getResource(Default.VERSION_PROPERTIES.toString()).openStream()) {
final Properties properties = new Properties();
properties.load(inputStream);
... | [
"public",
"static",
"String",
"getVersion",
"(",
")",
"{",
"String",
"version",
"=",
"Default",
".",
"VERSION_UNKNOW",
".",
"toString",
"(",
")",
";",
"try",
"(",
"InputStream",
"inputStream",
"=",
"Resources",
".",
"getResource",
"(",
"Default",
".",
"VERSI... | Retrieves the current version of the framework from the version.properties file
@return Current mangoo I/O version | [
"Retrieves",
"the",
"current",
"version",
"of",
"the",
"framework",
"from",
"the",
"version",
".",
"properties",
"file"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java#L45-L56 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java | MangooUtils.copyMap | public static Map<String, String> copyMap(Map<String, String> originalMap) {
Objects.requireNonNull(originalMap, Required.MAP.toString());
return new HashMap<>(originalMap);
} | java | public static Map<String, String> copyMap(Map<String, String> originalMap) {
Objects.requireNonNull(originalMap, Required.MAP.toString());
return new HashMap<>(originalMap);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"copyMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"originalMap",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"originalMap",
",",
"Required",
".",
"MAP",
".",
"toString",
"(",
")",... | Copies a given map to a new map instance
@param originalMap The map to copy
@return A new Map instance with value from originalMap | [
"Copies",
"a",
"given",
"map",
"to",
"a",
"new",
"map",
"instance"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java#L64-L68 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java | MangooUtils.randomString | public static String randomString(int length) {
Preconditions.checkArgument(length > MIN_PASSWORD_LENGTH, "random string length must be at least 1 character");
Preconditions.checkArgument(length <= MAX_PASSWORD_LENGTH, "random string length must be at most 256 character");
return Random... | java | public static String randomString(int length) {
Preconditions.checkArgument(length > MIN_PASSWORD_LENGTH, "random string length must be at least 1 character");
Preconditions.checkArgument(length <= MAX_PASSWORD_LENGTH, "random string length must be at most 256 character");
return Random... | [
"public",
"static",
"String",
"randomString",
"(",
"int",
"length",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"length",
">",
"MIN_PASSWORD_LENGTH",
",",
"\"random string length must be at least 1 character\"",
")",
";",
"Preconditions",
".",
"checkArgument",
... | Generates a random string with the given length.
Based on commons-lang3 RandomStringUtils using SecureRandom
Uses: uppercase letters, lowercase letters and numbers
@param length The length of the random string
@return A random String | [
"Generates",
"a",
"random",
"string",
"with",
"the",
"given",
"length",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java#L80-L85 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java | MangooUtils.readableFileSize | public static String readableFileSize(long size) {
if (size <= 0) {
return "0";
}
int index = (int) (Math.log10(size) / Math.log10(CONVERTION));
return new DecimalFormat("#,##0.#").format(size / Math.pow(CONVERTION, index)) + " " + UNITS[index];
} | java | public static String readableFileSize(long size) {
if (size <= 0) {
return "0";
}
int index = (int) (Math.log10(size) / Math.log10(CONVERTION));
return new DecimalFormat("#,##0.#").format(size / Math.pow(CONVERTION, index)) + " " + UNITS[index];
} | [
"public",
"static",
"String",
"readableFileSize",
"(",
"long",
"size",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"return",
"\"0\"",
";",
"}",
"int",
"index",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"log10",
"(",
"size",
")",
"/",
"Math",
... | Converts a given file size into a readable file size including unit
@param size The size in bytes to convert
@return Readable files size, e.g. 24 MB | [
"Converts",
"a",
"given",
"file",
"size",
"into",
"a",
"readable",
"file",
"size",
"including",
"unit"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java#L103-L110 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java | MangooUtils.resourceExists | public static boolean resourceExists(String name) {
Objects.requireNonNull(name, Required.NAME.toString());
URL resource = null;
try {
resource = Resources.getResource(name);
} catch (IllegalArgumentException e) { // NOSONAR Intentionally not logging or t... | java | public static boolean resourceExists(String name) {
Objects.requireNonNull(name, Required.NAME.toString());
URL resource = null;
try {
resource = Resources.getResource(name);
} catch (IllegalArgumentException e) { // NOSONAR Intentionally not logging or t... | [
"public",
"static",
"boolean",
"resourceExists",
"(",
"String",
"name",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"name",
",",
"Required",
".",
"NAME",
".",
"toString",
"(",
")",
")",
";",
"URL",
"resource",
"=",
"null",
";",
"try",
"{",
"resource... | Checks if a resource exists in the classpath
@param name The name of the resource
@return True if the resources exists, false otherwise | [
"Checks",
"if",
"a",
"resource",
"exists",
"in",
"the",
"classpath"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/MangooUtils.java#L118-L129 | train |
svenkubiak/mangooio | mangooio-maven-plugin/src/main/java/io/mangoo/build/Minification.java | Minification.minify | public static void minify(String absolutePath) {
if (absolutePath == null || absolutePath.contains(MIN)) {
return;
}
if (config == null) {
System.setProperty(Key.APPLICATION_CONFIG.toString(), basePath + Default.CONFIG_PATH.toString());
config = new Config(Mo... | java | public static void minify(String absolutePath) {
if (absolutePath == null || absolutePath.contains(MIN)) {
return;
}
if (config == null) {
System.setProperty(Key.APPLICATION_CONFIG.toString(), basePath + Default.CONFIG_PATH.toString());
config = new Config(Mo... | [
"public",
"static",
"void",
"minify",
"(",
"String",
"absolutePath",
")",
"{",
"if",
"(",
"absolutePath",
"==",
"null",
"||",
"absolutePath",
".",
"contains",
"(",
"MIN",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"config",
"==",
"null",
")",
"{",
... | Minifies a JS or CSS file to a corresponding JS or CSS file
@param absolutePath The absolute path to the file | [
"Minifies",
"a",
"JS",
"or",
"CSS",
"file",
"to",
"a",
"corresponding",
"JS",
"or",
"CSS",
"file"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-maven-plugin/src/main/java/io/mangoo/build/Minification.java#L76-L91 | train |
svenkubiak/mangooio | mangooio-maven-plugin/src/main/java/io/mangoo/build/Minification.java | Minification.preprocess | public static void preprocess(String absolutePath) {
if (absolutePath == null) {
return;
}
if (config == null) {
System.setProperty(Key.APPLICATION_CONFIG.toString(), basePath + Default.CONFIG_PATH.toString());
config = new Config();
}
if (co... | java | public static void preprocess(String absolutePath) {
if (absolutePath == null) {
return;
}
if (config == null) {
System.setProperty(Key.APPLICATION_CONFIG.toString(), basePath + Default.CONFIG_PATH.toString());
config = new Config();
}
if (co... | [
"public",
"static",
"void",
"preprocess",
"(",
"String",
"absolutePath",
")",
"{",
"if",
"(",
"absolutePath",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"System",
".",
"setProperty",
"(",
"Key",
".",
"APPLI... | Compiles a LESS or SASS file to a corresponding CSS file
@param absolutePath The absolute path to the file | [
"Compiles",
"a",
"LESS",
"or",
"SASS",
"file",
"to",
"a",
"corresponding",
"CSS",
"file"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-maven-plugin/src/main/java/io/mangoo/build/Minification.java#L98-L113 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/templating/TemplateEngine.java | TemplateEngine.getSources | @SuppressFBWarnings(justification = "SourcePath should intentionally come from user file path", value = "PATH_TRAVERSAL_IN")
private List<Source> getSources(int errorLine, String sourcePath) throws IOException {
Objects.requireNonNull(sourcePath, Required.SOURCE_PATH.toString());
StringBuilder buff... | java | @SuppressFBWarnings(justification = "SourcePath should intentionally come from user file path", value = "PATH_TRAVERSAL_IN")
private List<Source> getSources(int errorLine, String sourcePath) throws IOException {
Objects.requireNonNull(sourcePath, Required.SOURCE_PATH.toString());
StringBuilder buff... | [
"@",
"SuppressFBWarnings",
"(",
"justification",
"=",
"\"SourcePath should intentionally come from user file path\"",
",",
"value",
"=",
"\"PATH_TRAVERSAL_IN\"",
")",
"private",
"List",
"<",
"Source",
">",
"getSources",
"(",
"int",
"errorLine",
",",
"String",
"sourcePath"... | Retrieves the lines of code where an exception occurred
@param errorLine The line number of the exception
@param sourcePath The path to the source code file
@return A list of source code with the exception and surrounding lines
@throws IOException If an IO exception occurs | [
"Retrieves",
"the",
"lines",
"of",
"code",
"where",
"an",
"exception",
"occurred"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/templating/TemplateEngine.java#L145-L173 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/templating/TemplateEngine.java | TemplateEngine.getSourceCodePath | private String getSourceCodePath(StackTraceElement stackTraceElement) {
Objects.requireNonNull(stackTraceElement, Required.STACK_TRACE_ELEMENT.toString());
String packageName = stackTraceElement.getClassName();
int position = packageName.lastIndexOf('.');
if (position > 0) {
... | java | private String getSourceCodePath(StackTraceElement stackTraceElement) {
Objects.requireNonNull(stackTraceElement, Required.STACK_TRACE_ELEMENT.toString());
String packageName = stackTraceElement.getClassName();
int position = packageName.lastIndexOf('.');
if (position > 0) {
... | [
"private",
"String",
"getSourceCodePath",
"(",
"StackTraceElement",
"stackTraceElement",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"stackTraceElement",
",",
"Required",
".",
"STACK_TRACE_ELEMENT",
".",
"toString",
"(",
")",
")",
";",
"String",
"packageName",
... | Retrieves the source code file name from an StrackTraceElement
@param stackTraceElement The StrackTraceElement to check
@return Source code filename | [
"Retrieves",
"the",
"source",
"code",
"file",
"name",
"from",
"an",
"StrackTraceElement"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/templating/TemplateEngine.java#L197-L208 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/LimitHandler.java | LimitHandler.getCacheKey | private String getCacheKey(HttpServerExchange exchange) {
String host = null;
HeaderMap headerMap = exchange.getRequestHeaders();
if (headerMap != null) {
HeaderValues headerValues = headerMap.get(Header.X_FORWARDED_FOR.toHttpString());
if (headerValues != null) {
... | java | private String getCacheKey(HttpServerExchange exchange) {
String host = null;
HeaderMap headerMap = exchange.getRequestHeaders();
if (headerMap != null) {
HeaderValues headerValues = headerMap.get(Header.X_FORWARDED_FOR.toHttpString());
if (headerValues != null) {
... | [
"private",
"String",
"getCacheKey",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"String",
"host",
"=",
"null",
";",
"HeaderMap",
"headerMap",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
";",
"if",
"(",
"headerMap",
"!=",
"null",
")",
"{",
"Head... | Creates a key for used for limit an request containing the
requested url and the source host
@param exchange The HttpServerExchange
@return The key url + host | [
"Creates",
"a",
"key",
"for",
"used",
"for",
"limit",
"an",
"request",
"containing",
"the",
"requested",
"url",
"and",
"the",
"source",
"host"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/LimitHandler.java#L70-L98 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/LimitHandler.java | LimitHandler.nextHandler | protected void nextHandler(HttpServerExchange exchange) throws Exception {
if (this.attachment.hasBasicAuthentication()) {
HttpHandler httpHandler = RequestUtils.wrapBasicAuthentication(
Application.getInstance(LocaleHandler.class),
this.attachment.getUsername... | java | protected void nextHandler(HttpServerExchange exchange) throws Exception {
if (this.attachment.hasBasicAuthentication()) {
HttpHandler httpHandler = RequestUtils.wrapBasicAuthentication(
Application.getInstance(LocaleHandler.class),
this.attachment.getUsername... | [
"protected",
"void",
"nextHandler",
"(",
"HttpServerExchange",
"exchange",
")",
"throws",
"Exception",
"{",
"if",
"(",
"this",
".",
"attachment",
".",
"hasBasicAuthentication",
"(",
")",
")",
"{",
"HttpHandler",
"httpHandler",
"=",
"RequestUtils",
".",
"wrapBasicA... | Handles the next request in the handler chain
@param exchange The HttpServerExchange
@throws Exception Thrown when an exception occurs | [
"Handles",
"the",
"next",
"request",
"in",
"the",
"handler",
"chain"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/LimitHandler.java#L115-L126 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java | TotpUtils.getQRCode | public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Require... | java | public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Require... | [
"public",
"static",
"String",
"getQRCode",
"(",
"String",
"name",
",",
"String",
"issuer",
",",
"String",
"secret",
",",
"HmacShaAlgorithm",
"algorithm",
",",
"String",
"digits",
",",
"String",
"period",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"name",... | Generates a QR code to share a secret with a user
@param name The name of the account
@param issuer The name of the issuer
@param secret The secret to use
@param algorithm The algorithm to use
@param digits The number of digits to use
@param period The period to use
@return An URL to Google charts API with the QR cod... | [
"Generates",
"a",
"QR",
"code",
"to",
"share",
"a",
"secret",
"with",
"a",
"user"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java#L156-L169 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java | TotpUtils.getOtpauthURL | public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Req... | java | public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Req... | [
"public",
"static",
"String",
"getOtpauthURL",
"(",
"String",
"name",
",",
"String",
"issuer",
",",
"String",
"secret",
",",
"HmacShaAlgorithm",
"algorithm",
",",
"String",
"digits",
",",
"String",
"period",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"na... | Generates a otpauth code to share a secret with a user
@param name The name of the account
@param issuer The name of the issuer
@param secret The secret to use
@param algorithm The algorithm to use
@param digits The number of digits to use
@param period The period to use
@return An otpauth url | [
"Generates",
"a",
"otpauth",
"code",
"to",
"share",
"a",
"secret",
"with",
"a",
"user"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java#L183-L213 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java | InboundCookiesHandler.getSessionCookie | @SuppressWarnings("unchecked")
protected Session getSessionCookie(HttpServerExchange exchange) {
Session session = Session.create()
.withContent(new HashMap<>())
.withAuthenticity(MangooUtils.randomString(STRING_LENGTH));
if (this.config.getSessionCookieExpires() > 0) {
... | java | @SuppressWarnings("unchecked")
protected Session getSessionCookie(HttpServerExchange exchange) {
Session session = Session.create()
.withContent(new HashMap<>())
.withAuthenticity(MangooUtils.randomString(STRING_LENGTH));
if (this.config.getSessionCookieExpires() > 0) {
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Session",
"getSessionCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Session",
"session",
"=",
"Session",
".",
"create",
"(",
")",
".",
"withContent",
"(",
"new",
"HashMap",
"<>",
"(",
... | Retrieves the current session from the HttpServerExchange
@param exchange The Undertow HttpServerExchange | [
"Retrieves",
"the",
"current",
"session",
"from",
"the",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java#L75-L116 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java | InboundCookiesHandler.getAuthenticationCookie | protected Authentication getAuthenticationCookie(HttpServerExchange exchange) {
Authentication authentication = Authentication.create().withSubject(null);
String cookieValue = getCookieValue(exchange, this.config.getAuthenticationCookieName());
if (StringUtils.isNotBlank(cookieValue)) {... | java | protected Authentication getAuthenticationCookie(HttpServerExchange exchange) {
Authentication authentication = Authentication.create().withSubject(null);
String cookieValue = getCookieValue(exchange, this.config.getAuthenticationCookieName());
if (StringUtils.isNotBlank(cookieValue)) {... | [
"protected",
"Authentication",
"getAuthenticationCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Authentication",
"authentication",
"=",
"Authentication",
".",
"create",
"(",
")",
".",
"withSubject",
"(",
"null",
")",
";",
"String",
"cookieValue",
"=",
"g... | Retrieves the current authentication from the HttpServerExchange
@param exchange The Undertow HttpServerExchange | [
"Retrieves",
"the",
"current",
"authentication",
"from",
"the",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java#L123-L159 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java | InboundCookiesHandler.getFlashCookie | @SuppressWarnings("unchecked")
protected Flash getFlashCookie(HttpServerExchange exchange) {
Flash flash = Flash.create();
final String cookieValue = getCookieValue(exchange, this.config.getFlashCookieName());
if (StringUtils.isNotBlank(cookieValue)) {
try {
... | java | @SuppressWarnings("unchecked")
protected Flash getFlashCookie(HttpServerExchange exchange) {
Flash flash = Flash.create();
final String cookieValue = getCookieValue(exchange, this.config.getFlashCookieName());
if (StringUtils.isNotBlank(cookieValue)) {
try {
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Flash",
"getFlashCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Flash",
"flash",
"=",
"Flash",
".",
"create",
"(",
")",
";",
"final",
"String",
"cookieValue",
"=",
"getCookieValue",
"(... | Retrieves the flash cookie from the current
@param exchange The Undertow HttpServerExchange | [
"Retrieves",
"the",
"flash",
"cookie",
"from",
"the",
"current"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java#L166-L197 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java | InboundCookiesHandler.getCookieValue | private String getCookieValue(HttpServerExchange exchange, String cookieName) {
String value = null;
Map<String, Cookie> requestCookies = exchange.getRequestCookies();
if (requestCookies != null) {
Cookie cookie = exchange.getRequestCookies().get(cookieName);
if (cookie !... | java | private String getCookieValue(HttpServerExchange exchange, String cookieName) {
String value = null;
Map<String, Cookie> requestCookies = exchange.getRequestCookies();
if (requestCookies != null) {
Cookie cookie = exchange.getRequestCookies().get(cookieName);
if (cookie !... | [
"private",
"String",
"getCookieValue",
"(",
"HttpServerExchange",
"exchange",
",",
"String",
"cookieName",
")",
"{",
"String",
"value",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"Cookie",
">",
"requestCookies",
"=",
"exchange",
".",
"getRequestCookies",
"(",
... | Retrieves the value of a cookie with a given name from a HttpServerExchange
@param exchange The exchange containing the cookie
@param cookieName The name of the cookie
@return The value of the cookie or null if none found | [
"Retrieves",
"the",
"value",
"of",
"a",
"cookie",
"with",
"a",
"given",
"name",
"from",
"a",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java#L207-L218 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.