// Path: src/main/java/ninja/eivind/hotsreplayuploader/services/platform/PlatformService.java
// public interface PlatformService {
// 
//     String USER_HOME = System.getProperty("user.home");
//     String APPLICATION_DIRECTORY_NAME = Constants.APPLICATION_NAME.replaceAll(" ", "");
// 
//     File getApplicationHome();
// 
//     File getHotSHome();
// 
//     /**
//      * Defines how the application reacts on window notifications like closing or hiding.
//      * @param primaryStage the main stage
//      */
//     default void setupWindowBehaviour(Stage primaryStage) {
//         Platform.setImplicitExit(false);
//         primaryStage.setOnHiding(value -> {
//             primaryStage.setIconified(true);
//             value.consume();
//         });
//     }
// 
//     default TrayIcon getTrayIcon(Stage primaryStage) throws PlatformNotSupportedException {
//         throw new PlatformNotSupportedException("Not implemented in " + getClass());
//     }
// 
//     default TrayIcon buildTrayIcon(URL imageURL, Stage primaryStage) {
//         final Image image = Toolkit.getDefaultToolkit().getImage(imageURL);
//         final PopupMenu popup = new PopupMenu();
//         final MenuItem showItem = new MenuItem("Show");
//         final MenuItem exitItem = new MenuItem("Exit");
// 
//         // Declare shared action for showItem and trayicon click
//         final Runnable openAction = () -> Platform.runLater(() -> {
//             primaryStage.setIconified(false);
//             primaryStage.show();
//             primaryStage.toFront();
//         });
//         popup.add(showItem);
//         popup.add(exitItem);
// 
//         final TrayIcon trayIcon = new TrayIcon(image, "Initializing tooltip", popup);
//         trayIcon.setImageAutoSize(true);
// 
//         // Add listeners
//         trayIcon.addMouseListener(new TrayMouseListenerBase() {
//             @Override
//             public void mouseClicked(final MouseEvent e) {
//                 if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() % 2 == 0) {
//                     openAction.run();
//                 }
//             }
//         });
//         showItem.addActionListener(e -> openAction.run());
//         exitItem.addActionListener(event -> shutdown());
//         return trayIcon;
// 
//     }
// 
//     /**
//      * Shuts down the application by delegating service cleanups
//      * to the Application Thread.
//      */
//     default void shutdown() {
//         // let JavaFX shut close its services gracefully
//         Platform.exit();
//     }
// 
//     void browse(String uri);
// 
//     URL getLogoUrl();
// 
//     boolean isPreloaderSupported();
// 
//     BattleLobbyTempDirectories getBattleLobbyTempDirectories();
// }
// 
// Path: src/test/java/rules/JavaFXThreadingRule.java
// public class JavaFXThreadingRule implements TestRule {
// 
//     /**
//      * Flag for setting up the JavaFX, we only need to do this once for all tests.
//      */
//     private static boolean jfxIsSetup;
// 
//     public JavaFXThreadingRule() {
//         System.setProperty("java.awt.headless", "false");
//     }
// 
//     @Override
//     public Statement apply(Statement statement, Description description) {
// 
//         return new OnJFXThreadStatement(statement);
//     }
// 
//     private static class OnJFXThreadStatement extends Statement {
// 
//         private final Statement statement;
// 
//         public OnJFXThreadStatement(Statement aStatement) {
//             statement = aStatement;
//         }
// 
//         @Override
//         public void evaluate() throws Throwable {
// 
//             if (!jfxIsSetup) {
//                 setupJavaFX();
// 
//                 jfxIsSetup = true;
//             }
// 
//             statement.evaluate();
//         }
// 
//         protected void setupJavaFX() throws InterruptedException {
// 
//             long timeMillis = System.currentTimeMillis();
// 
//             final CountDownLatch latch = new CountDownLatch(1);
// 
//             SwingUtilities.invokeLater(() -> {
//                 // initializes JavaFX environment
//                 new JFXPanel();
// 
//                 latch.countDown();
//             });
// 
//             System.out.println("Initializing JavaFX...");
//             latch.await();
//             System.out.println("JavaFX was initialized in " + ((double) (System.currentTimeMillis() - timeMillis) / 1000.0) + "s");
//         }
// 
//     }
// }


import javafx.application.Platform;
import ninja.eivind.hotsreplayuploader.HotsReplayUploaderTest;
import ninja.eivind.hotsreplayuploader.services.platform.PlatformService;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import rules.JavaFXThreadingRule;
import java.io.File;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.function.Consumer;
import static org.junit.Assert.*;
// Copyright 2016 Eivind Vegsundvåg
//
// Licensed 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 ninja.eivind.hotsreplayuploader.files.tempwatcher;




@RunWith(SpringJUnit4ClassRunner.class)
@HotsReplayUploaderTest
public class RecursiveTempWatcherTest {

    private static final Logger logger = LoggerFactory.getLogger(RecursiveTempWatcherTest.class);
    @Rule
// Path: src/main/java/ninja/eivind/hotsreplayuploader/services/platform/PlatformService.java
// public interface PlatformService {
// 
//     String USER_HOME = System.getProperty("user.home");
//     String APPLICATION_DIRECTORY_NAME = Constants.APPLICATION_NAME.replaceAll(" ", "");
// 
//     File getApplicationHome();
// 
//     File getHotSHome();
// 
//     /**
//      * Defines how the application reacts on window notifications like closing or hiding.
//      * @param primaryStage the main stage
//      */
//     default void setupWindowBehaviour(Stage primaryStage) {
//         Platform.setImplicitExit(false);
//         primaryStage.setOnHiding(value -> {
//             primaryStage.setIconified(true);
//             value.consume();
//         });
//     }
// 
//     default TrayIcon getTrayIcon(Stage primaryStage) throws PlatformNotSupportedException {
//         throw new PlatformNotSupportedException("Not implemented in " + getClass());
//     }
// 
//     default TrayIcon buildTrayIcon(URL imageURL, Stage primaryStage) {
//         final Image image = Toolkit.getDefaultToolkit().getImage(imageURL);
//         final PopupMenu popup = new PopupMenu();
//         final MenuItem showItem = new MenuItem("Show");
//         final MenuItem exitItem = new MenuItem("Exit");
// 
//         // Declare shared action for showItem and trayicon click
//         final Runnable openAction = () -> Platform.runLater(() -> {
//             primaryStage.setIconified(false);
//             primaryStage.show();
//             primaryStage.toFront();
//         });
//         popup.add(showItem);
//         popup.add(exitItem);
// 
//         final TrayIcon trayIcon = new TrayIcon(image, "Initializing tooltip", popup);
//         trayIcon.setImageAutoSize(true);
// 
//         // Add listeners
//         trayIcon.addMouseListener(new TrayMouseListenerBase() {
//             @Override
//             public void mouseClicked(final MouseEvent e) {
//                 if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() % 2 == 0) {
//                     openAction.run();
//                 }
//             }
//         });
//         showItem.addActionListener(e -> openAction.run());
//         exitItem.addActionListener(event -> shutdown());
//         return trayIcon;
// 
//     }
// 
//     /**
//      * Shuts down the application by delegating service cleanups
//      * to the Application Thread.
//      */
//     default void shutdown() {
//         // let JavaFX shut close its services gracefully
//         Platform.exit();
//     }
// 
//     void browse(String uri);
// 
//     URL getLogoUrl();
// 
//     boolean isPreloaderSupported();
// 
//     BattleLobbyTempDirectories getBattleLobbyTempDirectories();
// }
// 
// Path: src/test/java/rules/JavaFXThreadingRule.java
// public class JavaFXThreadingRule implements TestRule {
// 
//     /**
//      * Flag for setting up the JavaFX, we only need to do this once for all tests.
//      */
//     private static boolean jfxIsSetup;
// 
//     public JavaFXThreadingRule() {
//         System.setProperty("java.awt.headless", "false");
//     }
// 
//     @Override
//     public Statement apply(Statement statement, Description description) {
// 
//         return new OnJFXThreadStatement(statement);
//     }
// 
//     private static class OnJFXThreadStatement extends Statement {
// 
//         private final Statement statement;
// 
//         public OnJFXThreadStatement(Statement aStatement) {
//             statement = aStatement;
//         }
// 
//         @Override
//         public void evaluate() throws Throwable {
// 
//             if (!jfxIsSetup) {
//                 setupJavaFX();
// 
//                 jfxIsSetup = true;
//             }
// 
//             statement.evaluate();
//         }
// 
//         protected void setupJavaFX() throws InterruptedException {
// 
//             long timeMillis = System.currentTimeMillis();
// 
//             final CountDownLatch latch = new CountDownLatch(1);
// 
//             SwingUtilities.invokeLater(() -> {
//                 // initializes JavaFX environment
//                 new JFXPanel();
// 
//                 latch.countDown();
//             });
// 
//             System.out.println("Initializing JavaFX...");
//             latch.await();
//             System.out.println("JavaFX was initialized in " + ((double) (System.currentTimeMillis() - timeMillis) / 1000.0) + "s");
//         }
// 
//     }
// }


// Path: src/test/java/ninja/eivind/hotsreplayuploader/files/tempwatcher/RecursiveTempWatcherTest.java
import javafx.application.Platform;
import ninja.eivind.hotsreplayuploader.HotsReplayUploaderTest;
import ninja.eivind.hotsreplayuploader.services.platform.PlatformService;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import rules.JavaFXThreadingRule;
import java.io.File;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.function.Consumer;
import static org.junit.Assert.*;

// Copyright 2016 Eivind Vegsundvåg
//
// Licensed 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 ninja.eivind.hotsreplayuploader.files.tempwatcher;




@RunWith(SpringJUnit4ClassRunner.class)
@HotsReplayUploaderTest
public class RecursiveTempWatcherTest {

    private static final Logger logger = LoggerFactory.getLogger(RecursiveTempWatcherTest.class);
    @Rule
    public JavaFXThreadingRule rule = new JavaFXThreadingRule();