001package org.w3.ldp.testsuite;
002
003import org.apache.commons.cli.OptionBuilder;
004import org.apache.commons.cli.OptionGroup;
005import org.apache.commons.cli.Options;
006import org.apache.log4j.Level;
007import org.apache.log4j.Logger;
008
009public class RunLdpTestSuite {
010
011        private static Options options = new Options();
012        
013        public static void main(String[] args) {
014                Logger.getRootLogger().setLevel(Level.OFF);
015
016                options.addOptionGroup(LdpTestSuite.addCommonOptions());
017                options.addOptionGroup(LdpTestSuite.addEarlOptions());
018                addContainerOptions();
019
020                addNonRdfOption();
021
022                addContResOption();
023                addReadOnlyOption();
024                addRelativeUriOption();
025
026                LdpTestSuite.executeTestSuite(args, options, "ldp-testsuite");
027        }
028        
029        @SuppressWarnings("static-access")
030        private static void addContainerOptions() {
031                OptionGroup containerType = new OptionGroup();
032                containerType.addOption(OptionBuilder.withLongOpt("basic")
033                                .withDescription("the server url is a basic container")
034                                .create());
035                containerType.addOption(OptionBuilder.withLongOpt("direct")
036                                .withDescription("the server url is a direct container")
037                                .create());
038                containerType.addOption(OptionBuilder.withLongOpt("indirect")
039                                .withDescription("the server url is an indirect container")
040                                .create());
041                containerType.setRequired(true);
042                options.addOptionGroup(containerType);
043        }
044        
045        @SuppressWarnings("static-access")
046        private static void addReadOnlyOption() {
047                options.addOption(OptionBuilder.withLongOpt("read-only-prop")
048                                .withDescription("a read-only property to test error conditions")
049                                .hasArg().withArgName("uri")
050                                .create());
051        }
052
053        @SuppressWarnings("static-access")
054        private static void addRelativeUriOption() {
055                options.addOption(OptionBuilder.withLongOpt("relative-uri")
056                                .withDescription("a relative uri to test relative uri resolution")
057                                .hasArg().withArgName("uri")
058                                .create());
059        }
060
061        @SuppressWarnings("static-access")
062        private static void addContResOption() {
063                options.addOption(OptionBuilder.withLongOpt("cont-res")
064                                .withDescription("url of a container with interaction model of a resource").hasArg()
065                                .withArgName("cont-res").create());
066        }
067
068        @SuppressWarnings("static-access")
069        private static void addNonRdfOption() {
070                options.addOption(OptionBuilder.withLongOpt("non-rdf")
071                                .withDescription("include LDP-NR testing").create());
072        }
073
074}