示例#1
0
 @Test
 public void testSetPreferences() {
   XenonConfiguration g = new XenonConfiguration();
   ImmutableMap<String, String> prefs = ImmutableMap.of("mykey", "myval");
   g.setPreferences(prefs);
   assertThat(g.getPreferences()).isEqualTo(prefs);
 }
示例#2
0
 @Test
 public void testToString() throws URISyntaxException {
   XenonConfiguration config = sampleConfig();
   String expected =
       "XenonConfiguration{SchedulerConfiguration{local, multi, null, null}, SandboxConfiguration{file, /tmp/sandboxes, null, null}, {xenon.adaptors.local.queue.multi.maxConcurrentJobs=1}, PollConfiguration{30000, 3600000, 43200000}}";
   assertThat(config.toString()).isEqualTo(expected);
 }
示例#3
0
  @Test
  public void testGetPreferences_Filled() throws URISyntaxException {
    ImmutableMap<String, String> prefs =
        ImmutableMap.of("xenon.adaptors.local.queue.multi.maxConcurrentJobs", "1");

    XenonConfiguration config = sampleConfig();

    assertThat(config.getPreferences()).isEqualTo(prefs);
  }
示例#4
0
  @Test
  public void deserializesFromJson() throws IOException, URISyntaxException {
    XenonConfiguration actual =
        fromJson(jsonFixture("fixtures/xenon.json"), XenonConfiguration.class);

    ImmutableMap<String, String> emptyProps = ImmutableMap.of();
    SchedulerConfiguration expectedScheduler =
        new SchedulerConfiguration("local", null, "multi", emptyProps);
    assertThat(actual.getScheduler()).isEqualTo(expectedScheduler);

    SandboxConfiguration expectedSandbox =
        new SandboxConfiguration("file", "/", "/tmp/sandboxes", emptyProps);
    assertThat(actual.getSandbox()).isEqualTo(expectedSandbox);

    ImmutableMap<String, String> prefs =
        ImmutableMap.of("xenon.adaptors.local.queue.multi.maxConcurrentJobs", "4");
    assertThat(actual.getPreferences()).isEqualTo(prefs);
    PollConfiguration expected_poll = new PollConfiguration(500, 3600000, 43200000);
    assertThat(actual.getPoll()).isEqualTo(expected_poll);
  }
示例#5
0
 @Test
 public void testGetPreferences_Empty() {
   XenonConfiguration g = new XenonConfiguration();
   ImmutableMap<String, String> expected = ImmutableMap.of();
   assertThat(g.getPreferences()).isEqualTo(expected);
 }
示例#6
0
 @Test
 public void testEquals_SameContent_equal() throws URISyntaxException {
   XenonConfiguration config1 = sampleConfig();
   XenonConfiguration config2 = sampleConfig();
   assertThat(config1.equals(config2)).isTrue();
 }
示例#7
0
 @Test
 public void testEquals_DiffClass_unequal() throws URISyntaxException {
   XenonConfiguration config = sampleConfig();
   URI uri = new URI("local:///");
   assertThat(config.equals(uri)).isFalse();
 }
示例#8
0
 @Test
 public void testEquals_SameObj_equal() throws URISyntaxException {
   XenonConfiguration config = sampleConfig();
   assertThat(config.equals(config)).isTrue();
 }
示例#9
0
 @Test
 public void testHashCode() throws URISyntaxException {
   XenonConfiguration config = sampleConfig();
   int expected = -318369353;
   assertThat(config.hashCode()).isEqualTo(expected);
 }