Java 类org.springframework.beans.factory.config.YamlProcessor.MatchStatus 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    DocumentMatcher activeProfilesMatcher = getActiveProfilesDocumentMatcher();
    String profiles = properties.getProperty(SPRING_PROFILES);
    String negative = extractProfiles(profiles, ProfileType.NEGATIVE);
    String positive = extractProfiles(profiles, ProfileType.POSITIVE);
    if (StringUtils.hasLength(negative)) {
        properties = new Properties(properties);
        properties.setProperty(SPRING_PROFILES, negative);
        if (activeProfilesMatcher.matches(properties) == MatchStatus.FOUND) {
            return MatchStatus.NOT_FOUND;
        }
        if (StringUtils.isEmpty(positive)) {
            return MatchStatus.FOUND;
        }
        properties.setProperty(SPRING_PROFILES, positive);
    }
    return activeProfilesMatcher.matches(properties);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArrayDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey(this.key)) {
        return MatchStatus.ABSTAIN;
    }
    Set<String> values = StringUtils
            .commaDelimitedListToSet(properties.getProperty(this.key));
    if (values.isEmpty()) {
        values = Collections.singleton("");
    }
    for (String pattern : this.patterns) {
        for (String value : values) {
            if (value.matches(pattern)) {
                return MatchStatus.FOUND;
            }
        }
    }
    return MatchStatus.NOT_FOUND;
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    DocumentMatcher activeProfilesMatcher = getActiveProfilesDocumentMatcher();
    String profiles = properties.getProperty(SPRING_PROFILES);
    String negative = extractProfiles(profiles, ProfileType.NEGATIVE);
    String positive = extractProfiles(profiles, ProfileType.POSITIVE);
    if (StringUtils.hasLength(negative)) {
        properties = new Properties(properties);
        properties.setProperty(SPRING_PROFILES, negative);
        if (activeProfilesMatcher.matches(properties) == MatchStatus.FOUND) {
            return MatchStatus.NOT_FOUND;
        }
        if (StringUtils.isEmpty(positive)) {
            return MatchStatus.FOUND;
        }
        properties.setProperty(SPRING_PROFILES, positive);
    }
    return activeProfilesMatcher.matches(properties);
}
项目:spring-boot-concourse    文件:ArrayDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey(this.key)) {
        return MatchStatus.ABSTAIN;
    }
    Set<String> values = StringUtils
            .commaDelimitedListToSet(properties.getProperty(this.key));
    if (values.isEmpty()) {
        values = Collections.singleton("");
    }
    for (String pattern : this.patterns) {
        for (String value : values) {
            if (value.matches(pattern)) {
                return MatchStatus.FOUND;
            }
        }
    }
    return MatchStatus.NOT_FOUND;
}
项目:contestparser    文件:ArrayDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey(this.key)) {
        return MatchStatus.ABSTAIN;
    }
    Set<String> values = StringUtils
            .commaDelimitedListToSet(properties.getProperty(this.key));
    if (values.isEmpty()) {
        values = Collections.singleton("");
    }
    for (String pattern : this.patterns) {
        for (String value : values) {
            if (value.matches(pattern)) {
                return MatchStatus.FOUND;
            }
        }
    }
    return MatchStatus.NOT_FOUND;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:DefaultProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey("spring.profiles")) {
        return MatchStatus.FOUND;
    }
    return MatchStatus.NOT_FOUND;
}
项目:spring-boot-concourse    文件:DefaultProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey("spring.profiles")) {
        return MatchStatus.FOUND;
    }
    return MatchStatus.NOT_FOUND;
}
项目:contestparser    文件:DefaultProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    if (!properties.containsKey("spring.profiles")) {
        return MatchStatus.FOUND;
    }
    return MatchStatus.NOT_FOUND;
}
项目:contestparser    文件:SpringProfileDocumentMatcher.java   
@Override
public MatchStatus matches(Properties properties) {
    String[] profiles = this.activeProfiles;
    if (profiles.length == 0) {
        profiles = DEFAULT_PROFILES;
    }
    return new ArrayDocumentMatcher("spring.profiles", profiles).matches(properties);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void matchesSingleProfile() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: foo");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void abstainNoConfiguredProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("some.property: spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.ABSTAIN);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void noActiveProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher();
    Properties properties = getProperties("spring.profiles: bar,spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void matchesCommaSeparatedArray() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: bar,spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void noMatchingProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void inverseMatchSingle() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: !baz");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void testInverseMatchMulti() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: !baz,!blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedWithMatch() throws Exception {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
    Properties properties = getProperties("spring.profiles: !baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedWithNoMatch() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
    Properties properties = getProperties("spring.profiles: !baz,another");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedTrumpsMatching() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "baz", "blah");
    Properties properties = getProperties("spring.profiles: !baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesSingleValue() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo: bar")))
            .isEqualTo(MatchStatus.FOUND);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArrayDocumentMatcherTests.java   
@Test
public void testDoesNotMatchesIndexedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo[0]: bar\nfoo[1]: spam")))
            .isEqualTo(MatchStatus.ABSTAIN);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesCommaSeparatedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo: bar,spam")))
            .isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void matchesSingleProfile() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: foo");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void abstainNoConfiguredProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("some.property: spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.ABSTAIN);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void noActiveProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher();
    Properties properties = getProperties("spring.profiles: bar,spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void matchesCommaSeparatedArray() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: bar,spam");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void noMatchingProfiles() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void inverseMatchSingle() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: !baz");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void testInverseMatchMulti() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
    Properties properties = getProperties("spring.profiles: !baz,!blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedWithMatch() throws Exception {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
    Properties properties = getProperties("spring.profiles: !baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedWithNoMatch() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
    Properties properties = getProperties("spring.profiles: !baz,another");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:spring-boot-concourse    文件:SpringProfileDocumentMatcherTests.java   
@Test
public void negatedTrumpsMatching() throws IOException {
    DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "baz", "blah");
    Properties properties = getProperties("spring.profiles: !baz,blah");
    assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
项目:spring-boot-concourse    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesSingleValue() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo: bar")))
            .isEqualTo(MatchStatus.FOUND);
}
项目:spring-boot-concourse    文件:ArrayDocumentMatcherTests.java   
@Test
public void testDoesNotMatchesIndexedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo[0]: bar\nfoo[1]: spam")))
            .isEqualTo(MatchStatus.ABSTAIN);
}
项目:spring-boot-concourse    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesCommaSeparatedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertThat(matcher.matches(getProperties("foo: bar,spam")))
            .isEqualTo(MatchStatus.FOUND);
}
项目:contestparser    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesSingleValue() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertEquals(MatchStatus.FOUND, matcher.matches(getProperties("foo: bar")));
}
项目:contestparser    文件:ArrayDocumentMatcherTests.java   
@Test
public void testDoesNotMatchesIndexedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertEquals(MatchStatus.ABSTAIN,
            matcher.matches(getProperties("foo[0]: bar\nfoo[1]: spam")));
}
项目:contestparser    文件:ArrayDocumentMatcherTests.java   
@Test
public void testMatchesCommaSeparatedArray() throws IOException {
    ArrayDocumentMatcher matcher = new ArrayDocumentMatcher("foo", "bar");
    assertEquals(MatchStatus.FOUND, matcher.matches(getProperties("foo: bar,spam")));
}