Package org.lightadmin.core.config

Examples of org.lightadmin.core.config.LightAdminConfiguration


    @Override
    @SuppressWarnings("unchecked")
    public Collection<? extends DomainConfigurationProblem> validateFieldMetadata(PersistentFieldMetadata fieldMetadata, Class<?> domainType, DomainConfigurationValidationContext validationContext) {
        MappingContext mappingContext = validationContext.getMappingContext();
        final LightAdminConfiguration lightAdminConfiguration = validationContext.getLightAdminConfiguration();

        final PersistentEntity persistentEntity = mappingContext.getPersistentEntity(domainType);

        PersistentProperty persistentProperty = persistentEntity.getPersistentProperty(fieldMetadata.getField());

        if (persistentProperty == null) {
            return newArrayList(validationContext.notPersistableFieldProblem(fieldMetadata.getName()));
        }

        if (!isSupportedAttributeType(PersistentPropertyType.forPersistentProperty(persistentProperty))) {
            return newArrayList(validationContext.notSupportedTypeFieldProblem(fieldMetadata.getName()));
        }

        if (!isOfFileReferenceType(persistentProperty)) {
            return emptyList();
        }

        Annotation annotation = persistentProperty.findAnnotation(FileReference.class);

        FileReference fileReference = (FileReference) annotation;

        if (isEmpty(fileReference.baseDirectory())) {
            if (lightAdminConfiguration.getFileStorageDirectory() != null) {
                return emptyList();
            }
            return newArrayList(validationContext.missingBaseDirectoryInFileReferenceProblem(fieldMetadata.getName()));
        }
View Full Code Here


public class StandardWebContextTest {

    @Test
    public void testApplicationBaseUrlWithoutEndSeparator() {
        LightAdminConfiguration lightAdminConfiguration = new StandardLightAdminConfiguration(servletContext("/admin"));

        assertEquals("/admin", lightAdminConfiguration.getApplicationBaseUrl());
        assertEquals("/admin/url", lightAdminConfiguration.getApplicationUrl("/url"));
    }
View Full Code Here

        assertEquals("/admin/url", lightAdminConfiguration.getApplicationUrl("/url"));
    }

    @Test
    public void testApplicationBaseUrlWithEndSeparator() {
        LightAdminConfiguration lightAdminConfiguration = new StandardLightAdminConfiguration(servletContext("/admin/"));

        assertEquals("/admin/", lightAdminConfiguration.getApplicationBaseUrl());
        assertEquals("/admin/url", lightAdminConfiguration.getApplicationUrl("/url"));
    }
View Full Code Here

    @Test
    public void testSecurityEnabled() {
        final ServletContext servletContext = servletContext("/admin/", true, null);

        LightAdminConfiguration lightAdminConfiguration = new StandardLightAdminConfiguration(servletContext);

        assertTrue(lightAdminConfiguration.isSecurityEnabled());
        assertEquals("/lightadmin-demo/admin/logout", lightAdminConfiguration.getSecurityLogoutUrl());
    }
View Full Code Here

    @Test
    public void testSecurityDisabledByDefault() {
        final ServletContext servletContext = servletContext("/admin/", null, null);

        LightAdminConfiguration lightAdminConfiguration = new StandardLightAdminConfiguration(servletContext);

        assertFalse(lightAdminConfiguration.isSecurityEnabled());
        assertEquals("/lightadmin-demo#", lightAdminConfiguration.getSecurityLogoutUrl());
    }
View Full Code Here

    @Test
    public void testExternalSecurityEnabledWithLogoutUrl() {
        final ServletContext servletContext = servletContext("/admin/", false, "/external_logout");

        LightAdminConfiguration lightAdminConfiguration = new StandardLightAdminConfiguration(servletContext);

        assertFalse(lightAdminConfiguration.isSecurityEnabled());
        assertEquals("/lightadmin-demo/external_logout", lightAdminConfiguration.getSecurityLogoutUrl());
    }
View Full Code Here

TOP

Related Classes of org.lightadmin.core.config.LightAdminConfiguration

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.