Methods Summary |
---|
public static junit.framework.Test | suite()
ClientKernelAbstraction kernel = KernelAbstractionFactory.getClientInstance();
ObjectName propertiesServiceON = new ObjectName("jboss:type=Service,name=SystemProperties");
kernel.invoke(
propertiesServiceON,
"set",
new Object[]{"test.datasource.jndi","java:/DefaultDS"},
new String[]{"java.lang.String", "java.lang.String"}
);
kernel.invoke(
propertiesServiceON,
"set",
new Object[]{"test.transactionmanager.jndi","java:/TransactionManager"},
new String[]{"java.lang.String", "java.lang.String"}
);
return getDeploySetup(BankDeploymentDescriptorTestCase.class, "bank.jar");
|
public void | testCallbackListenersAndInteceptors()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
TestStatus status = (TestStatus) getInitialContext().lookup("TestStatusBean/remote");
status.clear();
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
String id = bank.interceptCustomerId("CustomerId");
assertEquals("CustomerId_SecondInterceptor_FirstInterceptor", id);
assertTrue(status.postConstruct());
|
public void | testEnvEntry()
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
String id = bank.getEnvEntryId();
assertEquals(id, "5678");
|
public void | testFieldInject()
InitialContext jndiContext = new InitialContext();
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
String greeting = teller.greetWithServiceTimer("Hello");
assertEquals("Hello", greeting);
|
public void | testInit()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
String initialized = bank.isInitialized();
assertEquals("YESYES", initialized);
|
public void | testInjectionAnnotations()
InitialContext jndiContext = new InitialContext();
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
SecurityAssociation.setPrincipal(new SimplePrincipal("customer"));
SecurityAssociation.setCredential("password".toCharArray());
String greeting = teller.greetChecked("Hello");
assertNotNull(greeting);
assertEquals("Hello", greeting);
assertTrue(teller.isConstructed());
|
public void | testRemoteBindingInterceptorStack()
Teller teller = (Teller)getInitialContext().lookup(Teller.JNDI_NAME);
assertNotNull(teller);
assertTrue(TellerInterceptor.accessed);
|
public void | testRemoteBindingProxyFactory()
ProxyFactoryInterface teller = (ProxyFactoryInterface)getInitialContext().lookup(Teller.JNDI_NAME);
assertNotNull(teller);
|
public void | testRemove()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
bank.remove();
try {
bank.testResource();
assertTrue(false);
}
catch (NoSuchEJBException e)
{
// correct exception
}
|
public void | testResource()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
bank.testResource();
|
public void | testRunAs()
InitialContext jndiContext = new InitialContext();
SecurityAssociation.setPrincipal(new SimplePrincipal("rolefail"));
SecurityAssociation.setCredential("password".toCharArray());
String customerId = "CustomerId";
String greeting;
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
String tmpId = teller.retrieveCustomerId();
assertEquals("defaultId", tmpId);
|
public void | testStatefulBank()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
String customerId = "CustomerId";
SecurityAssociation.setPrincipal(new SimplePrincipal("customer"));
SecurityAssociation.setCredential("password".toCharArray());
try {
bank.storeCustomerId(customerId);
assertTrue(false);
} catch (Exception e){
assertTrue(e instanceof EJBAccessException);
}
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
bank.storeCustomerId(customerId);
String tmpId = bank.retrieveCustomerId();
assertEquals(customerId, tmpId);
|
public void | testStatefulBank21()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME + "21");
assertNotNull(bank);
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
String activated = bank.isActivated();
assertEquals(activated, "_CREATED");
|
public void | testStatefulState()
InitialContext jndiContext = new InitialContext();
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
String customerId = "CustomerId";
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
bank.storeCustomerId(customerId);
String tmpId = bank.retrieveCustomerId();
assertEquals(customerId, tmpId);
bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
tmpId = bank.retrieveCustomerId();
assertEquals("defaultId", tmpId);
|
public void | testStatefulTransactionTimeout()
InitialContext jndiContext = new InitialContext();
SecurityAssociation.setPrincipal(new SimplePrincipal("teller"));
SecurityAssociation.setCredential("password".toCharArray());
Bank bank = (Bank) jndiContext.lookup(Bank.JNDI_NAME);
assertNotNull(bank);
try{
bank.testTransactionTimeout();
String state = bank.getTransactionState();
assertEquals("failed", state);
} catch (Exception e){
}
|
public void | testStatelessTeller()
InitialContext jndiContext = new InitialContext();
SecurityAssociation.setPrincipal(new SimplePrincipal("rolefail"));
SecurityAssociation.setCredential("password".toCharArray());
String greeting;
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
greeting = teller.greetWithRequiredTransaction("Hello");
assertNotNull(greeting);
assertEquals("Hello", greeting);
greeting = teller.greetWithNotSupportedTransaction("Hello");
assertNotNull(greeting);
assertEquals("Hello", greeting);
greeting = teller.greetUnchecked("Hello");
assertNotNull(greeting);
assertEquals("Hello", greeting);
try {
greeting = teller.greetChecked("Hello");
assertTrue(false);
} catch (Exception e){
assertTrue(e instanceof EJBAccessException);
}
SecurityAssociation.setPrincipal(new SimplePrincipal("customer"));
SecurityAssociation.setCredential("password".toCharArray());
try{
greeting = teller.greetChecked("Hello");
assertNotNull(greeting);
assertEquals("Hello", greeting);
} catch (Exception e){
e.printStackTrace();
}
|
public void | testTeller()
InitialContext jndiContext = new InitialContext();
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
SecurityAssociation.setPrincipal(new SimplePrincipal("customer"));
SecurityAssociation.setCredential("password".toCharArray());
try {
teller.excludedMethod();
assertTrue(false);
} catch (Exception e){
assertTrue(e instanceof EJBAccessException);
}
|
public void | testTransactionTimeout()
InitialContext jndiContext = new InitialContext();
SecurityAssociation.setPrincipal(new SimplePrincipal("customer"));
SecurityAssociation.setCredential("password".toCharArray());
Teller teller = (Teller) jndiContext.lookup(Teller.JNDI_NAME);
assertNotNull(teller);
boolean exceptionThrown = false;
try
{
teller.testTransactionTimeout();
}
catch (Exception e)
{
exceptionThrown = true;
}
assertTrue(exceptionThrown);
|