Package org.springframework.core.env

Examples of org.springframework.core.env.PropertyResolver


        final String id = "test";
        final String realm = "realm";
        final String consumerKey = "consumerKey";
        final String secretKey = "secretKey";

        PropertyResolver resolver = mock(PropertyResolver.class);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.oauth." + id + ".realm"))).thenReturn(realm);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.oauth." + id + ".consumerKey"))).thenReturn(consumerKey);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.oauth." + id + ".secretKey"))).thenReturn(secretKey);

        // holder for the headers...
        HttpHeaders headers = new HttpHeaders();

        // Mock guts of RestTemplate so no need to actually hit the web...
View Full Code Here


    public void testInterceptorWithUsernamePassword() throws Exception {
        final String id = "test";
        final String username = "test";
        final String password = "test";

        PropertyResolver resolver = mock(PropertyResolver.class);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.basic-auth." + id + ".username"))).thenReturn(username);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.basic-auth." + id + ".password"))).thenReturn(password);

        doInterceptorTest(resolver, id, "dGVzdDp0ZXN0");
    }
View Full Code Here

    @Test
    public void testInterceptorWithAuthCode() throws Exception {
        final String id = "test";
        final String authCode = "c29tZUxvbmdVc2VybmFtZTpzb21lTG9uZ1Bhc3N3b3Jk";

        PropertyResolver resolver = mock(PropertyResolver.class);
        when(resolver.getProperty(eq("org.jasig.rest.interceptor.basic-auth." + id + ".authCode"))).thenReturn(authCode);

        doInterceptorTest(resolver, id, authCode);
    }
View Full Code Here

    String havingValue = annotationAttributes.getString("havingValue");
    String[] names = getNames(annotationAttributes);
    boolean relaxedNames = annotationAttributes.getBoolean("relaxedNames");
    boolean matchIfMissing = annotationAttributes.getBoolean("matchIfMissing");

    PropertyResolver resolver = context.getEnvironment();
    if (relaxedNames) {
      resolver = new RelaxedPropertyResolver(resolver, prefix);
    }

    List<String> missingProperties = new ArrayList<String>();
    List<String> nonMatchingProperties = new ArrayList<String>();
    for (String name : names) {
      String key = (relaxedNames ? name : prefix + name);
      if (resolver.containsProperty(key)) {
        if (!isMatch(resolver.getProperty(key), havingValue)) {
          nonMatchingProperties.add(name);
        }
      }
      else {
        if (!matchIfMissing) {
View Full Code Here

TOP

Related Classes of org.springframework.core.env.PropertyResolver

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.