Package com.asakusafw.windgate.core

Examples of com.asakusafw.windgate.core.ParameterList


     * @param arguments the arguments represented in a string, or {@code null} as empty arguments
     * @return the parsed key-value pairs
     */
    public static ParameterList parseArguments(String arguments) {
        if (arguments == null || arguments.isEmpty()) {
            return new ParameterList();
        }
        Map<String, String> results = new LinkedHashMap<String, String>();
        String[] pairs = PAIRS.split(arguments);
        for (String pair : pairs) {
            if (pair.isEmpty()) {
                continue;
            }
            String[] kv = KEY_VALUE.split(pair);
            if (kv.length == 0) {
                // in the case of "=", the regex engine returns an empty array
                addArgument(results, "", "");
            } else if (kv.length == 1 && kv[0].equals(pair) == false) {
                // in the case of "key=", the regex engine return returns only a key
                addArgument(results, unescape(kv[0]), "");
            } else if (kv.length == 2) {
                addArgument(results, unescape(kv[0]), unescape(kv[1]));
            } else {
                WGLOG.warn("W99002",
                        pair);
            }
        }
        return new ParameterList(results);
    }
View Full Code Here


        Map<String, String> conf = new HashMap<String, String>();
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile);
        assertThat(profile.getResourceName(), is("testing"));
        assertThat(profile.getBasePath().toUri().getScheme(), is("file"));
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(HadoopFsProfile.KEY_BASE_PATH, current.toURI().toString());
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile);
        assertThat(profile.getResourceName(), is("testing"));
        assertThat(profile.getBasePath(), is(new Path(current.toURI())));
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(HadoopFsProfile.KEY_BASE_PATH, "target");
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile);
        assertThat(profile.getResourceName(), is("testing"));
        assertThat(profile.getBasePath().getName(), is("target"));
View Full Code Here

        Map<String, String> env = new HashMap<String, String>();
        env.put("var", "replacement");
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList(env)),
                conf);

        HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile);
        assertThat(profile.getResourceName(), is("testing"));
        assertThat(profile.getBasePath().getName(), is("replacement"));
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(HadoopFsProfile.KEY_BASE_PATH, "${__UNDEFINED__}");
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile.convert(hadoopConf, resourceProfile);
    }
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(HadoopFsProfile.KEY_BASE_PATH, "INVALIDFS:UNKNOWN");
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile.convert(hadoopConf, resourceProfile);
    }
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(HadoopFsProfile.KEY_COMPRESSION, DefaultCodec.class.getName());
        ResourceProfile resourceProfile = new ResourceProfile(
                "testing",
                HadoopFsProvider.class,
                new ProfileContext(getClass().getClassLoader(), new ParameterList()),
                conf);

        HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile);
        assertThat(profile.getResourceName(), is("testing"));
        // may occur warn log
View Full Code Here

     * preparation.
     * @throws Exception if failed
     */
    @Test
    public void prepare() throws Exception {
        FileResourceMirror resource = new FileResourceMirror(profile(), new ParameterList());
        try {
            ProcessScript<StringBuilder> a = process("a", driver("source"), dummy());
            ProcessScript<StringBuilder> b = process("b", dummy(), driver("drain"));
            GateScript gate = script(a, b);
            resource.prepare(gate);
View Full Code Here

     * preparation.
     * @throws Exception if failed
     */
    @Test(expected = IOException.class)
    public void prepare_invalid_variable() throws Exception {
        FileResourceMirror resource = new FileResourceMirror(profile(), new ParameterList());
        try {
            ProcessScript<StringBuilder> a = process("a", driver("${invalid_var}"), dummy());
            ProcessScript<StringBuilder> b = process("b", dummy(), driver("drain"));
            GateScript gate = script(a, b);
            resource.prepare(gate);
View Full Code Here

TOP

Related Classes of com.asakusafw.windgate.core.ParameterList

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.