Package fitnesse.testsystems

Examples of fitnesse.testsystems.Descriptor


    SlimClientBuilder.clearSlimPortOffset();
  }

  @Test
  public void portRotates() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("SLIM_PORT")).thenReturn(null);
    for (int i = 0; i < 15; i++) {
      SlimClientBuilder clientBuilder = new SlimClientBuilder(descriptor);
      assertEquals(8085 + (i % 10), clientBuilder.getSlimPort());
    }
  }
View Full Code Here


    }
  }

  @Test
  public void portStartsAtSlimPortVariable() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("SLIM_PORT")).thenReturn("9000");
    for (int i = 0; i < 15; i++) {
      SlimClientBuilder clientBuilder = new SlimClientBuilder(descriptor);
      assertEquals(9000 + (i % 10), clientBuilder.getSlimPort());
    }
  }
View Full Code Here

      assertEquals(9000 + (i % 10), clientBuilder.getSlimPort());
    }
  }
  @Test
  public void portStartsAtSlimPortEnvironmentVariable() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("slim.port")).thenReturn("9000");
    when(descriptor.getVariable("SLIM_PORT")).thenReturn("1313");
    for (int i = 0; i < 15; i++) {
      SlimClientBuilder clientBuilder = new SlimClientBuilder(descriptor);
      assertEquals(9000 + (i % 10), clientBuilder.getSlimPort());
    }
  }
View Full Code Here

    }
  }

  @Test
  public void badSlimPortVariableDefaults() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("SLIM_PORT")).thenReturn("BOB");
    for (int i = 0; i < 15; i++)
      assertEquals(8085 + (i % 10), new SlimClientBuilder(descriptor).getSlimPort());
  }
View Full Code Here

      assertEquals(8085 + (i % 10), new SlimClientBuilder(descriptor).getSlimPort());
  }

  @Test
  public void slimPortPoolSizeCanBeModified() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("slim.pool.size")).thenReturn("20");
    for (int i = 0; i < 25; i++)
      assertEquals(8085 + (i % 20), new SlimClientBuilder(descriptor).getSlimPort());
  }
View Full Code Here

      assertEquals(8085 + (i % 20), new SlimClientBuilder(descriptor).getSlimPort());
  }

  @Test
  public void slimHostDefaultsTolocalhost() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    assertEquals("localhost", new SlimClientBuilder(descriptor).determineSlimHost());
  }
View Full Code Here

    assertEquals("localhost", new SlimClientBuilder(descriptor).determineSlimHost());
  }

  @Test
  public void slimHostVariableSetsTheHost() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("SLIM_HOST")).thenReturn("somehost");
    assertEquals("somehost", new SlimClientBuilder(descriptor).determineSlimHost());
  }
View Full Code Here

    assertEquals("somehost", new SlimClientBuilder(descriptor).determineSlimHost());
  }

  @Test
  public void slimVersionVariableSetsRequiredVersion() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("SLIM_VERSION")).thenReturn("0.0");
    assertEquals(0.0, new SlimClientBuilder(descriptor).getSlimVersion(), 0.000001);
  }
View Full Code Here

    assertEquals(0.0, new SlimClientBuilder(descriptor).getSlimVersion(), 0.000001);
  }

  @Test
  public void slimHostVariableSetsTheHostEnvironmentVariable() throws Exception {
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getVariable("slim.host")).thenReturn("somehost");
    when(descriptor.getVariable("SLIM_HOST")).thenReturn("notThisHost");
    assertEquals("somehost", new SlimClientBuilder(descriptor).determineSlimHost());
  }
View Full Code Here

  }

  @Test(expected = IOException.class)
  public void createSlimServiceFailsFastWhenSlimPortIsNotAvailable() throws Exception {
    final int slimServerPort = 10258;
    Descriptor descriptor = mock(Descriptor.class);
    ServerSocket slimSocket = SocketFactory.tryCreateServerSocket(slimServerPort);
    try {
      InProcessSlimClientBuilder sys = new InProcessSlimClientBuilder(descriptor);
      String[] slimArguments = new String[] { Integer.toString(slimServerPort) };
      sys.createSlimService(slimArguments);
View Full Code Here

TOP

Related Classes of fitnesse.testsystems.Descriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.