Package com.opensymphony.xwork2.inject

Examples of com.opensymphony.xwork2.inject.Container


     * cause action submited by the form is intercepted by validation interceptor which
     * "include" all methods.
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled1() throws Exception {

        final Container cont = container;
        // used to determined if the form action needs js validation
        configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
            private DefaultConfiguration self = this;
            public Container getContainer() {
                return new Container() {
                    public <T> T inject(Class<T> implementation) {return null;}
                    public void removeScopeStrategy() {}
                    public void setScopeStrategy(Strategy scopeStrategy) {}
                    public <T> T getInstance(Class<T> type, String name) {return null;}
                    public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                    public Set<String> getInstanceNames(Class<?> type) {return null;}

                    public void inject(Object o) {
                        cont.inject(o);
                        if (o instanceof Form) {
                            ((Form)o).setConfiguration(self);
                        }
                    }
                };
View Full Code Here


    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled2() throws Exception {

        com.opensymphony.xwork2.config.Configuration originalConfiguration = configurationManager.getConfiguration();
        ObjectFactory originalObjectFactory = ObjectFactory.getObjectFactory();

        final Container cont = container;
        try {
            // used to determined if the form action needs js validation
            configurationManager.setConfiguration(new DefaultConfiguration() {
                private DefaultConfiguration self = this;
                public Container getContainer() {
                    return new Container() {
                        public <T> T inject(Class<T> implementation) {return null;}
                        public void removeScopeStrategy() {}
                        public void setScopeStrategy(Strategy scopeStrategy) {}
                        public <T> T getInstance(Class<T> type, String name) {return null;}
                        public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                        public Set<String> getInstanceNames(Class<?> type) {return null;}

                        public void inject(Object o) {
                            cont.inject(o);
                            if (o instanceof Form) {
                                ((Form)o).setConfiguration(self);
                            }
                        }
                    };
View Full Code Here

    /**
     * Tests the numbers are formatted correctly to not break the javascript
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled3() throws Exception {

        final Container cont = container;
        // used to determined if the form action needs js validation
        configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
            private DefaultConfiguration self = this;
            public Container getContainer() {
                return new Container() {
                    public <T> T inject(Class<T> implementation) {return null;}
                    public void removeScopeStrategy() {}
                    public void setScopeStrategy(Strategy scopeStrategy) {}
                    public <T> T getInstance(Class<T> type, String name) {return null;}
                    public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                    public Set<String> getInstanceNames(Class<?> type) {return null;}

                    public void inject(Object o) {
                        cont.inject(o);
                        if (o instanceof Form) {
                            ((Form)o).setConfiguration(self);
                        }
                    }
                };
View Full Code Here

/**
     * Tests the numbers are formatted correctly to not break the javascript, using doubles
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled4() throws Exception {

        final Container cont = container;
        // used to determined if the form action needs js validation
        configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
            private DefaultConfiguration self = this;
            public Container getContainer() {
                return new Container() {
                    public <T> T inject(Class<T> implementation) {return null;}
                    public void removeScopeStrategy() {}
                    public void setScopeStrategy(Strategy scopeStrategy) {}
                    public <T> T getInstance(Class<T> type, String name) {return null;}
                    public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                    public Set<String> getInstanceNames(Class<?> type) {return null;}

                    public void inject(Object o) {
                        cont.inject(o);
                        if (o instanceof Form) {
                            ((Form)o).setConfiguration(self);
                        }
                    }
                };
View Full Code Here

    // ObjectFactory.setObjectFactory(..) was removed in struts 2.1, so we have to workaround with this
    //  to make the validation tests work
    public ActionValidatorManager createDefaultActionValidatorManager()
        throws ClassNotFoundException
    {
        Container container = createBootstrapContainer();

        ActionContext context = new ActionContext( new HashMap<String, Object>() );
        context.setValueStack( createValueStack( container ) );
        ActionContext.setContext( context );

        OgnlReflectionProvider reflectionProvider = new OgnlReflectionProvider();

        reflectionProvider.setOgnlUtil( container.getInstance( OgnlUtil.class ) );

        ObjectFactory objectFactory = new ObjectFactory();
        objectFactory.setReflectionProvider( reflectionProvider );

        DefaultValidatorFileParser fileParser = new DefaultValidatorFileParser();
View Full Code Here

        super.setUp( );

        ConfigurationManager configurationManager = new ConfigurationManager( );
        configurationManager.addContainerProvider( new XWorkConfigurationProvider( ) );
        Configuration config = configurationManager.getConfiguration( );
        Container container = config.getContainer( );

        ValueStack stack = container.getInstance( ValueStackFactory.class ).createValueStack( );
        stack.getContext( ).put( ActionContext.CONTAINER, container );
        ActionContext.setContext( new ActionContext( stack.getContext( ) ) );
    }
View Full Code Here

        super.setUp();

        ConfigurationManager configurationManager = new ConfigurationManager();
        configurationManager.addContainerProvider( new XWorkConfigurationProvider() );
        com.opensymphony.xwork2.config.Configuration config = configurationManager.getConfiguration();
        Container container = config.getContainer();

        ValueStack stack = container.getInstance( ValueStackFactory.class ).createValueStack();
        stack.getContext().put( ActionContext.CONTAINER, container );
        ActionContext.setContext( new ActionContext( stack.getContext() ) );

        assertNotNull( ActionContext.getContext() );
View Full Code Here

        StringBuilder link = new StringBuilder();

        boolean changedScheme = false;

        // FIXME: temporary hack until class is made a properly injected bean
        Container cont = ActionContext.getContext().getContainer();
        int httpPort = Integer.parseInt(cont.getInstance(String.class, StrutsConstants.STRUTS_URL_HTTP_PORT));
        int httpsPort = Integer.parseInt(cont.getInstance(String.class, StrutsConstants.STRUTS_URL_HTTPS_PORT));

        // only append scheme if it is different to the current scheme *OR*
        // if we explicity want it to be appended by having forceAddSchemeHostAndPort = true
        if (forceAddSchemeHostAndPort) {
            String reqScheme = request.getScheme();
View Full Code Here

     * cause action submited by the form is intercepted by validation interceptor which
     * "include" all methods.
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled1() throws Exception {

        final Container cont = container;
        // used to determined if the form action needs js validation
        configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
            private DefaultConfiguration self = this;
            public Container getContainer() {
                return new Container() {
                    public <T> T inject(Class<T> implementation) {return null;}
                    public void removeScopeStrategy() {}
                    public void setScopeStrategy(Strategy scopeStrategy) {}
                    public <T> T getInstance(Class<T> type, String name) {return null;}
                    public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                    public Set<String> getInstanceNames(Class<?> type) {return null;}

                    public void inject(Object o) {
                        cont.inject(o);
                        if (o instanceof Form) {
                            ((Form)o).setConfiguration(self);
                        }
                    }
                };
View Full Code Here

    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled2() throws Exception {

        com.opensymphony.xwork2.config.Configuration originalConfiguration = configurationManager.getConfiguration();
        ObjectFactory originalObjectFactory = ObjectFactory.getObjectFactory();

        final Container cont = container;
        try {
            // used to determined if the form action needs js validation
            configurationManager.setConfiguration(new DefaultConfiguration() {
                private DefaultConfiguration self = this;
                public Container getContainer() {
                    return new Container() {
                        public <T> T inject(Class<T> implementation) {return null;}
                        public void removeScopeStrategy() {}
                        public void setScopeStrategy(Strategy scopeStrategy) {}
                        public <T> T getInstance(Class<T> type, String name) {return null;}
                        public <T> T getInstance(Class<T> type) {return cont.getInstance(type);}
                        public Set<String> getInstanceNames(Class<?> type) {return null;}

                        public void inject(Object o) {
                            cont.inject(o);
                            if (o instanceof Form) {
                                ((Form)o).setConfiguration(self);
                            }
                        }
                    };
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.inject.Container

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.