Search in sources :

Example 31 with Configuration

use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project FortniteAPI by Xilixir.

the class Example method main.

public static void main(String[] args) {
    Configuration login = new Configuration("login", Credentials.class);
    Credentials credentials = login.read();
    FortniteAPI api = new FortniteAPI(credentials);
    try {
        api.authenticate();
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        EpicLookup lookup = api.getUserInfo("bad.player");
        Friend[] friends = api.getFriendListData(lookup.getId());
        for (Friend friend : friends) {
            if (friend.getStatus() == Status.PENDING && friend.getDirection() == Direction.INBOUND) {
                System.out.println("attempting to delete friend: " + new Gson().toJson(friend));
                api.deleteFriendRequest(lookup.getId(), friend.getAccountId());
            }
        }
        System.out.println(new Gson().toJson(friends));
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Configuration(com.xilixir.fortniteapi.v2.Configuration) Friend(com.xilixir.fortniteapi.v2.Epic.Friends.Friend) Gson(com.google.gson.Gson) IOException(java.io.IOException) FortniteAPI(com.xilixir.fortniteapi.v2.FortniteAPI) Credentials(com.xilixir.fortniteapi.v2.Credentials) EpicLookup(com.xilixir.fortniteapi.v2.Epic.EpicLookup)

Example 32 with Configuration

use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project bitflyer4j by after-the-sunrise.

the class KeyTypeTest method testFetch_Unconfigured.

@Test
public void testFetch_Unconfigured() throws ConfigurationException {
    Configuration c = new MapConfiguration(new HashMap<>());
    for (KeyType type : KeyType.values()) {
        type.fetch(null);
        type.fetch(c);
    }
}
Also used : MapConfiguration(org.apache.commons.configuration2.MapConfiguration) Configuration(org.apache.commons.configuration2.Configuration) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) Test(org.testng.annotations.Test)

Example 33 with Configuration

use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project bitflyer4j by after-the-sunrise.

the class Bitflyer4jFactoryTest method testCreateConfiguration.

@Test
public void testCreateConfiguration() throws Exception {
    Properties properties = new Properties();
    Configuration conf = target.createConfiguration(properties);
    for (Object name : Collections.list(System.getProperties().propertyNames())) {
        // All system properties must exist.
        assertTrue(conf.containsKey(name.toString()), "Missing system : " + name);
    }
    Configuration v = new Configurations().properties(getResource(ConfigurationType.VERSION.getPath()));
    Configuration s = new Configurations().properties(getResource(ConfigurationType.SITE.getPath()));
    // 1st should be version.
    assertEquals(VERSION.fetch(conf), v.getString(VERSION.getKey()));
    assertNotEquals(VERSION.fetch(conf), s.getString(VERSION.getKey()));
    assertEquals(s.getString(VERSION.getKey()), "test");
    // 2nd should be system. (Should not be overridden.)
    String system = "java.version";
    assertEquals(conf.getString(system), System.getProperty(system));
    assertNotEquals(conf.getString(system), s.getString(system));
    assertEquals(s.getString(system), "test");
    // 3rd should be site.
    assertEquals(SITE.fetch(conf), s.getString(SITE.getKey()));
    assertEquals(s.getString(SITE.getKey()), "test");
    // Last should be default.
    assertEquals(HTTP_URL.fetch(conf), HTTP_URL.getDefaultValue());
    // Specific
    properties.setProperty(HTTP_URL.getKey(), "test");
    assertEquals(HTTP_URL.fetch(conf), "test");
}
Also used : Configuration(org.apache.commons.configuration2.Configuration) Properties(java.util.Properties) Configurations(org.apache.commons.configuration2.builder.fluent.Configurations) Test(org.testng.annotations.Test)

Aggregations

Configuration (org.apache.commons.configuration2.Configuration)18 Configuration (org.graylog2.Configuration)10 Test (org.junit.Test)7 Configurations (org.apache.commons.configuration2.builder.fluent.Configurations)5 Before (org.junit.Before)5 Test (org.testng.annotations.Test)5 Configuration (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration)4 ConfigurationSet (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ConfigurationSet)4 ArrayList (java.util.ArrayList)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 DiffResult (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.DiffResult)2 IOException (java.io.IOException)2 Map (java.util.Map)2 BaseConfiguration (org.apache.commons.configuration2.BaseConfiguration)2 HierarchicalConfiguration (org.apache.commons.configuration2.HierarchicalConfiguration)2 JCas (org.apache.uima.jcas.JCas)2 Role (org.graylog2.shared.users.Role)2 UserService (org.graylog2.shared.users.UserService)2 EventBus (com.google.common.eventbus.EventBus)1 Gson (com.google.gson.Gson)1