Exemplo n.º 1
0
 public static String getServiceUrl(HttpServletRequest req, ServiceProperties serviceProperties) {
   String serviceUrl = serviceProperties.getService();
   if (serviceUrl != null && !serviceUrl.startsWith("http")) {
     serviceUrl = getJenkinsUrl(req) + serviceUrl;
   }
   return serviceUrl;
 }
  @Test
  public void testGettersSetters() throws Exception {
    ServiceProperties[] sps = {new ServiceProperties(), new SamlServiceProperties()};
    for (ServiceProperties sp : sps) {
      sp.setSendRenew(false);
      assertThat(sp.isSendRenew()).isFalse();
      sp.setSendRenew(true);
      assertThat(sp.isSendRenew()).isTrue();
      sp.setArtifactParameter("notticket");
      assertThat(sp.getArtifactParameter()).isEqualTo("notticket");
      sp.setServiceParameter("notservice");
      assertThat(sp.getServiceParameter()).isEqualTo("notservice");

      sp.setService("https://mycompany.com/service");
      assertThat(sp.getService()).isEqualTo("https://mycompany.com/service");

      sp.afterPropertiesSet();
    }
  }