Skip to content

Commit

Permalink
create 2.0.x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Sep 27, 2019
1 parent 7f9a004 commit 4ea3de6
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 15 deletions.
11 changes: 8 additions & 3 deletions pom.xml
Expand Up @@ -6,12 +6,12 @@
<artifactId>appng-manager</artifactId>
<packaging>jar</packaging>
<name>appNG Manager</name>
<version>1.16.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<description><![CDATA[Global appNG administration]]></description>
<url>https://appng.org</url>

<properties>
<appNG.version>${project.parent.version}</appNG.version>
<appNG.version>2.0.0-SNAPSHOT</appNG.version>
<projectId>MGR</projectId>
<displayName>Manager</displayName>
<longDescription><![CDATA[The Manager is the global administration frontend for appNG. This contains dialogs for administrating users, groups, roles and permissions as well as administration of sites, application, properties and repositories.]]></longDescription>
Expand Down Expand Up @@ -357,11 +357,16 @@
<groupId>org.appng</groupId>
<artifactId>appng-core</artifactId>
</dependency>
<dependency>
<groupId>org.appng</groupId>
<artifactId>appng-appngizer-jaxb</artifactId>
<version>${appNG.version}</version>
</dependency>
<dependency>
<groupId>org.appng</groupId>
<artifactId>appng-testsupport</artifactId>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
Expand Up @@ -33,7 +33,6 @@
import org.appng.core.domain.PropertyImpl;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;

Expand All @@ -43,7 +42,6 @@
* Provides CRUD-operations for a {@link PropertyImpl}.
*
* @author Matthias Müller
*
*/

@Slf4j
Expand Down Expand Up @@ -73,11 +71,7 @@ public DataContainer getData(Site site, Application application, Environment env
} else {
@SuppressWarnings("unchecked")
Page<PropertyImpl> page = (Page<PropertyImpl>) data.getPage();
data.setPage(page.map(new Converter<PropertyImpl, PropertyWrapper>() {
public PropertyWrapper convert(PropertyImpl p) {
return new PropertyWrapper(p);
}
}));
data.setPage(page.map(p -> new PropertyWrapper(p)));
}
} catch (BusinessException ex) {
String message = request.getMessage(ex.getMessageKey(), ex.getMessageArgs());
Expand Down
Expand Up @@ -108,7 +108,6 @@
import org.appng.core.model.RepositoryUtils;
import org.appng.core.service.CoreService;
import org.appng.core.service.InitializerService;
import org.appng.core.service.MigrationService;
import org.appng.core.service.MigrationService.MigrationStatus;
import org.appng.core.service.PropertySupport;
import org.appng.core.xml.repository.PackageVersions;
Expand Down Expand Up @@ -1762,7 +1761,7 @@ public List<Selection> getGrantedSelections(Integer siteId, Integer appId) {
public void grantSites(Integer siteId, Integer appId, Set<Integer> grantedSiteIds) {
SiteApplication siteApplication = getSiteApplication(siteId, appId);
siteApplication.getGrantedSites().clear();
List<SiteImpl> sites = siteRepository.findAll(grantedSiteIds);
List<SiteImpl> sites = siteRepository.findAllById(grantedSiteIds);
siteApplication.getGrantedSites().addAll(sites);
}

Expand Down
Expand Up @@ -45,8 +45,8 @@
import org.springframework.test.context.ContextConfiguration;

@Ignore
@ContextConfiguration(locations = { TestBase.TESTCONTEXT_CORE, TestBase.TESTCONTEXT_JPA }, initializers = AbstractTest.class)
public class AbstractTest extends TestBase {
@ContextConfiguration(classes = ManagerTestConfig.class, initializers = AbstractTest.class)
public class AbstractTest extends TestBase /* implements PropertySourceFactory */ {

@Autowired
SiteRepository siteRepository;
Expand Down Expand Up @@ -77,6 +77,10 @@ public class AbstractTest extends TestBase {
WritingXmlValidator.writeXml = false;
}

// public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
// return new PropertiesPropertySource("testconfig", getProperties());
// }

protected AbstractTest() {
super("appng-manager", APPLICATION_HOME);
setUseFullClassname(false);
Expand Down Expand Up @@ -110,6 +114,7 @@ protected Properties getProperties() {
Properties properties = super.getProperties();
properties.put("hibernate.show_sql", "false");
properties.put("hibernate.format_sql", "false");
properties.put("platform.sharedSecret", "42");
return properties;
}

Expand Down
Expand Up @@ -20,7 +20,7 @@
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;

@ContextConfiguration(locations = { "classpath:/beans-test.xml" })
//@ContextConfiguration(locations = { "classpath:/beans-test.xml" })
public class DataBaseConnectionsTest extends AbstractTest {

static {
Expand Down
@@ -0,0 +1,82 @@
package org.appng.application.manager.business;

import javax.sql.DataSource;

import org.appng.core.domain.PlatformEventListener;
import org.appng.core.service.CoreService;
import org.appng.core.service.DatabaseService;
import org.appng.core.service.InitializerService;
import org.appng.core.service.LdapService;
import org.appng.core.service.TemplateService;
import org.appng.persistence.ApplicationConfigJPA;
import org.appng.persistence.repository.SearchRepositoryImpl;
import org.appng.testsupport.ApplicationTestConfig;
import org.appng.testsupport.TestBase;
import org.appng.testsupport.persistence.ApplicationConfigDataSource;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;

@ImportResource(TestBase.BEANS_PATH)
@Configuration
@Import({ ApplicationConfigJPA.class, ApplicationTestConfig.class })
@EnableJpaRepositories(basePackages = "org.appng.core.repository", repositoryBaseClass = SearchRepositoryImpl.class)
public class ManagerTestConfig extends ApplicationConfigDataSource {

@Bean
@Primary
@Override
@Qualifier("dataSource")
public FactoryBean<DataSource> datasource(String database) {
return super.datasource("appng-manager");
}

@Bean
public DatabasePopulator databasePopulator(DataSource dataSource) {
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
databasePopulator.addScript(new ClassPathResource("sql/testdata.sql"));
DatabasePopulatorUtils.execute(databasePopulator, dataSource);
return databasePopulator;
}

@Bean
public PlatformEventListener platformEventListener() {
return new PlatformEventListener();
}

@Bean
public DatabaseService databaseService() {
return new DatabaseService();
}

@Bean
public LdapService ldapService() {
return new LdapService();
}

@Bean
public CoreService coreService() {
return new CoreService();
}

@Bean
public InitializerService initializerService() {
return new InitializerService();
}

@Bean
public TemplateService templateService() {
return new TemplateService();
}

}

0 comments on commit 4ea3de6

Please sign in to comment.