Allow RS loading classes to be used with Guice

- Provide OkHttpClient through Guice instead of using it from static
variable
- Chain the RS classes with Guice and inject ClientLoader to RuneLite
class
- Cleanup RS loading classes a bit

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-06-07 10:44:10 +02:00
parent dcbccbb01b
commit 0f0ac2ab64
7 changed files with 166 additions and 125 deletions

View File

@@ -26,7 +26,7 @@
package net.runelite.client.rs;
import java.io.IOException;
import net.runelite.client.rs.ClientConfigLoader;
import okhttp3.OkHttpClient;
import org.junit.Test;
/**
@@ -38,16 +38,20 @@ public class ClientConfigLoaderTest
@Test
public void test() throws IOException
{
ClientConfigLoader loader = new ClientConfigLoader();
loader.fetch();
final ClientConfigLoader loader = new ClientConfigLoader(new OkHttpClient());
final RSConfig config = loader.fetch();
for (String key : loader.getProperties().keySet())
System.out.println(key + ": " + loader.getProperty(key));
for (String key : config.getClassLoaderProperties().keySet())
{
System.out.println(key + ": " + config.getClassLoaderProperties().get(key));
}
System.out.println("Applet properties:");
for (String key : loader.getAppletProperties().keySet())
System.out.println(key + ": " + loader.getAppletProperty(key));
for (String key : config.getAppletProperties().keySet())
{
System.out.println(key + ": " + config.getAppletProperties().get(key));
}
}
}