@Override public void whetherMenusAreAccessible() throws Throwable { Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { System.err.println(event); } }, AWTEvent.KEY_EVENT_MASK); if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) { throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+"); } exitItemCalled = false; driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f")); new WaitWithoutException("Waiting for exit item to be shown") { @Override public boolean until() { return exitItem.isShowing(); } }; driver.click(exitItem, Buttons.LEFT, 1, 0, 0); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return exitItemCalled; } }; AssertJUnit.assertEquals(true, exitItemCalled); }
@Override public void whetherMenusAreAccessible() throws Throwable { if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) { throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+"); } exitItemCalled = false; driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f")); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return menu.isPopupMenuVisible(); } }; driver.sendKeys(exitItem, JavaAgentKeys.ENTER); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return exitItemCalled; } }; AssertJUnit.assertEquals(true, exitItemCalled); }
public void contextclickOnTextfield() throws Throwable { if (Platform.getCurrent().is(Platform.MAC)) { throw new SkipException("Context clicking a textfield on mac and java 1.7+ doesn't work and don't know why!!!"); } try { Thread.sleep(10000); textFieldClicked = false; driver.click(textField, Buttons.RIGHT, 1, 1, 1); new DeviceTest.WaitWithoutException("Waiting for the text field to be clicked") { @Override public boolean until() { return textFieldClicked; } }; AssertJUnit.assertTrue(textFieldClicked); } finally { Logger.getLogger(DeviceMouseTest.class.getName()).info(tfMouseText.toString()); } }
public void sendKeysKeyboardMap() throws Throwable { if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) { throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7"); } kss.clear(); driver.sendKeys(textField, "A"); new WaitWithoutException("Waiting for the keypress") { @Override public boolean until() { try { return kss.toString().contains(KeyStroke.getKeyStroke("released SHIFT").toString()); } catch (Throwable t) { return false; } } }; List<KeyStroke> expected = Arrays.asList(KeyStroke.getKeyStroke("shift pressed SHIFT"), KeyStroke.getKeyStroke("shift pressed A"), KeyStroke.getKeyStroke("shift typed A"), KeyStroke.getKeyStroke("shift released A"), KeyStroke.getKeyStroke("released SHIFT")); AssertJUnit.assertEquals(expected.toString(), kss.toString()); }
public void sendKeysSelectAll() throws Throwable { if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) { throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7"); } driver.sendKeys(textField, "Hello World"); driver.sendKeys(textField, getOSKey(), "a"); driver.sendKeys(textField, JavaAgentKeys.NULL); new WaitWithoutException("Waiting for the select event") { @Override public boolean until() { try { Object text = EventQueueWait.call(textField, "getSelectedText"); return text != null && text.equals("Hello World"); } catch (NoSuchMethodException e) { e.printStackTrace(); return false; } } }; String expected = "Hello World"; AssertJUnit.assertEquals(expected, EventQueueWait.<String> call(textField, "getSelectedText")); }
public void whetherMenusAreAccessible() throws Throwable { if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) { throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+"); } exitItemCalled = false; driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f")); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return menu.isPopupMenuVisible(); } }; driver.sendKeys(exitItem, JavaAgentKeys.ENTER); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return exitItemCalled; } }; AssertJUnit.assertEquals(true, exitItemCalled); }
public void executeWSCommand() throws Throwable { if (OS.isFamilyWindows()) { throw new SkipException("Test not valid for Windows"); } JavaProfile profile = new JavaProfile(LaunchMode.JAVA_WEBSTART).addWSArgument("-verbose").addVMArgument("-Dx.y.z=hello"); final CommandLine commandLine = profile.getCommandLine(); AssertJUnit.assertNotNull(commandLine); AssertJUnit.assertTrue(commandLine.toString().contains("-javaagent:")); AssertJUnit.assertTrue(commandLine.toString().contains("-verbose")); AssertJUnit.assertTrue(commandLine.toString().contains("-Dx.y.z=hello")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); commandLine.copyOutputTo(baos); commandLine.executeAsync(); new Wait("Waiting till the command is complete") { @Override public boolean until() { return !commandLine.isRunning(); } }; BufferedReader reader = new BufferedReader(new StringReader(new String(baos.toByteArray()))); String line = reader.readLine(); while (line != null && !line.contains("Web Start")) { line = reader.readLine(); } AssertJUnit.assertTrue(line.contains("Web Start")); }
@Test public void shouldThrowHiddenMalformedURLException() { XmlConfig config = new XmlConfig(new HashMap<String, String>() { { put(BROWSER_NAME, "firefox"); put(PLATFORM_NAME, "ANY"); } }); Browser browser = spy(firefox); doReturn("localhost").when(browser).url(); assertThat(catchThrowable(() -> defaultFactory.createDriver(browser, config))) .isInstanceOf(SkipException.class) .hasStackTraceContaining("java.net.MalformedURLException"); }
@Test public void testIndexedCorola() throws IOException, SAXException, ParserConfigurationException, GGSException { IndexedLuceneCorpus t; try { t = new IndexedLuceneCorpus(new File("TestData/inputCorpora/corola.index")); } catch (IOException e) { throw new SkipException("indexed corola not present"); } Grammar g = new Grammar(); //g.load(new FileInputStream("TestData/inputGrammars/roNPchunker_grammar.ggf")); //g.load(new FileInputStream("TestData/inputGrammars/npexample.ggf")); g.load(new FileInputStream("TestData/inputGrammars/verysimplegrammar.ggf")); SparseBitSet.compressionPolicy = SparseBitSet.SparseBitSetCompressionPolicy.none; CompiledGrammar compiledGrammar = new CompiledGrammar(g); List<Match> matches = compiledGrammar.GetMatches(t, true); assert (matches.size() == matches.size()); }
public void testOnPingIncorrect(boolean fin, boolean rsv1, boolean rsv2, boolean rsv3, ByteBuffer data) { if (fin && !rsv1 && !rsv2 && !rsv3 && data.remaining() <= 125) { throw new SkipException("Correct frame"); } CompletableFuture<WebSocket> webSocket = new CompletableFuture<>(); MockChannel channel = new MockChannel.Builder() .provideFrame(fin, rsv1, rsv2, rsv3, Opcode.PING, data) .expectClose((code, reason) -> Integer.valueOf(1002).equals(code) && "".equals(reason)) .build(); MockListener listener = new MockListener.Builder() .expectOnOpen((ws) -> true) .expectOnError((ws, error) -> error instanceof ProtocolException) .build(); webSocket.complete(newWebSocket(channel, listener)); checkExpectations(500, TimeUnit.MILLISECONDS, channel, listener); }
@BeforeClass public void setup() throws DrmaaException, IOException { if (System.getProperty("org.ggf.drmaa.SessionFactory") == null) { throw new SkipException( "Could not find system property org.ggf.drmaa.SessionFactory." ); } executorService = Executors.newScheduledThreadPool(4); drmaaSession = SessionFactory.getFactory().getSession(); drmaaSession.init(""); tempDir = Files.createTempDirectory(getClass().getSimpleName()); drmaaExecutor = new DrmaaSimpleModuleExecutor.Builder(drmaaSession, tempDir, DummyCommandProvider.INSTANCE, executorService, executorService) .build(); }
@Test(dependsOnMethods = "canListImages") public void canFilterImages() throws IOException { try (CloudApiConnectionContext context = cloudApi.createConnectionContext()) { final String expectedOs = "linux"; ImageFilter pf = new ImageFilter() .setOs(expectedOs); final Collection<Image> images = imagesApi.list(context, pf); if (images.isEmpty()) { String msg = "Verify that there is at least a single image"; throw new SkipException(msg); } for (Image pkg : images) { logger.debug("Found image: {}", pkg.getName()); assertEquals(pkg.getOs(), expectedOs, "OS didn't match filter. Images:\n" + images); } } }
@Test public void testVisit_reference() throws Exception { String testInput = "Here's a [link] [1] with an ampersand in the URL.\n\n" + "Here's a link with an amersand in the link text: [AT&T] [2].\n\n" + "Here's an inline [link](</script?foo=1&bar=2>).\n\n\n" + "[1]: http://example.com/?foo=1&bar=2\n" + "[2]: http://att.com/ \"AT&T\"\n"; List<String> expected = new ArrayList<>(); expected.add("Here's a [link] [1] with an ampersand in the URL."); expected.add("Here's a link with an amersand in the link text: [AT&T] [2]."); expected.add("Here's an inline [link](</script?foo=1&bar=2>)."); expected.add("[1]: http://example.com/?foo=1&bar=2"); expected.add("[2]: http://att.com/ \"AT&T\""); MockFilter filter = new MockFilter(); filter.process(testInput); throw new SkipException("Skip acceptance test.(known bug)"); // FIXME: // Entry[2] becomes "Here's an inline [link](/script?foo=1&bar=2)." // //assertEquals(filter.getEntries(), expected); //assertEquals(filter.getOutbuf(), testInput); }
@Test(dataProvider = "pathMatcherData") public static void nativeMatcherExactTest(@NotNull String pattern, @NotNull String path, @Nullable Boolean ignored, @Nullable Boolean expectedMatch) throws InvalidPatternException, IOException, InterruptedException { Path temp = Files.createTempDirectory("git-matcher"); try { if (new ProcessBuilder() .directory(temp.toFile()) .command("git", "init", ".") .start() .waitFor() != 0) { throw new SkipException("Can't find git"); } Files.write(temp.resolve(".gitattributes"), (pattern + " test\n").getBytes(StandardCharsets.UTF_8)); byte[] output = ByteStreams.toByteArray( new ProcessBuilder() .directory(temp.toFile()) .command("git", "check-attr", "-a", "--", path) .start() .getInputStream() ); Assert.assertEquals(output.length > 0, expectedMatch == Boolean.TRUE); } finally { Files.walkFileTree(temp, new DeleteTreeVisitor()); } }
@Test public void testSauceDriver() { DriverFactory df = new DriverFactory(); String username = PropertiesRetriever.getString("saucelabs.username", null); String password = PropertiesRetriever.getString("saucelabs.accessKey", null); if (username == null || password == null) { throw new SkipException("Cannot Test Sauce without saucelabs.username and saucelabs.accessKey set"); } DesiredCapabilities dc = DesiredCapabilitiesFactory.ff(); dc.setCapability("desiredEnvironment", "SAUCE"); Driver driver = df.getDriver(dc); driver.navigate().to("https://saucelabs.com/"); driver.quit(); }
@Override public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { try { SkipIf skip = method.getTestMethod() .getConstructorOrMethod() .getMethod().getAnnotation(SkipIf.class); if (skip != null) { String info = skip.platform(); if (AppiumDriverManager.getDriver().getPlatformName().contains(info)) { System.out.println("skipping childTest"); throw new SkipException("Skipped because property was set to :::" + info); } } } catch (Exception e) { e.printStackTrace(); } }
@Test public void testJson() throws Exception { if (!TestUtil.configuredToRun(RUN_CLUSTER_TEST)) { throw new SkipException( String.format("%s property not set", RUN_CLUSTER_TEST)); } for (Properties testProps : testPropList) { Collector collector = new Collector(testProps); final String host = testProps.getProperty(Collector.DB_HOST_PROP); final int port = Integer.parseInt(testProps.getProperty(Collector.DB_PORT_PROP)); String json = collector.makeMetrics( collector.getMongoData(host, port)).toString(); try { JsonParser p = Json.createParser(new StringReader(json)); while (p.hasNext()) { p.next(); } p.close(); } catch (Exception ex) { fail("JSON parse exception", ex); } } }
@Test public void testJson() throws Exception { if (!TestUtil.configuredToRun(RUN_REPL_TEST)) { throw new SkipException( String.format("%s property not set", RUN_REPL_TEST)); } for (Properties testProps : testPropList) { Collector collector = new Collector(testProps); final String host = testProps.getProperty(Collector.DB_HOST_PROP); final int port = Integer.parseInt(testProps.getProperty(Collector.DB_PORT_PROP)); String json = collector.makeMetrics( collector.getMongoData(host, port)).toString(); try { JsonParser p = Json.createParser(new StringReader(json)); while (p.hasNext()) { p.next(); } p.close(); } catch (Exception ex) { fail("JSON parse exception", ex); } } }
@Test public void testEndToEnd() throws Exception { if (!TestUtil.configuredToRun(RUN_REPL_TEST)) { throw new SkipException( String.format("%s property not set", RUN_REPL_TEST)); } for (Properties testProps : testPropList) { setupJadlerForEndToEnd(); Collector.collect(testProps); tearDownJadlerForEndToEnd(); } }
public void assertAll() { if (!m_errors.isEmpty()) { StringBuilder sb = new StringBuilder( "The following asserts failed:\n"); boolean first = true; for (Map.Entry<AssertionError, IAssert> ae : m_errors.entrySet()) { if (first) { first = false; } else { sb.append(", "); } sb.append(ae.getValue().getMessage()); } throw new SkipException("Verification Failures : " + sb.toString()); } }
@Override protected SmithWatermanIntelAligner getAligner() { boolean loaded = true; SmithWatermanIntelAligner aligner = null; try { aligner = new SmithWatermanIntelAligner(); } catch (UserException.HardwareFeatureException e ) { loaded = false; } if(!loaded) { //Skip test if correct version of AVX is not supported throw new SkipException("AVX SmithWaterman is not supported on this system or the library is not available"); } return aligner; }
private void testGetBreakPoints(final VariantContext vc, final ReferenceMultiSource reference, final int paddingSize) throws IOException { final SVContext svc = SVContext.of(vc); if (svc.getStructuralVariantType() != StructuralVariantType.INS && svc.getStructuralVariantType() != StructuralVariantType.DEL) { throw new SkipException("unsupported type; skipped for now"); } final List<SimpleInterval> breakPoints = svc.getBreakPointIntervals(paddingSize, reference.getReferenceSequenceDictionary(null), false); final int contigLength = reference.getReferenceSequenceDictionary(null).getSequence(vc.getContig()).getSequenceLength(); final List<Integer> expectedOffsets = new ArrayList<>(); if (svc.getStructuralVariantType() == StructuralVariantType.INS) { expectedOffsets.add(vc.getStart()); } else if (svc.getStructuralVariantType() == StructuralVariantType.DEL) { expectedOffsets.add(vc.getStart() + 1); expectedOffsets.add(vc.getEnd()); } final List<SimpleInterval> expectedBreakPoints = expectedOffsets.stream() .map(i -> new SimpleInterval(vc.getContig(), Math.max(1, paddingSize > 0 ? (i - paddingSize + 1) : i), Math.min(contigLength, i + paddingSize))) .collect(Collectors.toList()); Assert.assertEquals(breakPoints, expectedBreakPoints); }
@Test public void test001() throws Exception { if (true) throw new SkipException("Not implemented"); final Path output = createTempFile(Paths.get("target"), "jmh-output-", ".log"); assertJMH() .output(output.toString()) .addProfiler(JHiccupProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: jhiccup") .contains("# Processing profiler results: jhiccup"); }
@Test public void test001() throws Exception { if (true) throw new SkipException("Not implemented"); final Path output = createTempFile(Paths.get("target"), "jmh-output-", ".log"); assertJMH() .output(output.toString()) .addProfiler(HonestProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: honest") .contains("# Processing profiler results: honest"); }
@Test public void test001() throws Exception { if (!isCollectAvailable()) throw new SkipException("Profiler not available in this environment, cannot test"); final Path output = createTempFile(Paths.get("target"), "jmh-output-", ".log"); System.setProperty("jmh.solaris-studio.directory", "target"); assertJMH() .output(output.toString()) .addProfiler(SolarisStudioProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: solaris-studio") .contains("# Processing profiler results: solaris-studio") .contains("Solaris Studio experiment at "); assertThat(new File("target/test.1.er")).isDirectory(); }
@Test public void test001() throws Exception { switch (getJVM()) { case HOTSPOT: case JROCKIT: break; default: throw new SkipException("Profiler not available in this environment, cannot test"); } createDirectories(get("target")); final Path output = createTempFile(get("target"), "jmh-output-", ".log"); System.setProperty("jmh.jfr.dumponexitpath", "target"); assertJMH() .output(output.toString()) .addProfiler(FlightRecorderProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: FlightRecorderProfiler") .contains("# Processing profiler results: FlightRecorderProfiler") .contains("Java Flight Recorder recording at "); }
@Test public void test001() throws Exception { if (detectYourkitHome() == null || detectYourkitAgentLib() == null) throw new SkipException("Profiler not available in this environment, cannot test"); createDirectories(get("target")); final Path output = createTempFile(get("target"), "jmh-output-", ".log"); System.setProperty("jmh.yourkit.dir", "target"); System.setProperty("jmh.yourkit.logdir", "target"); assertJMH() .output(output.toString()) .addProfiler(YourkitProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: yourkit") .contains("# Processing profiler results: yourkit") .contains("Yourkit snapshot at "); }
@Test public void test001() throws Exception { if (true) throw new SkipException("Not implemented"); final Path output = createTempFile(Paths.get("target"), "jmh-output-", ".log"); assertJMH() .output(output.toString()) .addProfiler(HeapAuditProfiler.class) .runsWithoutError(); assertThat(contentOf(output.toFile())) .contains("# Preparing profilers: heapaudit") .contains("# Processing profiler results: heapaudit"); }
/** * Test for #156. */ @Test void nativeClient() throws Exception { final String svn = SvnTestHelper.findExecutable("svn"); if (svn == null) throw new SkipException("Native svn executable not found"); try ( EmbeddedDirectoryServer ldap = EmbeddedDirectoryServer.create(); SvnTestServer server = SvnTestServer.createEmpty(ldap.createUserConfig(), false) ) { final String[] command = {svn, "--non-interactive", "ls", "--username=ldapadmin", "--password=ldapadmin", server.getUrl().toString()}; final int exitCode = new ProcessBuilder(command) .redirectError(ProcessBuilder.Redirect.INHERIT) .redirectOutput(ProcessBuilder.Redirect.INHERIT) .start() .waitFor(); Assert.assertEquals(exitCode, 0); } }
/** * Read data from various external sources and return to a Map * @param method * @return */ public Map<String, String> readData(final Method method) { String inputFile=null; DataSource testData=null; Map<String, String> data = new HashMap<String, String>(); if(method.isAnnotationPresent(DataSource.class) && method.getAnnotation(DataSource.class).filePath() !=""){ testData=method.getAnnotation(DataSource.class); } else if(method.getDeclaringClass().isAnnotationPresent(DataSource.class) && method.getDeclaringClass().getAnnotation(DataSource.class).filePath()!=""){ testData=method.getDeclaringClass().getAnnotation(DataSource.class); } else { throw new SkipException("The path to the file is undefined!!!"); } inputFile=new File(testData.filePath()).getAbsolutePath(); if(inputFile.endsWith(".properties")) { data=readDataFromProperties(inputFile); } else if(inputFile.endsWith(".csv")) { data=readcsvData(inputFile); } return data; }
/** * Read Data from a properties file * @param inputFile * @return */ private Map<String, String> readDataFromProperties(String inputFile){ Properties prop=new Properties(); Map<String, String> map = new HashMap<String, String>(); try { prop.load(new FileReader(inputFile)); Enumeration<?> keys = prop.propertyNames(); while(keys.hasMoreElements()){ String key = (String)keys.nextElement(); String value = (String) prop.get(key); if(!value.isEmpty()){ map.put(key,prop.getProperty(key)); } else { log.error("No value specified for key: "+key); } } log.debug("Test properties set from file {}",inputFile); } catch (Exception e) { log.error("Exception during loading test data sources: "+e); throw new SkipException("Data not loaded for test execution!!!"); } return map; }
@Test public void saveScreenshotChromeTest() { if(System.getProperty("webdriver.chrome.driver") == null) { throw new SkipException("The path to the driver executable (webdriver.chrome.driver) is not set"); } WebDriverFactory wdf = new WebDriverFactory("chrome"); WebDriver wd = wdf.createDriver(new DesiredCapabilities()); wd.get("http://google.com"); File screenshotFile = WebDriverUtils.saveScreenshot(wd, getScreenshotName("chrome")); wd.quit(); assertThat(screenshotFile.exists(), equalTo(true)); if(Boolean.parseBoolean(System.getProperty("org.uncommons.reportng.escape-output", "true"))) { Reporter.log("Screenshot: " + screenshotFile.getAbsolutePath()); } else { Reporter.log("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot</a>"); } }
@Test public void saveScreenshotIETest() { if(System.getProperty("webdriver.ie.driver") == null) { throw new SkipException("The path to the driver executable (webdriver.ie.driver) is not set"); } WebDriverFactory wdf = new WebDriverFactory("internet explorer"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); WebDriver wd = wdf.createDriver(capabilities); wd.get("http://google.com"); File screenshotFile = WebDriverUtils.saveScreenshot(wd, getScreenshotName("ie")); wd.quit(); assertThat(screenshotFile.exists(), equalTo(true)); if(Boolean.parseBoolean(System.getProperty("org.uncommons.reportng.escape-output", "true"))) { Reporter.log("Screenshot: " + screenshotFile.getAbsolutePath()); } else { Reporter.log("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot</a>"); } }
@Test public void saveScreenshotSafariTest() { if(System.getProperty("webdriver.safari.driver") == null) { throw new SkipException("The path to the driver executable (webdriver.safari.driver) is not set"); } WebDriverFactory wdf = new WebDriverFactory("safari"); WebDriver wd = wdf.createDriver(new DesiredCapabilities()); wd.get("http://google.com"); File screenshotFile = WebDriverUtils.saveScreenshot(wd, getScreenshotName("safari")); wd.quit(); assertThat(screenshotFile.exists(), equalTo(true)); if(Boolean.parseBoolean(System.getProperty("org.uncommons.reportng.escape-output", "true"))) { Reporter.log("Screenshot: " + screenshotFile.getAbsolutePath()); } else { Reporter.log("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot</a>"); } }
@Test() public void listLiteralQueryParameterEmptyArray() { boolean skipTest = lSql.getDialectClass().equals(PostgresDialect.class); if (skipTest) { throw new SkipException("empty list literal not support"); } setup(); List<Row> rows; AbstractSqlStatement<RowQuery> statement = lSql.createSqlStatement("select * from person where" + " age in (/*ages=*/ 11, 12, 13 /**/) " + "and 1 = /*param=*/ 1 /**/;"); // API Version 2, empty rows = statement.query( "ages", ListLiteralQueryParameter.of(), "param", 1 ).toList(); assertEquals(rows.size(), 0); }
@Test public void testVerificationNoError() throws IOException { final String hostName = "www.google.com"; TlsClientProtocol handler; try { // open connection Socket socket = new Socket(hostName, 443); assertTrue(socket.isConnected()); // connect client DefaultTlsClientImpl c = new DefaultTlsClientImpl(hostName); handler = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream()); handler.connect(c); } catch (Exception ex) { throw new SkipException("Unable to create TLS client."); } }
public void testVerificationError() throws IOException { final String hostName = "www.google.com"; final String actualHostName = "www.verisign.de"; TlsClientProtocol handler = null; DefaultTlsClientImpl c = null; try { // open connection Socket socket = new Socket(actualHostName, 443); assertTrue(socket.isConnected()); // connect client c = new DefaultTlsClientImpl(hostName); handler = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream()); } catch (Exception ex) { throw new SkipException("Unable to create TLS client."); } // do TLS handshake handler.connect(c); }
@Test(enabled = false) public void sendingEnterToMenuItemDoesntWork() throws Throwable { Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { System.err.println(event); } }, AWTEvent.KEY_EVENT_MASK); System.out.println(System.getProperty("java.version")); if (Platform.getCurrent().is(Platform.MAC) && System.getProperty("java.version", "").matches("1.[78].*")) { throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+"); } if (Platform.getCurrent().is(Platform.WINDOWS)) { throw new SkipException("Sending ENTER to menuitem is not working on Windows"); } exitItemCalled = false; driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f")); new WaitWithoutException("Waiting for exit item to be shown") { @Override public boolean until() { return exitItem.isShowing(); } }; driver.sendKeys(exitItem, JavaAgentKeys.ENTER); new WaitWithoutException("Waiting for exit item to be called") { @Override public boolean until() { return exitItemCalled; } }; AssertJUnit.assertEquals(true, exitItemCalled); }
public void sendKeysClearsModifiersWhenReceivesNull() throws Throwable { if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) { throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7"); } JavaAgentKeys osKey = getOSKey(); final String osString = osKey.equals(JavaAgentKeys.CONTROL) ? "ctrl" : "meta"; kss.clear(); driver.sendKeys(textField, osKey); new WaitWithoutException("Waiting for meta press") { @Override public boolean until() { return kss.size() > 0; } }; kss.clear(); driver.sendKeys(textField, JavaAgentKeys.F2); final String expected1 = "[" + osString + " pressed F2, " + osString + " released F2]"; new WaitWithoutException("Waiting for ctrl+f2") { @Override public boolean until() { return expected1.equals(kss.toString()); } }; AssertJUnit.assertEquals(expected1, kss.toString()); kss.clear(); driver.sendKeys(textField, JavaAgentKeys.NULL); new WaitWithoutException("Waiting for meta press") { @Override public boolean until() { return kss.size() > 0; } }; kss.clear(); driver.sendKeys(textField, JavaAgentKeys.F2); final String expected2 = "[pressed F2, released F2]"; new WaitWithoutException("Waiting for ctrl+f2") { @Override public boolean until() { return expected2.equals(kss.toString()); } }; AssertJUnit.assertEquals(expected2, kss.toString()); }