mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 00:51:25 +01:00
Fix HastebinTest (Thread wasn't started...)
This commit is contained in:
parent
5cc5d61816
commit
15587946e6
@ -1,13 +0,0 @@
|
|||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.djrapitops:PlanPluginBridge:3.6.0">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
@ -11,6 +11,6 @@ public class Sql {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String varchar(int length) {
|
public static String varchar(int length) {
|
||||||
return "varchar("+length+")";
|
return "varchar(" + length + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import test.java.utils.RandomData;
|
|||||||
import test.java.utils.TestInit;
|
import test.java.utils.TestInit;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static junit.framework.TestCase.assertEquals;
|
||||||
import static junit.framework.TestCase.assertNotNull;
|
import static junit.framework.TestCase.assertNotNull;
|
||||||
@ -28,7 +28,7 @@ import static junit.framework.TestCase.assertNotNull;
|
|||||||
@PrepareForTest(JavaPlugin.class)
|
@PrepareForTest(JavaPlugin.class)
|
||||||
public class HastebinTest {
|
public class HastebinTest {
|
||||||
|
|
||||||
private AtomicBoolean hastebinAvailable = new AtomicBoolean();
|
private AtomicReference<String> testLink = new AtomicReference<>(null);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void checkAvailability() throws Exception {
|
public void checkAvailability() throws Exception {
|
||||||
@ -40,27 +40,25 @@ public class HastebinTest {
|
|||||||
link = Hastebin.upload(RandomData.randomString(10));
|
link = Hastebin.upload(RandomData.randomString(10));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (e.getMessage().contains("503")) {
|
if (e.getMessage().contains("503")) {
|
||||||
hastebinAvailable.set(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
/* Ignored */
|
/* Ignored */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link == null) {
|
Log.info(link);
|
||||||
hastebinAvailable.set(false);
|
testLink.set(link);
|
||||||
}
|
|
||||||
|
|
||||||
Log.info("Availability Test Link: " + link);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
thread.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
thread.join(5000);
|
thread.join();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
hastebinAvailable.set(false);
|
Log.info("InterruptedException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Hastebin Available: " + hastebinAvailable.get());
|
Log.info("Hastebin Availability Test Link: " + testLink.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -75,7 +73,8 @@ public class HastebinTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpload() throws Exception {
|
public void testUpload() throws Exception {
|
||||||
if (!hastebinAvailable.get()) {
|
if (testLink.get() == null) {
|
||||||
|
Log.info("Hastebin not available, skipping testUpload()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user