CCM NG: Test for the module system
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3598 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
1c7a7af8cb
commit
c9da290b9f
|
|
@ -25,6 +25,8 @@ import org.libreccm.core.modules.Module;
|
||||||
import org.libreccm.core.modules.ShutdownEvent;
|
import org.libreccm.core.modules.ShutdownEvent;
|
||||||
import org.libreccm.core.modules.UnInstallEvent;
|
import org.libreccm.core.modules.UnInstallEvent;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -49,7 +51,19 @@ public class CcmCore implements CcmModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void install(final InstallEvent event) {
|
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
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -151,8 +151,9 @@ public class CcmIntegrator implements Integrator {
|
||||||
final Statement statement = connection.createStatement();
|
final Statement statement = connection.createStatement();
|
||||||
statement.execute(String.format(
|
statement.execute(String.format(
|
||||||
"INSERT INTO flyhydra_core.installed_modules "
|
"INSERT INTO flyhydra_core.installed_modules "
|
||||||
+ "(module_class_name, status) "
|
+ "(module_id, module_class_name, status) "
|
||||||
+ "VALUES ('%s', 'NEW')",
|
+ "VALUES (%d, %s', 'NEW')",
|
||||||
|
module.getName().hashCode(),
|
||||||
module.getName()));
|
module.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class InstalledModule implements Serializable {
|
||||||
@Column(name = "module_class_name", length = 2048, unique = true)
|
@Column(name = "module_class_name", length = 2048, unique = true)
|
||||||
private String moduleClassName;
|
private String moduleClassName;
|
||||||
|
|
||||||
@Column
|
@Column(name = "status")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private ModuleStatus status;
|
private ModuleStatus status;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
|
|
@ -106,8 +105,8 @@ public class CcmObjectRepositoryTest {
|
||||||
|
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war").
|
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war")
|
||||||
addPackages(false, CcmObject.class.getPackage())
|
.addPackage(CcmObject.class.getPackage())
|
||||||
.addPackage(org.libreccm.web.Application.class.getPackage())
|
.addPackage(org.libreccm.web.Application.class.getPackage())
|
||||||
.addPackage(org.libreccm.categorization.Category.class.
|
.addPackage(org.libreccm.categorization.Category.class.
|
||||||
getPackage())
|
getPackage())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue