This is an automated email from the ASF dual-hosted git repository.
jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new bb471cb Removing occationally failing tests
bb471cb is described below
commit bb471cb80c0ddacf26d503ee5256f8ebc1e782dd
Author: Jaroslav Tulach <[email protected]>
AuthorDate: Thu Dec 28 08:07:43 2017 +0100
Removing occationally failing tests
---
.../modules/uihandler/EucJPReadPageTest.java | 181 -----------------
.../uihandler/LogFileIsKeptAtSizeOf1000Test.java | 219 ---------------------
2 files changed, 400 deletions(-)
diff --git
a/uihandler/test/unit/src/org/netbeans/modules/uihandler/EucJPReadPageTest.java
b/uihandler/test/unit/src/org/netbeans/modules/uihandler/EucJPReadPageTest.java
deleted file mode 100644
index 102ed28..0000000
---
a/uihandler/test/unit/src/org/netbeans/modules/uihandler/EucJPReadPageTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.uihandler;
-
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.GraphicsEnvironment;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import javax.swing.JButton;
-import java.util.Locale;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.netbeans.junit.MockServices;
-import org.netbeans.junit.NbTestCase;
-import org.netbeans.junit.RandomlyFails;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
-
-/**
- *
- * @author Jaroslav Tulach
- */
-public class EucJPReadPageTest extends NbTestCase {
-
- public static Test suite() {
- return GraphicsEnvironment.isHeadless() ? new TestSuite() : new
TestSuite(EucJPReadPageTest.class);
- }
-
- public EucJPReadPageTest(String testName) {
- super(testName);
- }
-
- @Override
- protected void setUp() throws Exception {
- System.setProperty("netbeans.user", getWorkDirPath());
- clearWorkDir();
- MemoryURL.initialize();
- DD.d = null;
- MockServices.setServices(DD.class);
- Locale.setDefault(new Locale("te", "ST"));
-
- Installer installer = Installer.findObject(Installer.class, true);
- assertNotNull(installer);
-
- // setup the listing
- installer.restored();
-
- Installer.dontWaitForUserInputInTests();
- }
-
- @Override
- protected void tearDown() throws Exception {
- Installer installer = Installer.findObject(Installer.class, true);
- assertNotNull(installer);
- installer.doClose();
- }
-
- public void testKFranksFile() throws Exception {
- doKFranksFile("index_ja.html");
- }
- @RandomlyFails // NB-Core-Build #6193: DD.d assigned
- public void testKFranksErrorFile() throws Exception {
- doKFranksFile("error_ja.html");
- }
- private void doKFranksFile(String f) throws Exception {
- String jaText = "\u30b3\u30de\u30f3\u30c9";
-
- InputStream is = getClass().getResourceAsStream(f);
- assertNotNull("index_ja found", is);
-
- MemoryURL.registerURL("memory://kun.html", is);
-
- boolean res = Installer.displaySummary("KUN", true, false,true);
- assertFalse("Close options was pressed", res);
- assertNotNull("DD.d assigned", DD.d);
-
- List<Object> data = Arrays.asList(DD.d.getOptions());
- assertEquals("three objects: " + data, 3, DD.d.getOptions().length);
- for (Object o : DD.d.getOptions()) {
- assertEquals("is jbutton", JButton.class, o.getClass());
- JButton b = (JButton)o;
- String t = b.getText();
-
- if (t.indexOf(jaText) == -1) {
- failUTF("Expecting the right text (" + jaText + ": " + t);
- }
- }
-
- }
-
- private static void failUTF(String err) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < err.length(); i++) {
- if (err.charAt(i) < 128) {
- sb.append(err.charAt(i));
- } else {
- sb.append("\\u" + Integer.toString(err.charAt(i), 16));
- }
- }
- fail(sb.toString());
- }
-
- public void testNoEucFile() throws Exception {
- doNoEucInTheFile("index_ja.html");
- }
- public void testNoEucErrorFile() throws Exception {
- doNoEucInTheFile("error_ja.html");
- }
- private void doNoEucInTheFile(String f) throws Exception {
- String jaText = "\u30b3\u30de\u30f3\u30c9";
-
- InputStream is = getClass().getResourceAsStream(f);
- assertNotNull("index_ja found", is);
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- Installer.copyWithEncoding(is, os, Collections.<String,
String>emptyMap());
-
- assertEquals("No euc:\n" + os, -1,
os.toString().toLowerCase().indexOf("euc-jp"));
- if (os.toString().indexOf("UTF-8") == -1 &&
os.toString().indexOf("utf-8") == -1) {
- fail("utf-8 should be there:\n" + os);
- }
- }
-
- public static final class DD extends DialogDisplayer {
- static NotifyDescriptor d;
-
- public Object notify(NotifyDescriptor descriptor) {
- assertNull(d);
- d = descriptor;
- return NotifyDescriptor.CLOSED_OPTION;
- }
-
- public Dialog createDialog(DialogDescriptor descriptor) {
- assertNull(d);
- d = descriptor;
-
- return new DialogImpl(d, new Frame());
- }
-
- private static class DialogImpl extends Dialog {
- NotifyDescriptor d;
-
- private DialogImpl(NotifyDescriptor d, Frame owner) {
- super(owner);
- this.d = d;
- }
-
- @Override
- public synchronized void setVisible(boolean b) {
- assertFalse(isModal());
- if (d != null) {
- d.setValue(NotifyDescriptor.CLOSED_OPTION);
- d = null;
- }
- }
- }
-
- }
-}
diff --git
a/uihandler/test/unit/src/org/netbeans/modules/uihandler/LogFileIsKeptAtSizeOf1000Test.java
b/uihandler/test/unit/src/org/netbeans/modules/uihandler/LogFileIsKeptAtSizeOf1000Test.java
deleted file mode 100644
index 5e5165e..0000000
---
a/uihandler/test/unit/src/org/netbeans/modules/uihandler/LogFileIsKeptAtSizeOf1000Test.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.uihandler;
-
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.logging.Level;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-import javax.swing.SwingUtilities;
-import org.netbeans.junit.MockServices;
-import org.netbeans.junit.NbTestCase;
-import org.netbeans.junit.RandomlyFails;
-import org.netbeans.lib.uihandler.LogRecords;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
-
-/**
- *
- * @author Jaroslav Tulach
- */
-public class LogFileIsKeptAtSizeOf1000Test extends NbTestCase {
- private Installer installer;
-
- static {
- MemoryURL.initialize();
- }
-
- public LogFileIsKeptAtSizeOf1000Test(String testName) {
- super(testName);
- }
-
- @Override
- protected boolean runInEQ() {
- return false;
- }
-
- @Override
- protected Level logLevel() {
- return Level.INFO;
- }
-
-
- @Override
- protected void setUp() throws Exception {
- UIHandler.flushImmediatelly();
- System.setProperty("netbeans.user", getWorkDirPath());
- InstallerTest.assureInstallFileLocatorUserDir(getWorkDirPath());
- clearWorkDir();
-
- installer = Installer.findObject(Installer.class, true);
- assertNotNull(installer);
-
- DD.d = null;
- MockServices.setServices(DD.class);
-
- // setup the listing
- installer.restored();
-
- assertNull("No dialog as there are no records", DD.d);
- }
-
- @Override
- protected void tearDown() throws Exception {
- assertNotNull(installer);
- installer.doClose();
- }
-
- public void testGenerateEnoughLogsAndExit() throws Exception {
- doGenerateALotOfLogs(true);
- }
-
- @RandomlyFails // NB-Core-Build #7949: full buffer expected:<1000> but
was:<0>
- public void testGenerateEnoughLogsInOneRun() throws Exception {
- doGenerateALotOfLogs(false);
- }
-
- private void doGenerateALotOfLogs(boolean exitMeanwhile) throws Exception {
-
- for (int repeat = 0; repeat < 10; repeat++) {
- LogRecord r = new LogRecord(Level.INFO, "MSG_SOMETHING");
- r.setLoggerName(Installer.UI_LOGGER_NAME + ".anything");
-
- for (int i = 0; i < 1500; i++) {
- Logger.getLogger(Installer.UI_LOGGER_NAME +
".anything").log(r);
- }
- assertEquals("full buffer", 1000, InstallerTest.getLogsSize());
-
- File logs = new File(new File(getWorkDir(), "var"), "log");
- assertEquals("Two log files: " + Arrays.asList(logs.list()), 2,
logs.list().length);
-
- class Cnt extends Handler {
- int cnt;
-
- public Cnt(File f) throws IOException {
- FileInputStream is = new FileInputStream(f);
- LogRecords.scan(is, this);
- is.close();
- }
-
- @Override
- public void publish(LogRecord record) {
- cnt++;
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void close() throws SecurityException {
- }
-
- final void assert1000() {
- if (cnt > 1001) {
- fail("Too many logs in this file: " + cnt);
- }
- }
- }
-
- Cnt one = new Cnt(logs.listFiles()[0]);
- one.assert1000();
- Cnt two = new Cnt(logs.listFiles()[1]);
- two.assert1000();
-
- assertNull("No dialogs so far", DD.d);
-
- if (exitMeanwhile) {
- installer.doClose();
- waitForGestures();
-
- assertNull("No dialogs at close", DD.d);
- }
-
- assertNull("No dialog shown at begining", DD.d);
- }
- }
-
- public static final class DD extends DialogDisplayer {
- static NotifyDescriptor d;
-
- public Object notify(NotifyDescriptor descriptor) {
- assertNull(d);
- d = descriptor;
- return NotifyDescriptor.CLOSED_OPTION;
- }
-
- public Dialog createDialog(DialogDescriptor descriptor) {
- assertNull(d);
- d = descriptor;
-
- return new DialogImpl(d, new Frame());
- }
-
- private static class DialogImpl extends Dialog
- implements PropertyChangeListener {
- NotifyDescriptor d;
-
- private DialogImpl(NotifyDescriptor d, Frame owner) {
- super(owner);
- this.d = d;
- }
-
- @java.lang.Override
- public synchronized void setVisible(boolean b) {
- assertFalse(isModal());
- }
-
- public synchronized void propertyChange(PropertyChangeEvent evt) {
- if (d != null && d.getOptions().length == 2) {
- d.setValue(NotifyDescriptor.CLOSED_OPTION);
- d = null;
- notifyAll();
- }
- }
- }
-
- }
-
- private void waitForGestures() throws InterruptedException,
InvocationTargetException {
- class RunnableImpl implements Runnable {
-
- private RunnableImpl() {
- }
-
- public void run() {
- }
- }
- SwingUtilities.invokeAndWait(new RunnableImpl());
- Installer.RP.post(new RunnableImpl()).waitFinished();
- }
-
-}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists