Search in sources :

Example 1 with Field

use of org.apache.tapestry5.Field in project flowlogix by flowlogix.

the class EJBAnnotationWorker method transform.

@Override
@SneakyThrows({ NamingException.class })
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) {
    for (PlasticField field : plasticClass.getFieldsWithAnnotation(EJB.class)) {
        final EJB annotation = field.getAnnotation(EJB.class);
        final Stateful stateful = field.getAnnotation(Stateful.class);
        final String fieldType = field.getTypeName();
        final String fieldName = field.getName();
        final String mappedName = annotation.mappedName();
        final JNDIObjectLocator locator = JNDIObjectLocator.builder().build();
        final String lookupname = getLookupName(annotation, fieldType, locator);
        Object injectionValue = lookupBean(field, fieldType, fieldName, lookupname, mappedName, stateful, locator);
        if (injectionValue != null) {
            field.claim(annotation);
        }
    }
}
Also used : Stateful(com.flowlogix.web.services.annotations.Stateful) PlasticField(org.apache.tapestry5.plastic.PlasticField) EJB(javax.ejb.EJB) JNDIObjectLocator(org.omnifaces.util.JNDIObjectLocator) SneakyThrows(lombok.SneakyThrows)

Example 2 with Field

use of org.apache.tapestry5.Field in project java-firestore by googleapis.

the class FirestoreAdminClientTest method updateFieldTest.

@Test
public void updateFieldTest() throws Exception {
    Field expectedResponse = Field.newBuilder().setName(FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString()).setIndexConfig(Field.IndexConfig.newBuilder().build()).build();
    Operation resultOperation = Operation.newBuilder().setName("updateFieldTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockFirestoreAdmin.addResponse(resultOperation);
    Field field = Field.newBuilder().build();
    Field actualResponse = client.updateFieldAsync(field).get();
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateFieldRequest actualRequest = ((UpdateFieldRequest) actualRequests.get(0));
    Assert.assertEquals(field, actualRequest.getField());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Field(com.google.firestore.admin.v1.Field) AbstractMessage(com.google.protobuf.AbstractMessage) UpdateFieldRequest(com.google.firestore.admin.v1.UpdateFieldRequest) Operation(com.google.longrunning.Operation) Test(org.junit.Test)

Example 3 with Field

use of org.apache.tapestry5.Field in project java-firestore by googleapis.

the class FirestoreAdminClientTest method updateFieldExceptionTest.

@Test
public void updateFieldExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockFirestoreAdmin.addException(exception);
    try {
        Field field = Field.newBuilder().build();
        client.updateFieldAsync(field).get();
        Assert.fail("No exception raised");
    } catch (ExecutionException e) {
        Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
        InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
        Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
    }
}
Also used : Field(com.google.firestore.admin.v1.Field) InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 4 with Field

use of org.apache.tapestry5.Field in project java-firestore by googleapis.

the class FirestoreAdminClientTest method getFieldTest.

@Test
public void getFieldTest() throws Exception {
    Field expectedResponse = Field.newBuilder().setName(FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString()).setIndexConfig(Field.IndexConfig.newBuilder().build()).build();
    mockFirestoreAdmin.addResponse(expectedResponse);
    FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
    Field actualResponse = client.getField(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetFieldRequest actualRequest = ((GetFieldRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Field(com.google.firestore.admin.v1.Field) AbstractMessage(com.google.protobuf.AbstractMessage) GetFieldRequest(com.google.firestore.admin.v1.GetFieldRequest) FieldName(com.google.firestore.admin.v1.FieldName) Test(org.junit.Test)

Example 5 with Field

use of org.apache.tapestry5.Field in project java-firestore by googleapis.

the class FirestoreAdminClientTest method getFieldTest2.

@Test
public void getFieldTest2() throws Exception {
    Field expectedResponse = Field.newBuilder().setName(FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString()).setIndexConfig(Field.IndexConfig.newBuilder().build()).build();
    mockFirestoreAdmin.addResponse(expectedResponse);
    String name = "name3373707";
    Field actualResponse = client.getField(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetFieldRequest actualRequest = ((GetFieldRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Field(com.google.firestore.admin.v1.Field) AbstractMessage(com.google.protobuf.AbstractMessage) GetFieldRequest(com.google.firestore.admin.v1.GetFieldRequest) Test(org.junit.Test)

Aggregations

Field (io.atlasmap.v2.Field)221 FieldGroup (io.atlasmap.v2.FieldGroup)86 Test (org.testng.annotations.Test)69 Test (org.junit.jupiter.api.Test)67 SimpleField (io.atlasmap.v2.SimpleField)62 Field (org.apache.tapestry5.Field)46 JavaField (io.atlasmap.java.v2.JavaField)45 ArrayList (java.util.ArrayList)41 Mapping (io.atlasmap.v2.Mapping)39 MessageFormatter (org.apache.tapestry5.commons.MessageFormatter)36 AtlasPath (io.atlasmap.core.AtlasPath)29 ConstantField (io.atlasmap.v2.ConstantField)29 ComponentResources (org.apache.tapestry5.ComponentResources)27 Messages (org.apache.tapestry5.commons.Messages)27 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)26 AtlasException (io.atlasmap.api.AtlasException)25 JsonField (io.atlasmap.json.v2.JsonField)25 PropertyField (io.atlasmap.v2.PropertyField)22 FieldValidator (org.apache.tapestry5.FieldValidator)22 AtlasMapping (io.atlasmap.v2.AtlasMapping)21