本文整理汇总了Java中javax.naming.CannotProceedException.setResolvedObj方法的典型用法代码示例。如果您正苦于以下问题:Java CannotProceedException.setResolvedObj方法的具体用法?Java CannotProceedException.setResolvedObj怎么用?Java CannotProceedException.setResolvedObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.CannotProceedException
的用法示例。
在下文中一共展示了CannotProceedException.setResolvedObj方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetContinuationDirContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationDirContext() throws NamingException {
// Step 1: Write a simple class which implements
// LdapContext and InitialContextFactory.
// Please refer to the following class MyLdapContext
// Step 2: Create an instance of MyLdapContext
DirContext context = new MyLdapContext();
// Step 3: Create an instance of CannotProceedException,
// and set the resolve object as "context"
CannotProceedException exception = new CannotProceedException(
"TestGetContinuationDirContext");
exception.setResolvedObj(context);
// Step 4: Call DirectoryManager.getContinuationDirContext and pass
// the "exception";
DirContext newContext = DirectoryManager
.getContinuationDirContext(exception);
// Step 5: check result
assertNotNull(newContext);
// System.out.println(context);
// System.out.println(newContext);
}
示例2: testGetContinuationContext_OBJ_name_context_badnameh
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_badnameh()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_name_context_badnameh()");
CannotProceedException cpe = new CannotProceedException();
Object obj = "resolved object";
cpe.setResolvedObj(obj);
CompositeName altName = new CompositeName("abc/abc");
cpe.setAltName(altName);
MockContext context = new MockContext(new Hashtable<String, Object>());
cpe.setAltNameCtx(context);
Hashtable<String, String> h = new Hashtable<String, String>();
h.put(Context.OBJECT_FACTORIES, "bad name:asdfa");
cpe.setEnvironment(h);
try {
NamingManager.getContinuationContext(cpe);
fail();
} catch (CannotProceedException e) {
assertCPE(cpe, altName, context, h, e, obj);
}
}
示例3: testGetContinuationContext_OBJ_name_context_wrongh
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_wrongh()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_name_context_wrongh()");
CannotProceedException cpe = new CannotProceedException();
Object obj = "resolved object";
cpe.setResolvedObj(obj);
CompositeName altName = new CompositeName("abc/abc");
cpe.setAltName(altName);
MockContext context = new MockContext(new Hashtable<String, Object>());
cpe.setAltNameCtx(context);
Hashtable<String, String> h = new Hashtable<String, String>();
h
.put(Context.OBJECT_FACTORIES,
"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockObjectFactory");
cpe.setEnvironment(h);
try {
NamingManager.getContinuationContext(cpe);
fail();
} catch (CannotProceedException e) {
assertCPE(cpe, altName, context, h, e, obj);
}
}
示例4: testGetContinuationContext_OBJ_name_context_null
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_null()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_name_context_null()");
CannotProceedException cpe = new CannotProceedException();
Object obj = "resolved object";
cpe.setResolvedObj(obj);
CompositeName altName = new CompositeName("abc/abc");
cpe.setAltName(altName);
MockContext context = new MockContext(new Hashtable<String, Object>());
cpe.setAltNameCtx(context);
try {
NamingManager.getContinuationContext(cpe);
fail();
} catch (CannotProceedException e) {
assertCPE(cpe, altName, context, null, e, obj);
}
}
示例5: makeContinuationContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public static DirContext makeContinuationContext ( String codebase, String clazz ) throws Exception {
Class<?> ccCl = Class.forName("javax.naming.spi.ContinuationDirContext"); //$NON-NLS-1$
Constructor<?> ccCons = ccCl.getDeclaredConstructor(CannotProceedException.class, Hashtable.class);
ccCons.setAccessible(true);
CannotProceedException cpe = new CannotProceedException();
Reflections.setFieldValue(cpe, "stackTrace", new StackTraceElement[0]);
cpe.setResolvedObj(new Reference("Foo", clazz, codebase));
return (DirContext) ccCons.newInstance(cpe, null);
}
示例6: testGetContinuationContext_MockContext_null_null_null
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_MockContext_null_null_null()
throws NamingException {
log
.setMethod("testGetContinuationContext_MockContext_null_null_null()");
CannotProceedException cpe = new CannotProceedException();
Object resolvedObj = new MockContext(new Hashtable<String, Object>());
cpe.setResolvedObj(resolvedObj);
Context r = NamingManager.getContinuationContext(cpe);
assertSame(resolvedObj, r);
assertSame(cpe, cpe.getEnvironment().get(NamingManager.CPE));
}
示例7: testGetContinuationContext_OBJ_name_context_h
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_h()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_name_context_h()");
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj("resolved object");
cpe.setAltName(new CompositeName("abc/abc"));
cpe.setAltNameCtx(new MockContext(new Hashtable<String, Object>()));
Hashtable<String, String> h = new Hashtable<String, String>();
h
.put(Context.OBJECT_FACTORIES,
"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
cpe.setEnvironment(h);
Context r = NamingManager.getContinuationContext(cpe);
assertTrue(r instanceof MockContext);
}
示例8: testGetContinuationContext_OBJ_null_ctx_h
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_null_ctx_h()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_null_ctx_h()");
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj("resolved object");
cpe.setAltNameCtx(new MockContext(new Hashtable<String, Object>()));
Hashtable<String, String> h = new Hashtable<String, String>();
h
.put(Context.OBJECT_FACTORIES,
"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
cpe.setEnvironment(h);
Context r = NamingManager.getContinuationContext(cpe);
assertTrue(r instanceof MockContext);
}
示例9: testGetContinuationContext_OBJ_name_null_h
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
public void testGetContinuationContext_OBJ_name_null_h()
throws NamingException {
log.setMethod("testGetContinuationContext_OBJ_name_null_h()");
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj("resolved object");
cpe.setAltName(new CompositeName("abc/abc"));
Hashtable<String, String> h = new Hashtable<String, String>();
h
.put(Context.OBJECT_FACTORIES,
"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
cpe.setEnvironment(h);
Context r = NamingManager.getContinuationContext(cpe);
assertTrue(r instanceof MockContext);
}
示例10: createCannotProceedException
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Lookups the first component (considered a URL) of the specified name
* using {@link #lookup(String)} and wraps it into
* {@link CannotProceedException}.
*
* @param name
* Name to parse.
*
* @return Created {@link CannotProceedException}.
*
* @throws NamingException
* If some naming error occurs.
*/
protected final CannotProceedException createCannotProceedException(
Name name) throws NamingException {
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj(lookup(name.get(0)));
cpe.setEnvironment(environment);
return cpe;
}
示例11: createCannotProceedException
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Lookups the first component (considered a URL)
* of the specified name using {@link #lookup(String)}
* and wraps it into {@link CannotProceedException}.
*
* @param name
* Name to parse.
*
* @return Created {@link CannotProceedException}.
*
* @throws NamingException
* If some naming error occurs.
*/
protected final CannotProceedException createCannotProceedException(
Name name) throws NamingException {
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj(lookup(name.get(0)));
cpe.setEnvironment(environment);
return cpe;
}