![JAR search and dependency download from the Maven repository](/logo.png)
com.mycompany.SimpleDroplet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atgdust Show documentation
Show all versions of atgdust Show documentation
ATG DUST is a framework for building JUnit tests for
applications built on the ATG Dynamo platform. This framework allows
one to quickly write test code that depends up Nucleus or ATG
Repositories. By using this framework one can drastically cut down
on development time. It takes only a few seconds to start up a test
with a repository, but it may take multiple minutes to start up an
application server. To get started with DUST, take a look at
http://atgdust.sourceforge.net/first-test.html. This page will walk
you through the process of running a basic test which starts
Nucleus. After that, read the other getting started guides to
describe how to create standalone Junit tests which can startup
repositories and use the DynamoHttpServletResponse classes.
For only ATG10 and tested.
The newest version!
package com.mycompany;
import java.io.IOException;
import java.util.Properties;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import atg.nucleus.naming.ParameterName;
import atg.servlet.DynamoHttpServletRequest;
import atg.servlet.DynamoHttpServletResponse;
import atg.servlet.DynamoServlet;
public class SimpleDroplet extends DynamoServlet {
/**
*
*/
public static final String USERNAME = "username";
String mUsername = null;
String mUsernameFromInputStream = null;
/**
* Called to execute this droplet
*/
@Override
public void service(final DynamoHttpServletRequest request,
final DynamoHttpServletResponse response) throws ServletException,
IOException {
logInfo("Starting: " + this.getClass().getName());
request.serviceLocalParameter(ParameterName.getParameterName("output"), request, response);
request.setParameter("entry", "The Value");
response.getOutputStream().write("Some content from the simple droplet".getBytes());
mUsername = request.getParameter(USERNAME);
// try to read data from the client if it is available
if ("POST".equals(request.getMethod())) {
ServletInputStream s = request.getInputStream();
Properties p = new Properties();
p.load(s);
mUsernameFromInputStream = p.getProperty(USERNAME);
}
}
/**
* Returns the value of the username parameter
*
* @return
*/
public String getUsername() {
return mUsername;
}
/**
* Returns the value of the username as written to the request input stream
*
* @return
*/
public String getUsernameFromInputStream() {
return mUsernameFromInputStream;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy