use of java.util.Enumeration in project Fling by entertailion.
the class HttpServer method serve.
// ==================================================
// API parts
// ==================================================
/**
* Override this to customize the server.
* <p>
*
* (By default, this delegates to serveFile() and allows directory listing.)
*
* @param uri
* Percent-decoded URI without parameters, for example
* "/index.cgi"
* @param method
* "GET", "POST" etc.
* @param parms
* Parsed, percent decoded parameters from URI and, in case of
* POST, data.
* @param header
* Header entries, percent decoded
* @return HTTP response, see class Response for details
*/
public Response serve(String uri, String method, Properties header, Properties parms, Properties files) {
System.out.println(method + " '" + uri + "' ");
Enumeration e = header.propertyNames();
while (e.hasMoreElements()) {
String value = (String) e.nextElement();
System.out.println(" HDR: '" + value + "' = '" + header.getProperty(value) + "'");
}
e = parms.propertyNames();
while (e.hasMoreElements()) {
String value = (String) e.nextElement();
System.out.println(" PRM: '" + value + "' = '" + parms.getProperty(value) + "'");
}
e = files.propertyNames();
while (e.hasMoreElements()) {
String value = (String) e.nextElement();
System.out.println(" UPLOADED: '" + value + "' = '" + files.getProperty(value) + "'");
}
return serveFile(uri, header, new File("."), true);
}
use of java.util.Enumeration in project vert.x by eclipse.
the class StarterTest method clearProperties.
private void clearProperties() {
Set<String> toClear = new HashSet<>();
Enumeration e = System.getProperties().propertyNames();
// Uhh, properties suck
while (e.hasMoreElements()) {
String propName = (String) e.nextElement();
if (propName.startsWith("vertx.options")) {
toClear.add(propName);
}
}
for (String propName : toClear) {
System.clearProperty(propName);
}
}
use of java.util.Enumeration in project android_frameworks_base by ParanoidAndroid.
the class TestCaseUtil method getTests.
private static List<? extends Test> getTests(Test test, boolean flatten, Set<Class<?>> seen) {
List<Test> testCases = Lists.newArrayList();
if (test != null) {
Test workingTest = null;
/*
* If we want to run a single TestCase method only, we must not
* invoke the suite() method, because we will run all test methods
* of the class then.
*/
if (test instanceof TestCase && ((TestCase) test).getName() == null) {
workingTest = invokeSuiteMethodIfPossible(test.getClass(), seen);
}
if (workingTest == null) {
workingTest = test;
}
if (workingTest instanceof TestSuite) {
TestSuite testSuite = (TestSuite) workingTest;
Enumeration enumeration = testSuite.tests();
while (enumeration.hasMoreElements()) {
Test childTest = (Test) enumeration.nextElement();
if (flatten) {
testCases.addAll(getTests(childTest, flatten, seen));
} else {
testCases.add(childTest);
}
}
} else {
testCases.add(workingTest);
}
}
return testCases;
}
use of java.util.Enumeration in project android_frameworks_base by ParanoidAndroid.
the class TestCaseUtil method getTestAtIndex.
public static Test getTestAtIndex(TestSuite testSuite, int position) {
int index = 0;
Enumeration enumeration = testSuite.tests();
while (enumeration.hasMoreElements()) {
Test test = (Test) enumeration.nextElement();
if (index == position) {
return test;
}
index++;
}
return null;
}
use of java.util.Enumeration in project sonarqube by SonarSource.
the class ConfigurationUtils method interpolateVariables.
public static Properties interpolateVariables(Properties properties, Map<String, String> variables) {
Properties result = new Properties();
Enumeration keys = properties.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = (String) properties.get(key);
String interpolatedValue = StrSubstitutor.replace(value, variables, "${env:", "}");
result.setProperty(key, interpolatedValue);
}
return result;
}
Aggregations