private void extraValidation()

in wilma-application/modules/wilma-stub-configuration-parser/src/main/java/com/epam/wilma/stubconfig/json/JsonBasedStubDescriptorFactory.java [111:147]


    private void extraValidation(final JSONObject jsonStubDescriptor) {
        JSONObject root = jsonStubDescriptor.getJSONObject("wilmaStubConfiguration");
        String key;
        // - name in sequenceDescriptor array must be unique
        checkUniqueName("sequenceDescriptor", root, "Sequence Descriptors");
        // - name in conditionSets array must be unique
        checkUniqueName("conditionSets", root, "Condition Sets");
        // - name in template array must be unique
        checkUniqueName("templates", root, "Templates");
        // - name in dialog descriptors must be unique
        checkUniqueName("dialogDescriptors", root, "Dialog Descriptors");
        // - name in responseFormatterSets must be unique
        checkUniqueName("responseFormatterSets", root, "Response Formatter Sets");
        // - wilma stub groupName shall not contain chars: "|" ";"
        key = "groupName";
        if (root.has(key)) {
            String name = root.getString(key);
            if (name.contains("|") || name.contains(";")) {
                throw new StubConfigJsonSchemaException("Stub Descriptor groupName='"
                        + name + "' contains invalid character ('|' or ';')");
            }
        }
        // - sequenceDescriptor name shall not contain chars: "|" ";"
        key = "sequenceDescriptor";
        if (root.has(key)) {
            JSONArray sequenceDescriptor = root.getJSONArray(key);
            for (int i = 0; i < sequenceDescriptor.length(); i++) {
                String name = sequenceDescriptor.getJSONObject(i).getString("name");
                if (name.contains("|") || name.contains(";")) {
                    throw new StubConfigJsonSchemaException("Sequence Descriptor name='"
                            + name + "' contains invalid character ('|' or ';')");
                }
            }
        }
        // - all class name must be valid/loadable
        // -> this must be validated during the parse action of the specific object
    }