Search in sources :

Example 26 with Binding

use of org.apache.tapestry5.Binding in project tapestry-5 by apache.

the class BindingFactoryTest method symbol_binding.

@Test
public void symbol_binding() {
    ComponentResources res = mockInternalComponentResources();
    Location l = mockLocation();
    replay();
    BindingFactory factory = getService("SymbolBindingFactory", BindingFactory.class);
    Binding binding = factory.newBinding("Test binding", res, null, SymbolConstants.START_PAGE_NAME, l);
    assertEquals(binding.get(), "start");
    verify();
}
Also used : Binding(org.apache.tapestry5.Binding) ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) BindingFactory(org.apache.tapestry5.services.BindingFactory) Test(org.testng.annotations.Test)

Example 27 with Binding

use of org.apache.tapestry5.Binding in project tapestry-5 by apache.

the class PropBindingFactoryTest method property_path_through_write_only_property.

@Test
public void property_path_through_write_only_property() {
    TargetBean bean = new TargetBean();
    ComponentResources resources = mockComponentResources();
    Location l = mockLocation();
    train_getComponent(resources, bean);
    replay();
    String propertyPath = "writeOnly.terminalProperty";
    try {
        factory.newBinding("test binding", resources, null, propertyPath, l);
        unreachable();
    } catch (RuntimeException ex) {
        assertMessageContains(ex, "Property \'writeOnly\' of class org.apache.tapestry5.internal.bindings.TargetBean", "is not readable (it has no read accessor method).");
    }
    verify();
}
Also used : ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) Test(org.testng.annotations.Test)

Example 28 with Binding

use of org.apache.tapestry5.Binding in project tapestry-5 by apache.

the class PropBindingFactoryTest method method_call_as_terminal.

@Test
public void method_call_as_terminal() {
    TargetBean bean = new TargetBean();
    ComponentResources resources = newComponentResources(bean);
    Location l = mockLocation();
    replay();
    Binding binding = factory.newBinding("test binding", resources, null, "stringHolderMethod().stringValue()", l);
    assertSame(binding.getBindingType(), String.class);
    bean.getStringHolder().setValue("first");
    assertEquals(binding.get(), "first");
    try {
        binding.set("read-only");
        unreachable();
    } catch (TapestryException ex) {
        assertEquals(ex.getMessage(), "Expression 'stringHolderMethod().stringValue()' for class org.apache.tapestry5.internal.bindings.TargetBean is read-only.");
        assertSame(ex.getLocation(), l);
    }
    verify();
}
Also used : Binding(org.apache.tapestry5.Binding) TapestryException(org.apache.tapestry5.commons.internal.util.TapestryException) ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) Test(org.testng.annotations.Test)

Example 29 with Binding

use of org.apache.tapestry5.Binding in project tapestry-5 by apache.

the class PropBindingFactoryTest method void_method_in_preamble.

@Test
public void void_method_in_preamble() {
    TargetBean bean = new TargetBean();
    ComponentResources resources = mockComponentResources();
    Location l = mockLocation();
    train_getComponent(resources, bean);
    replay();
    try {
        factory.newBinding("test binding", resources, null, "voidMethod().value", l);
        unreachable();
    } catch (RuntimeException ex) {
        assertMessageContains(ex, "Method org.apache.tapestry5.internal.bindings.TargetBean.voidMethod() returns void");
    }
    verify();
}
Also used : ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) Test(org.testng.annotations.Test)

Example 30 with Binding

use of org.apache.tapestry5.Binding in project tapestry-5 by apache.

the class PropBindingFactoryTest method primitive_property.

@Test
public void primitive_property() {
    TargetBean bean = new TargetBean();
    ComponentResources resources = newComponentResources(bean);
    Location l = mockLocation();
    replay();
    Binding binding = factory.newBinding("test binding", resources, null, "intValue", l);
    assertSame(binding.getBindingType(), int.class);
    bean.setIntValue(1);
    assertEquals(binding.get(), 1);
    binding.set(2);
    assertEquals(bean.getIntValue(), 2);
    verify();
}
Also used : Binding(org.apache.tapestry5.Binding) ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) Test(org.testng.annotations.Test)

Aggregations

Binding (com.google.iam.v1.Binding)71 Policy (com.google.iam.v1.Policy)68 Test (org.junit.Test)51 AbstractMessage (com.google.protobuf.AbstractMessage)47 Test (org.testng.annotations.Test)38 Binding (org.apache.tapestry5.Binding)34 ComponentResources (org.apache.tapestry5.ComponentResources)33 SetIamPolicyRequest (com.google.iam.v1.SetIamPolicyRequest)30 Location (org.apache.tapestry5.commons.Location)30 GetIamPolicyRequest (com.google.iam.v1.GetIamPolicyRequest)26 ResourceName (com.google.api.resourcenames.ResourceName)20 ByteString (com.google.protobuf.ByteString)20 TapestryException (org.apache.tapestry5.commons.internal.util.TapestryException)12 InternalComponentResources (org.apache.tapestry5.internal.InternalComponentResources)10 BindingFactory (org.apache.tapestry5.services.BindingFactory)10 Component (org.apache.tapestry5.runtime.Component)8 CryptoKeyName (com.google.cloud.kms.v1.CryptoKeyName)6 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)6 InternalPropBinding (org.apache.tapestry5.internal.bindings.InternalPropBinding)6 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)6