Package org.slim3.tester

Examples of org.slim3.tester.TestEnvironment


                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

            AttributeMetaDesc attributeMetaDesc,
            ClassDeclaration classDeclaration, FieldDeclaration fieldDeclaration) {
        String propertyName = attributeMetaDesc.getName();
        if (propertyNames.contains(propertyName)) {
            if (classDeclaration.equals(fieldDeclaration.getDeclaringType())) {
                throw new ValidationException(
                    MessageCode.SLIM3GEN1047,
                    env,
                    fieldDeclaration.getPosition(),
                    propertyName);
            }
            throw new ValidationException(
                MessageCode.SLIM3GEN1048,
                env,
                classDeclaration.getPosition(),
                propertyName,
                fieldDeclaration.getSimpleName(),
View Full Code Here

        if (attributeMetaDesc.getDataType() instanceof PrimitiveBooleanType) {
            String attributeName = attributeMetaDesc.getAttributeName();
            if (booleanAttributeNames.contains(attributeName)) {
                if (classDeclaration
                    .equals(fieldDeclaration.getDeclaringType())) {
                    throw new ValidationException(
                        MessageCode.SLIM3GEN1043,
                        env,
                        fieldDeclaration.getPosition(),
                        fieldDeclaration.getSimpleName());
                }
                throw new ValidationException(
                    MessageCode.SLIM3GEN1044,
                    env,
                    classDeclaration.getPosition(),
                    fieldDeclaration.getSimpleName(),
                    fieldDeclaration.getDeclaringType().getQualifiedName());
View Full Code Here

import com.google.apphosting.api.ApiProxy;

public class PersistentFieldsTest {
    @Test
    public void test() throws Exception{
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment() {
            @Override
            public String getAppId() {
                return "slim3-gen";
            }
        });
View Full Code Here

public class ModelRefAttrModelTest {
    @BeforeClass
    public static void staticSetUp() {
        Datastore.setGlobalCipherKey("0654813216578941");
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment() {
            @Override
            public String getAppId() {
                return "slim3-gen";
            }
        });
View Full Code Here

import com.google.apphosting.api.ApiProxy;

public class AppEngineTypeListAttrsModelTest {
    @Before
    public void setUp() throws Exception {
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment() {
            @Override
            public String getAppId() {
                return "slim3-gen";
            }
        });
View Full Code Here

public class AppEngineTypeAttrsModelTest {
    @Test
    public void modelToJson() throws Exception {
        Datastore.setGlobalCipherKey("0654813216578941");
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment() {
            @Override
            public String getAppId() {
                return "slim3-gen";
            }
        });
View Full Code Here

public class MinutesServiceTest extends AppEngineTestCase {
    @Test
    public void 議事録のタイトルを作成できる() {
        // test@example.com というユーザがログイン中、という状態を作っておく。
        TestEnvironment environment =
            (TestEnvironment) ApiProxy.getCurrentEnvironment();
        environment.setEmail("test@example.com");
        // テスト対象を実行する前のMinutes の件数を保存
        int before = tester.count(Minutes.class);
        // テスト対象を実行する
        Key key = MinutesService.put(" テスト用議事録");
        // Minutes の件数が一件増えたことを確認する。
View Full Code Here

TOP

Related Classes of org.slim3.tester.TestEnvironment

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.