@@ -0,0 +1,3376 @@
+/*%0A * JBoss, Home of Professional Open Source.%0A * Copyright 2015 Red Hat, Inc., and individual contributors%0A * as indicated by the @author tags.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.jboss.as.domain.management.security;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.util.regex.Matcher;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * A test case to verify expected username / password entries can be split using the expression in %7B@link PropertiesFileLoader%7D.%0A *%0A * @author %3Ca href=%22mailto:darran.lofthouse@jboss.com%22%3EDarran Lofthouse%3C/a%3E%0A */%0Apublic class PropertiesPatternMatchingTestCase %7B%0A%0A    private void individualTest(final String entry, final boolean isValid, final String username, final String password) %7B%0A        Matcher matcher = PropertiesFileLoader.PROPERTY_PATTERN.matcher(entry);%0A        assertEquals(%22Pattern Matched%22, isValid, matcher.matches());%0A        if (isValid == false) return;%0A        String extractedUsername = matcher.group(1);%0A        String extractedPassword = matcher.group(2);%0A%0A        assertEquals(%22Extraced Username%22, username, extractedUsername);%0A        assertEquals(%22Extracted Password%22, password, extractedPassword);%0A    %7D%0A%0A    private void testEntry(final String entry, final boolean isValid, final String username, final String password) %7B%0A        individualTest(entry, isValid, username, password);%0A        individualTest(%22#%22 + entry, isValid, username, password);%0A    %7D%0A%0A    @Test%0A    public void testAllEntries() %7B%0A        String%5B%5D usernameParts = new String%5B%5D %7B %22abc%22, %22DEF%22, %22%5C%5C%5C%5C%22, %22,%22, %22%5C%5C=%22, %22@%22, %22-%22, %22012%22, %22.%22, %22/%22 %7D;%0A        String%5B%5D passwordParts = new String%5B%5D %7B %22ghi%22, %22JKL%22, %22%5C%5C%5C%5C%22, %22%5C%5C=%22, %22345%22 %7D;%0A%0A        for (int usernameStart = 0; usernameStart %3C usernameParts.length; usernameStart++) %7B%0A            for (int usernameMid = 0; usernameMid %3C usernameParts.length; usernameMid++) %7B%0A                for (int usernameEnd = 0; usernameEnd %3C usernameParts.length; usernameEnd++) %7B%0A                    for (int passwordStart = 0; passwordStart %3C passwordParts.length; passwordStart++) %7B%0A                        for (int passwordMid = 0; passwordMid %3C passwordParts.length; passwordMid++) %7B%0A                            for (int passwordEnd = 0; passwordEnd %3C passwordParts.length; passwordEnd++) %7B%0A                                String username = usernameParts%5BusernameStart%5D + usernameParts%5BusernameMid%5D + usernameParts%5BusernameEnd%5D;%0A                                String password = passwordParts%5BpasswordStart%5D + passwordParts%5BpasswordMid%5D + passwordParts%5BpasswordEnd%5D;%0A%0A                                testEntry(username + %22=%22 + password, true, username, password);%0A                                testEntry(username + password, false, username, password);%0A                            %7D%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Add a test case to test the different permutations regarding the construction of usernames and passwords in the properties files and verification that the regular expression to split these can handle them approriately.