use of java.util.regex.Matcher in project buck by facebook.
the class CompileStringsStepTest method testContentRegex.
private void testContentRegex(String input, boolean matches, String resourceType, String resourceName, String resourceId) {
Matcher matcher = CompileStringsStep.R_DOT_TXT_STRING_RESOURCE_PATTERN.matcher(input);
assertEquals(matches, matcher.matches());
if (!matches) {
return;
}
assertEquals("Resource type does not match.", resourceType, matcher.group(1));
assertEquals("Resource name does not match.", resourceName, matcher.group(2));
assertEquals("Resource id does not match.", resourceId, matcher.group(3));
}
use of java.util.regex.Matcher in project buck by facebook.
the class FilterResourcesStepTest method assertMatchesRegex.
private static void assertMatchesRegex(String path, String language, String country) {
Matcher matcher = FilterResourcesStep.NON_ENGLISH_STRINGS_FILE_PATH.matcher(path);
assertTrue(matcher.matches());
assertEquals(language, matcher.group(1));
assertEquals(country, matcher.group(2));
}
use of java.util.regex.Matcher in project buck by facebook.
the class InstallCommandIntegrationTest method appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging.
@Test
public void appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging() throws IOException, InterruptedException {
assumeThat(Platform.detect(), is(Platform.MACOS));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_app_bundle", tmp);
workspace.setUp();
workspace.enableDirCache();
// build locally
ProcessResult result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
assumeFalse(result.getStderr().contains("no appropriate simulator found"));
result.assertSuccess();
// find port to connect lldb to
// "lldb -p 12345"
Pattern p = Pattern.compile("lldb -p \\d{1,6}");
Matcher matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand = matcher.group().split(" ");
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
// run lldb session
ProcessExecutor.Result lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations
String lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
// clean buck out
workspace.runBuckCommand("clean");
// build again - get everything from cache now
result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
result.assertSuccess();
matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand2 = matcher.group().split(" ");
// run lldb session again - now on top of files fetched from cache
lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand2).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations with files from cache
lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
}
use of java.util.regex.Matcher in project jetty.project by eclipse.
the class SpringXmlConfigurationTest method init.
@Before
public void init() throws Exception {
// Jetty's XML configuration will make use of java.util.ServiceLoader
// to load the proper ConfigurationProcessorFactory, so these tests
// will always fail in JDK 5.
String javaVersion = System.getProperty("java.version");
Pattern regexp = Pattern.compile("1\\.(\\d{1})\\..*");
Matcher matcher = regexp.matcher(javaVersion);
if (matcher.matches()) {
String minor = matcher.group(1);
assumeTrue(Integer.parseInt(minor) > 5);
}
}
use of java.util.regex.Matcher in project jetty.project by eclipse.
the class SslBytesServerTest method assumeJavaVersionSupportsTLSRenegotiations.
private void assumeJavaVersionSupportsTLSRenegotiations() {
// Due to a security bug, TLS renegotiations were disabled in JDK 1.6.0_19-21
// so we check the java version in order to avoid to fail the test.
String javaVersion = System.getProperty("java.version");
Pattern regexp = Pattern.compile("1\\.6\\.0_(\\d{2})");
Matcher matcher = regexp.matcher(javaVersion);
if (matcher.matches()) {
String nano = matcher.group(1);
Assume.assumeThat(Integer.parseInt(nano), Matchers.greaterThan(21));
}
}
Aggregations