Package com.asakusafw.windgate.core.process

Examples of com.asakusafw.windgate.core.process.ProcessProfile


                ProfileContext.system(FileSessionProvider.class.getClassLoader()),
                Collections.singletonMap(
                        FileSessionProvider.KEY_DIRECTORY,
                        folder.newFolder("session").getAbsolutePath()));
        List<ProcessProfile> processes = Arrays.asList(new ProcessProfile[] {
                new ProcessProfile(
                        "default",
                        BasicProcessProvider.class,
                        ProfileContext.system(BasicProcessProvider.class.getClassLoader()),
                        Collections.<String, String>emptyMap()
                ),
                new ProcessProfile(
                        "void",
                        VoidProcessProvider.class,
                        ProfileContext.system(BasicProcessProvider.class.getClassLoader()),
                        Collections.<String, String>emptyMap()
                ),
View Full Code Here


                    profile.getName(),
                    componentClassName), e);
        }
        Map<String, String> conf = profile.getConfiguration();
        Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT);
        ProcessProfile componentProfile = new ProcessProfile(
                componentName,
                componentClass,
                profile.getContext(),
                componentConf);
        ProcessProvider component;
        try {
            component = componentProfile.createProvider();
        } catch (IOException e) {
            WGLOG.error(e, "E00001",
                    profile.getName(),
                    KEY_COMPONENT,
                    componentClassName);
View Full Code Here

     * Converts simple profile.
     * @throws Exception if failed
     */
    @Test
    public void convert_simple() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_COUNT, "1",
                KEY_COMPONENT, DummyProcess.class.getName());
        RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
        assertThat(result.getRetryCount(), is(1));
        assertThat(result.getRetryInterval(), is(DEFAULT_RETRY_INTERVAL));
        assertThat(result.getComponent(), instanceOf(DummyProcess.class));
        ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
        assertThat(inner.getName(), is(not(profile.getName())));
        assertThat(inner.getConfiguration(), is(map()));
    }
View Full Code Here

     * Converts a profile with options.
     * @throws Exception if failed
     */
    @Test
    public void convert_options() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_COUNT, "10",
                KEY_RETRY_INTERVAL, "1000",
                KEY_COMPONENT, DummyProcess.class.getName(),
                PREFIX_COMPONENT + "hello1", "world1",
                PREFIX_COMPONENT + "hello2", "world2",
                PREFIX_COMPONENT + "hello3", "world3");
        RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
        assertThat(result.getRetryCount(), is(10));
        assertThat(result.getRetryInterval(), is(1000L));
        assertThat(result.getComponent(), instanceOf(DummyProcess.class));
        ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
        assertThat(inner.getName(), is(not(profile.getName())));
        assertThat(inner.getConfiguration(), is(map(
                "hello1", "world1",
                "hello2", "world2",
                "hello3", "world3")));
    }
View Full Code Here

     * Attempts to convert profile without retry count.
     * @throws Exception if failed
     */
    @Test
    public void convert_count_unknown() throws Exception {
        ProcessProfile profile = profile(
                KEY_COMPONENT, DummyProcess.class.getName());
        try {
            RetryableProcessProfile.convert(profile);
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

     * Attempts to convert profile with invalid retry count.
     * @throws Exception if failed
     */
    @Test
    public void convert_count_invalid() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_COUNT, "__UNKNOWN__",
                KEY_COMPONENT, DummyProcess.class.getName());
        try {
            RetryableProcessProfile.convert(profile);
            fail();
View Full Code Here

     * Attempts to convert profile with invalid retry count.
     * @throws Exception if failed
     */
    @Test
    public void convert_count_illegal() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_COUNT, "0",
                KEY_COMPONENT, DummyProcess.class.getName());
        try {
            RetryableProcessProfile.convert(profile);
            fail();
View Full Code Here

     * Attempts to convert profile with invalid retry interval.
     * @throws Exception if failed
     */
    @Test
    public void convert_interval_invalid() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_INTERVAL, "__UNKNOWN__",
                KEY_COMPONENT, DummyProcess.class.getName());
        try {
            RetryableProcessProfile.convert(profile);
            fail();
View Full Code Here

     * Attempts to convert profile with invalid retry interval.
     * @throws Exception if failed
     */
    @Test
    public void convert_interval_illeval() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_INTERVAL, "-1",
                KEY_COMPONENT, DummyProcess.class.getName());
        try {
            RetryableProcessProfile.convert(profile);
            fail();
View Full Code Here

     * Attempts to convert profile without component provider class.
     * @throws Exception if failed
     */
    @Test
    public void convert_component_missing() throws Exception {
        ProcessProfile profile = profile(
                KEY_RETRY_COUNT, "1");
        try {
            RetryableProcessProfile.convert(profile);
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of com.asakusafw.windgate.core.process.ProcessProfile

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.