Search in sources :

Example 1 with MethodBasedAttributeTransformer

use of org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer in project eclipselink by eclipse-ee4j.

the class TargetInvocationWhileInstantiatingMethodBasedProxyTest method setup.

@Override
protected void setup() throws NoSuchMethodException {
    descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(TargetInvocationWhileInstantiatingMethodBasedProxyTest.class);
    descriptor.addTableName("Dummy_Table");
    row = new DatabaseRecord();
    Class<?>[] parmClasses = { DatabaseRecord.class };
    theMethod = TargetInvocationWhileInstantiatingMethodBasedProxyTest.class.getDeclaredMethod("invalidMethod", parmClasses);
    theTransformer = new MethodBasedAttributeTransformer();
    theTransformer.setAttributeTransformationMethod(theMethod);
    theReceiver = new TargetInvocationWhileInstantiatingMethodBasedProxyTest();
    valueHolder = new TransformerBasedValueHolder(theTransformer, theReceiver, row, (AbstractSession) getSession());
    expectedException = DescriptorException.targetInvocationWhileInstantiatingMethodBasedProxy(new Exception());
}
Also used : TransformerBasedValueHolder(org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) MethodBasedAttributeTransformer(org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 2 with MethodBasedAttributeTransformer

use of org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer in project eclipselink by eclipse-ee4j.

the class IllegalArgumentWhileInstantiatingMethodBasedProxyTest method setup.

@Override
protected void setup() throws NoSuchMethodException {
    descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(IllegalArgumentWhileInstantiatingMethodBasedProxyTest.class);
    descriptor.addTableName("Dummy_Table");
    row = new DatabaseRecord();
    Class<?>[] parmClasses = { DatabaseRecord.class };
    theTransformer = new MethodBasedAttributeTransformer();
    theTransformer.setAttributeTransformationMethod(IllegalArgumentWhileInstantiatingMethodBasedProxyTest.class.getDeclaredMethod("invalidMethod", parmClasses));
    // theReceiver = new IllegalArgumentWhileInstantiatingMethodBasedProxyTest(); //not correct error
    // the following causes the correct error to occur.
    // invalid Receiver causes correct error
    theReceiver = new DatabaseRecord();
    valueHolder = new TransformerBasedValueHolder(theTransformer, theReceiver, row, (AbstractSession) getSession());
    expectedException = DescriptorException.illegalArgumentWhileInstantiatingMethodBasedProxy(new Exception());
}
Also used : TransformerBasedValueHolder(org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) MethodBasedAttributeTransformer(org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Aggregations

RelationalDescriptor (org.eclipse.persistence.descriptors.RelationalDescriptor)2 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)2 EclipseLinkException (org.eclipse.persistence.exceptions.EclipseLinkException)2 TransformerBasedValueHolder (org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder)2 AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)2 MethodBasedAttributeTransformer (org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer)2 DatabaseRecord (org.eclipse.persistence.sessions.DatabaseRecord)2