Package org.slim3.tester

Examples of org.slim3.tester.MockHttpServletRequest


        }
        String value =
            AnnotationMirrorUtil
                .getElementValue(anno, AnnotationConstants.kind);
        if (value != null && value.length() > 0) {
            throw new ValidationException(MessageCode.SLIM3GEN1022, env, anno
                .getPosition());
        }
    }
View Full Code Here


     * @param schemaVersionName
     */
    protected void validateSchemaVersionName(ClassDeclaration classDeclaration,
            String schemaVersionName) {
        if (StringUtil.isEmpty(schemaVersionName)) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1023,
                env,
                classDeclaration.getPosition());
        }
    }
View Full Code Here

     * @param classHierarchyListName
     */
    protected void validateClassHierarchyListName(
            ClassDeclaration classDeclaration, String classHierarchyListName) {
        if (StringUtil.isEmpty(classHierarchyListName)) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1049,
                env,
                classDeclaration.getPosition());
        }
    }
View Full Code Here

            }
            modelMetaDesc.addAttributeMetaDesc(attributeMetaDesc);
        }
        if (!modelMetaDesc.isError()
            && modelMetaDesc.getKeyAttributeMetaDesc() == null) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1015,
                env,
                classDeclaration.getPosition());
        }
    }
View Full Code Here

                AnnotationConstants.listener);
        if (listener == null) {
            return;
        }
        if (listener instanceof InterfaceType) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1052,
                env,
                classDeclaration.getPosition());
        }
        ClassType listenerClassType =
            TypeUtil.toClassType((TypeMirror) listener);
        if (listenerClassType == null) {
            return;
        }
        ClassDeclaration listenerClassDeclaration =
            listenerClassType.getDeclaration();
        if (listenerClassDeclaration == null) {
            throw new UnknownDeclarationException(
                env,
                listenerClassDeclaration,
                listenerClassType);
        }
        if (!DeclarationUtil
            .hasPublicDefaultConstructor(listenerClassDeclaration)) {
                throw new ValidationException(
                    MessageCode.SLIM3GEN1050,
                    env,
                    classDeclaration.getPosition(),
                    listenerClassDeclaration.getQualifiedName());
        }
View Full Code Here

    protected void validatePrimaryKeyUniqueness(
            AttributeMetaDesc attributeMetaDesc,
            ClassDeclaration classDeclaration, ModelMetaDesc modelMetaDesc) {
        if (attributeMetaDesc.isPrimaryKey()
            && modelMetaDesc.getKeyAttributeMetaDesc() != null) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1013,
                env,
                classDeclaration.getPosition());
        }
    }
View Full Code Here

    protected void validateVersionUniqueness(
            AttributeMetaDesc attributeMetaDesc,
            ClassDeclaration classDeclaration, ModelMetaDesc modelMetaDesc) {
        if (attributeMetaDesc.isVersion()
            && modelMetaDesc.getVersionAttributeMetaDesc() != null) {
            throw new ValidationException(
                MessageCode.SLIM3GEN1014,
                env,
                classDeclaration.getPosition());
        }
    }
View Full Code Here

     * @throws Exception
     */
    @Before
    public void setUp() throws Exception {
        servletContext = new MockServletContext();
        request = new MockHttpServletRequest(servletContext);
        parameters = new RequestMap(request);
        parameters.put(ControllerConstants.ERRORS_KEY, new Errors());
        v = new Validators(parameters);
        ApplicationMessage.setBundle("test", Locale.ENGLISH);
    }
View Full Code Here

     *
     */
    @Test
    public void test() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest request =
            new MockHttpServletRequest(servletContext);
        RequestLocator.set(request);
        assertThat(
            RequestLocator.get(),
            is(sameInstance((HttpServletRequest) request)));
    }
View Full Code Here

     *
     */
    @Test
    public void processTimeZoneForSession() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest request =
            new MockHttpServletRequest(servletContext);
        request.getSession().setAttribute(
            ControllerConstants.TIME_ZONE_KEY,
            "PST");
        FrontController frontController = new FrontController();
        frontController.defaultTimeZone = TimeZone.getTimeZone("JST");
        assertThat(frontController.processTimeZone(request), is(TimeZone
View Full Code Here

TOP

Related Classes of org.slim3.tester.MockHttpServletRequest

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.