Skip to content

Commit

Permalink
Build errors are all resolved, now just sorting out the runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Schang committed Apr 6, 2012
1 parent 97d977e commit 105a2d9
Show file tree
Hide file tree
Showing 38 changed files with 397 additions and 241 deletions.
1 change: 1 addition & 0 deletions build-tools/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/openmeap-shared-serverside"/>
<classpathentry combineaccessrules="false" kind="src" path="/openmeap-admin-web"/>
<classpathentry combineaccessrules="false" kind="src" path="/openmeap-services-web"/>
<classpathentry combineaccessrules="false" kind="src" path="/openmeap-shared-jdk5"/>
<classpathentry kind="output" path="bin"/>
</classpath>
30 changes: 15 additions & 15 deletions build-tools/test/com/openmeap/admin/web/AdminTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.HashMap;
import java.util.Map;

import org.apache.http.Header;
import org.apache.http.HttpResponse;
import com.openmeap.util.HttpHeader;
import com.openmeap.util.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -57,7 +57,7 @@
*/
public class AdminTest {

final static private String HOST = "localhost:7000";
final static private String HOST = "localhost:8080";

final static private String ADMIN_USER = "tomcat";
final static private String ADMIN_PASS = "tomcat";
Expand Down Expand Up @@ -102,20 +102,20 @@ public class AdminTest {
@Test public void testLogin() throws Exception {

HttpResponse response = helper.getLogin();
EntityUtils.consume(response.getEntity());
Utils.consumeInputStream(response.getResponseBody());

response = helper.postLogin(ADMIN_USER, ADMIN_PASS);

Assert.assertTrue(response.getStatusLine().getStatusCode()==302);
Header[] headers = response.getHeaders("Location");
Assert.assertTrue(response.getStatusCode()==302);
HttpHeader[] headers = response.getHeaders("Location");
Assert.assertTrue(headers.length==1);
Assert.assertTrue(headers[0].getValue().equals(helper.getAdminUrl()));

EntityUtils.consume(response.getEntity());
Utils.consumeInputStream(response.getResponseBody());

// Tomcat will shoot you in the face if you don't follow it's redirects
response = helper.getRequestExecuter().get(headers[0].getValue());
EntityUtils.consume(response.getEntity());
Utils.consumeInputStream(response.getResponseBody());
}

@Test public void testUpdateGlobalSettings() throws Exception {
Expand All @@ -136,7 +136,7 @@ public class AdminTest {
settings.setClusterNodes(clusterNodeMap);

// validate settings stored in database
EntityUtils.consume(helper.postGlobalSettings(settings).getEntity());
Utils.consumeInputStream(helper.postGlobalSettings(settings).getResponseBody());

GlobalSettings insertedSettings = modelManager.getGlobalSettings();

Expand All @@ -160,8 +160,8 @@ public class AdminTest {

HttpResponse response = helper.postAddModifyApp(app);

Assert.assertTrue(response.getStatusLine().getStatusCode()==200);
String output = Utils.readInputStream(response.getEntity().getContent(),FormConstants.CHAR_ENC_DEFAULT);
Assert.assertTrue(response.getStatusCode()==200);
String output = Utils.readInputStream(response.getResponseBody(),FormConstants.CHAR_ENC_DEFAULT);
Assert.assertTrue(output.contains(APP_ADDMODIFY_SUCCESS));

// Now check the database, to make sure everything got in there
Expand All @@ -182,7 +182,7 @@ public class AdminTest {
Integer newLen = 2;
dbApp.setDescription(newDesc);
dbApp.setDeploymentHistoryLength(newLen);
EntityUtils.consume(helper.postAddModifyApp(dbApp).getEntity());
Utils.consumeInputStream(helper.postAddModifyApp(dbApp).getResponseBody());

// validate changes
modelManager.refresh(dbApp,null);
Expand Down Expand Up @@ -258,7 +258,7 @@ private void _createApplicationVersion(String identifier, String notes, String a
app.addVersion(version);
File uploadArchive = new File(this.getClass().getResource(archiveName).getFile());

EntityUtils.consume(helper.postAddModifyAppVer(version, uploadArchive).getEntity());
Utils.consumeInputStream(helper.postAddModifyAppVer(version, uploadArchive).getResponseBody());

// archive is uploaded
modelManager.getModelService().clearPersistenceContext();
Expand All @@ -281,7 +281,7 @@ private Boolean _deleteApplicationVersion(String identifier) throws Exception {
ApplicationVersion version = modelManager.getModelService().findAppVersionByNameAndId(APP_NAME, identifier);
String hash = version.getArchive().getHash();

EntityUtils.consume(helper.postAddModifyAppVer_delete(version).getEntity());
Utils.consumeInputStream(helper.postAddModifyAppVer_delete(version).getResponseBody());

modelManager.getModelService().clearPersistenceContext();
version = modelManager.getModelService().findAppVersionByNameAndId(APP_NAME, identifier);
Expand All @@ -292,7 +292,7 @@ private Boolean _deleteApplicationVersion(String identifier) throws Exception {

private void _createDeployment(String identifier, Deployment.Type type) throws Exception {
ApplicationVersion version = modelManager.getModelService().findAppVersionByNameAndId(APP_NAME, identifier);
EntityUtils.consume(helper.postCreateDeployment(version, type).getEntity());
Utils.consumeInputStream(helper.postCreateDeployment(version, type).getResponseBody());
Assert.assertTrue(_isVersionArchiveInDeployedLocation(version.getArchive().getHash()));
}

Expand Down
30 changes: 15 additions & 15 deletions build-tools/test/com/openmeap/admin/web/AdminTestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
import java.util.Map;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import com.openmeap.util.HttpResponse;
import org.junit.Assert;
import org.springframework.context.support.ClassPathXmlApplicationContext;

Expand All @@ -45,19 +44,20 @@
import com.openmeap.model.dto.Deployment;
import com.openmeap.model.dto.GlobalSettings;
import com.openmeap.util.FileHandlingHttpRequestExecuterImpl;
import com.openmeap.util.HttpRequestException;
import com.openmeap.util.HttpRequestExecuter;
import com.openmeap.web.form.ParameterMapBuilder;
import com.openmeap.web.form.ParameterMapBuilderException;

public class AdminTestHelper {

private String adminUrl = "http://localhost:7000/openmeap-admin-web/interface/";
private String adminUrl = "http://localhost:8080/openmeap-admin-web/interface/";
private HttpRequestExecuter requestExecuter;
private ParameterMapBuilder paramsBuilder;
private ClassPathXmlApplicationContext persistenceBeans;

public AdminTestHelper() {
requestExecuter = new FileHandlingHttpRequestExecuterImpl();
requestExecuter = (HttpRequestExecuter) new FileHandlingHttpRequestExecuterImpl();
paramsBuilder = new ParameterMapBuilder();
}

Expand Down Expand Up @@ -86,11 +86,11 @@ public ModelManager getModelManager() {
* Login
*/

public HttpResponse getLogin() throws ClientProtocolException, IOException {
public HttpResponse getLogin() throws HttpRequestException {
return requestExecuter.get(adminUrl);
}

public HttpResponse postLogin(String userName, String password) throws ClientProtocolException, IOException {
public HttpResponse postLogin(String userName, String password) throws HttpRequestException {
Map<String,Object> postData = new HashMap<String,Object>();
postData.put("j_username", userName);
postData.put("j_password", password);
Expand All @@ -101,7 +101,7 @@ public HttpResponse postLogin(String userName, String password) throws ClientPro
* Application Add/Modify
*/

public HttpResponse getAddModifyAppPage(Application application) throws ClientProtocolException, IOException {
public HttpResponse getAddModifyAppPage(Application application) throws HttpRequestException {
Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APP_ADDMODIFY);
if(application!=null && application.getPk()!=null) {
Expand All @@ -110,7 +110,7 @@ public HttpResponse getAddModifyAppPage(Application application) throws ClientPr
return requestExecuter.get(adminUrl,getData);
}

public HttpResponse postAddModifyApp(Application application) throws ClientProtocolException, IOException, ParameterMapBuilderException {
public HttpResponse postAddModifyApp(Application application) throws HttpRequestException, ParameterMapBuilderException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APP_ADDMODIFY);
Expand All @@ -127,7 +127,7 @@ public HttpResponse postAddModifyApp(Application application) throws ClientProto
return requestExecuter.postData(adminUrl,getData,postData);
}

public HttpResponse postAddModifyApp_delete(Application application) throws ParameterMapBuilderException, ClientProtocolException, IOException {
public HttpResponse postAddModifyApp_delete(Application application) throws HttpRequestException, ParameterMapBuilderException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APP_ADDMODIFY);
Expand All @@ -150,15 +150,15 @@ public HttpResponse postAddModifyApp_delete(Application application) throws Para
* APPLICATiON VERSIONs
*/

public HttpResponse getAddModifyAppVer(Application application) throws ClientProtocolException, IOException {
public HttpResponse getAddModifyAppVer(Application application) throws HttpRequestException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APPVER_ADDMODIFY);
getData.put(FormConstants.APP_ID, application.getPk().toString());
return requestExecuter.get(adminUrl,getData);
}

public HttpResponse postAddModifyAppVer(ApplicationVersion appVer, File uploadArchive) throws ClientProtocolException, IOException, ParameterMapBuilderException {
public HttpResponse postAddModifyAppVer(ApplicationVersion appVer, File uploadArchive) throws HttpRequestException, ParameterMapBuilderException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APPVER_ADDMODIFY);
Expand All @@ -176,7 +176,7 @@ public HttpResponse postAddModifyAppVer(ApplicationVersion appVer, File uploadAr
return requestExecuter.postData(adminUrl,getData,postData);
}

public HttpResponse postAddModifyAppVer_delete(ApplicationVersion appVer) throws ClientProtocolException, IOException, ParameterMapBuilderException {
public HttpResponse postAddModifyAppVer_delete(ApplicationVersion appVer) throws HttpRequestException, ParameterMapBuilderException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APPVER_ADDMODIFY);
Expand All @@ -203,7 +203,7 @@ public HttpResponse postAddModifyAppVer_delete(ApplicationVersion appVer) throws
* DEPLOYMENTS
*/

public HttpResponse postCreateDeployment(ApplicationVersion appVer, Deployment.Type deplType) throws ClientProtocolException, IOException {
public HttpResponse postCreateDeployment(ApplicationVersion appVer, Deployment.Type deplType) throws HttpRequestException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_DEPLOYMENTS);
Expand All @@ -221,13 +221,13 @@ public HttpResponse postCreateDeployment(ApplicationVersion appVer, Deployment.T
* GLOBAL SETTINGS
*/

public HttpResponse getGlobalSettings() throws ClientProtocolException, IOException {
public HttpResponse getGlobalSettings() throws HttpRequestException {
Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_GLOBAL_SETTINGS);
return requestExecuter.get(adminUrl,getData);
}

public HttpResponse postGlobalSettings(GlobalSettings settings) throws ClientProtocolException, IOException, ParameterMapBuilderException {
public HttpResponse postGlobalSettings(GlobalSettings settings) throws HttpRequestException, ParameterMapBuilderException {

Map<String,Object> getData = new HashMap<String,Object>();
getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_GLOBAL_SETTINGS);
Expand Down
Empty file.
1 change: 1 addition & 0 deletions java-shared/openmeap-shared-jdk5/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=*"/>
<classpathentry combineaccessrules="false" kind="src" path="/openmeap-shared"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="bin"/>
</classpath>
13 changes: 13 additions & 0 deletions java-shared/openmeap-shared-jdk5/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="openmeap-shared-jdk5">
<wb-resource deploy-path="/" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/test"/>
</wb-module>
</project-modules>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.utility"/>
<fixed facet="java"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>
3 changes: 3 additions & 0 deletions java-shared/openmeap-shared-jdk5/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
package com.openmeap.event;


abstract public class AbstractEvent implements Event {
@SuppressWarnings("serial")
abstract public class AbstractEvent<T> implements Event<T> {

private Object payload = null;
private T payload = null;

public AbstractEvent(Object payload) {
public AbstractEvent(T payload) {
setPayload(payload);
}
public void setPayload(Object object) {
public void setPayload(T object) {
payload = object;
}
public Object getPayload() {
public T getPayload() {
return payload;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import java.io.Serializable;

public interface Event extends Serializable {
void setPayload(Object object);
Object getPayload();
public interface Event<T> extends Serializable {
void setPayload(T object);
T getPayload();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

package com.openmeap.event;

public interface EventHandler {
void handle(Event event) throws EventHandlingException;
public interface EventHandler<T> {
<E extends Event<T>> void handle(E event) throws EventHandlingException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@

import java.util.List;

public interface EventNotifier {
/**
*
* @param event
* @param events a List of ProcessingEvent objects
* @throws EventNotificationException
*/
void notify(Event event, List events) throws EventNotificationException;
public interface EventNotifier<T> {
<E extends Event<T>> void notify(E event, List<ProcessingEvent> events) throws EventNotificationException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package com.openmeap.event;


public interface ProcessingEvent extends Event {
public interface ProcessingEvent<T> extends Event<T> {
void setTargets(String[] processTargets);
String[] getTargets();
}
Expand Down
Loading

0 comments on commit 105a2d9

Please sign in to comment.