本文整理汇总了Java中org.springframework.aop.target.SingletonTargetSource类的典型用法代码示例。如果您正苦于以下问题:Java SingletonTargetSource类的具体用法?Java SingletonTargetSource怎么用?Java SingletonTargetSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SingletonTargetSource类属于org.springframework.aop.target包,在下文中一共展示了SingletonTargetSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBasicDenyParentAssocNode
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicDenyParentAssocNode() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("testOneChildAssociationRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("ACL_PARENT.0.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
try
{
method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(systemNodeRef) });
assertNotNull(null);
}
catch (InvocationTargetException e)
{
}
}
示例2: getObject
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public Object getObject ( final String command ) throws Exception {
final Object templates = Gadgets.createTemplatesImpl(command);
AdvisedSupport as = new AdvisedSupport();
as.setTargetSource(new SingletonTargetSource(templates));
final Type typeTemplatesProxy = Gadgets.createProxy(
(InvocationHandler) Reflections.getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as),
Type.class,
Templates.class);
final Object typeProviderProxy = Gadgets.createMemoitizedProxy(
Gadgets.createMap("getType", typeTemplatesProxy),
forName("org.springframework.core.SerializableTypeWrapper$TypeProvider"));
Object mitp = Reflections.createWithoutConstructor(forName("org.springframework.core.SerializableTypeWrapper$MethodInvokeTypeProvider"));
Reflections.setFieldValue(mitp, "provider", typeProviderProxy);
Reflections.setFieldValue(mitp, "methodName", "newTransformer");
return mitp;
}
示例3: testBasicAllowNullNode
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNullNode() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoNodeRef", new Class[] { NodeRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
Object answer = method.invoke(proxy, new Object[] { null });
assertNull(answer);
}
示例4: testBasicAllowNullStore
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNullStore() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoStoreRef", new Class[] { StoreRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
Object answer = method.invoke(proxy, new Object[] { null });
assertNull(answer);
}
示例5: testBasicAllowUnrecognisedObject
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowUnrecognisedObject() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoObject", new Class[] { Object.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
Object answer = method.invoke(proxy, new Object[] { "noodle" });
assertNotNull(answer);
}
示例6: testBasicDenyStore
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicDenyStore() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoStoreRef", new Class[] { StoreRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
try
{
Object answer = method.invoke(proxy, new Object[] { rootNodeRef.getStoreRef() });
assertNotNull(answer);
}
catch (InvocationTargetException e)
{
}
}
示例7: testBasicDenyNode
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicDenyNode() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoNodeRef", new Class[] { NodeRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
try
{
Object answer = method.invoke(proxy, new Object[] { rootNodeRef });
assertNotNull(answer);
}
catch (InvocationTargetException e)
{
}
}
示例8: testBasicAllowNode
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNode() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoNodeRef", new Class[] { NodeRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Object answer = method.invoke(proxy, new Object[] { rootNodeRef });
assertEquals(answer, rootNodeRef);
}
示例9: testBasicAllowNodePair
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNodePair() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoNodePair", new Class[] { NodeRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Pair<Long, NodeRef> rootNodePair = new Pair<Long, NodeRef>(Long.valueOf(1), rootNodeRef);
Object answer = method.invoke(proxy, new Object[] { rootNodeRef });
assertEquals(rootNodePair, answer);
}
示例10: testBasicAllowStore
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowStore() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoStoreRef", new Class[] { StoreRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Object answer = method.invoke(proxy, new Object[] { rootNodeRef.getStoreRef() });
assertEquals(answer, rootNodeRef.getStoreRef());
}
示例11: testBasicAllowNullChildAssociationRef1
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNullChildAssociationRef1() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoChildAssocRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
Object answer = method.invoke(proxy, new Object[] { null });
assertNull(answer);
}
示例12: testBasicAllowNullChildAssociationRef2
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowNullChildAssociationRef2() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoChildAssocRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_PARENT.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
Object answer = method.invoke(proxy, new Object[] { null });
assertNull(answer);
}
示例13: testBasicAllowChildAssociationRef1
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowChildAssociationRef1() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoChildAssocRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Object answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(rootNodeRef) });
assertEquals(answer, nodeService.getPrimaryParent(rootNodeRef));
answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(systemNodeRef) });
assertEquals(answer, nodeService.getPrimaryParent(systemNodeRef));
}
示例14: testBasicAllowChildAssociationRef2
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicAllowChildAssociationRef2() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoChildAssocRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_PARENT.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Object answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(rootNodeRef) });
assertEquals(answer, nodeService.getPrimaryParent(rootNodeRef));
answer = method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(systemNodeRef) });
assertEquals(answer, nodeService.getPrimaryParent(systemNodeRef));
}
示例15: testBasicDenyChildAssocNode
import org.springframework.aop.target.SingletonTargetSource; //导入依赖的package包/类
public void testBasicDenyChildAssocNode() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("testOneChildAssociationRef", new Class[] { ChildAssociationRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("ACL_NODE.0.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
try
{
method.invoke(proxy, new Object[] { nodeService.getPrimaryParent(rootNodeRef) });
assertNotNull(null);
}
catch (InvocationTargetException e)
{
}
}