コード例 #1
0
    @Test
    public void shouldAddDefaultValuesWhenNoValuesAreSet() {
      lbService.addDefaultValues(lb);

      Assert.assertEquals(LoadBalancerAlgorithm.RANDOM, lb.getAlgorithm());
      Assert.assertEquals(LoadBalancerProtocol.HTTP, lb.getProtocol());
      Assert.assertFalse(lb.isConnectionLogging());
      Assert.assertEquals(defaultProtocol.getPort(), lb.getPort());
      Assert.assertEquals(SessionPersistence.NONE, lb.getSessionPersistence());
      Assert.assertEquals(LoadBalancerStatus.BUILD, lb.getStatus());
      Assert.assertEquals(false, lb.isHalfClosed());
    }
コード例 #2
0
    @Test
    public void shouldNotAddDefaultValuesWhenValuesAreSet() {
      lb.setAlgorithm(LoadBalancerAlgorithm.LEAST_CONNECTIONS);
      lb.setProtocol(LoadBalancerProtocol.IMAPv3);
      lb.setConnectionLogging(true);
      lb.setPort(1234);
      lb.setSessionPersistence(SessionPersistence.HTTP_COOKIE);

      lbService.addDefaultValues(lb);

      Assert.assertEquals(LoadBalancerAlgorithm.LEAST_CONNECTIONS, lb.getAlgorithm());
      Assert.assertEquals(LoadBalancerProtocol.IMAPv3, lb.getProtocol());
      Assert.assertTrue(lb.isConnectionLogging());
      Assert.assertEquals(1234, lb.getPort().intValue());
      Assert.assertEquals(SessionPersistence.HTTP_COOKIE, lb.getSessionPersistence());
    }