CCM NG: Test for the module system

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3598 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2015-09-02 18:16:00 +00:00
parent 1c7a7af8cb
commit c9da290b9f
4 changed files with 54 additions and 40 deletions

View File

@ -25,6 +25,8 @@ import org.libreccm.core.modules.Module;
import org.libreccm.core.modules.ShutdownEvent;
import org.libreccm.core.modules.UnInstallEvent;
import javax.persistence.EntityManager;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -49,7 +51,19 @@ public class CcmCore implements CcmModule {
@Override
public void install(final InstallEvent event) {
//Nothing
final EntityManager entityManager = event.getEntityManager();
final User user = new User();
user.setScreenName("public-user");
final PersonName name = new PersonName();
name.setFamilyName("ccm");
name.setGivenName("public user");
user.setName(name);
final EmailAddress email = new EmailAddress();
email.setAddress("public-user@localhost");
user.addEmailAddress(email);
entityManager.persist(user);
}
@Override

View File

@ -151,8 +151,9 @@ public class CcmIntegrator implements Integrator {
final Statement statement = connection.createStatement();
statement.execute(String.format(
"INSERT INTO flyhydra_core.installed_modules "
+ "(module_class_name, status) "
+ "VALUES ('%s', 'NEW')",
+ "(module_id, module_class_name, status) "
+ "VALUES (%d, %s', 'NEW')",
module.getName().hashCode(),
module.getName()));
}
}

View File

@ -52,7 +52,7 @@ public class InstalledModule implements Serializable {
@Column(name = "module_class_name", length = 2048, unique = true)
private String moduleClassName;
@Column
@Column(name = "status")
@Enumerated(EnumType.STRING)
private ModuleStatus status;

View File

@ -18,7 +18,6 @@
*/
package org.libreccm.core;
import static org.hamcrest.CoreMatchers.*;
import org.jboss.arquillian.container.test.api.Deployment;
@ -106,8 +105,8 @@ public class CcmObjectRepositoryTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war").
addPackages(false, CcmObject.class.getPackage())
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war")
.addPackage(CcmObject.class.getPackage())
.addPackage(org.libreccm.web.Application.class.getPackage())
.addPackage(org.libreccm.categorization.Category.class.
getPackage())