Skip to content

Commit

Permalink
fix loading of taxonomies
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Marx committed Jan 15, 2025
1 parent 0d9e5c7 commit e36e77f
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 25 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public void reload () {

private void loadValues(Taxonomy taxonomy) {
try {
var yamlFile = "configs/taxonomy.%s.yaml".formatted(taxonomy.getSlug());
var tomlFile = "configs/taxonomy.%s.toml".formatted(taxonomy.getSlug());
var yamlFile = "config/taxonomy.%s.yaml".formatted(taxonomy.getSlug());
var tomlFile = "config/taxonomy.%s.toml".formatted(taxonomy.getSlug());

var valueSrc = List.of(
YamlConfigSource.build(hostBase.resolve(yamlFile)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public void setup() throws IOException, SchedulerException {
configuration = SimpleConfiguration.builder(eventBus)
.id("test-config")
.reloadStrategy(new CronReload("0/10 * * * * ?", cronScheduler))
.addSource(YamlConfigSource.build(Path.of("configs/server.yaml")))
.addSource(TomlConfigSource.build(Path.of("configs/server.toml")))
.addSource(YamlConfigSource.build(Path.of("config/server.yaml")))
.addSource(TomlConfigSource.build(Path.of("config/server.toml")))
.build();
}

Expand All @@ -99,7 +99,7 @@ public void test_env() {
@Test
public void test_reload () throws InterruptedException, IOException {

FileUtils.touch(Path.of("configs/server.toml"));
FileUtils.touch(Path.of("config/server.toml"));

Thread.sleep(Duration.ofSeconds(20));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.condation.cms.core.configuration.configs.SimpleConfiguration;
import com.condation.cms.core.configuration.source.TomlConfigSource;
import com.condation.cms.core.configuration.source.YamlConfigSource;
import com.condation.cms.api.eventbus.EventBus;
import com.condation.cms.core.configuration.configs.MediaConfiguration;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -55,8 +51,8 @@ public class MediaConfigurationTest {
public void setup() throws IOException, SchedulerException {
configuration = MediaConfiguration.builder(eventBus)
.id("media-config")
.addSource(YamlConfigSource.build(Path.of("configs/media.yaml")))
.addSource(TomlConfigSource.build(Path.of("configs/media.toml")))
.addSource(YamlConfigSource.build(Path.of("config/media.yaml")))
.addSource(TomlConfigSource.build(Path.of("config/media.toml")))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,16 @@
*/

import com.condation.cms.core.configuration.configs.SimpleConfiguration;
import com.condation.cms.core.configuration.source.TomlConfigSource;
import com.condation.cms.core.configuration.source.YamlConfigSource;
import com.condation.cms.api.SiteProperties;
import com.condation.cms.api.eventbus.EventBus;
import com.condation.cms.api.scheduler.CronJobContext;
import com.condation.cms.api.scheduler.CronJobScheduler;
import com.condation.cms.core.configuration.reload.CronReload;
import com.condation.cms.core.configuration.properties.ExtendedSiteProperties;
import com.condation.cms.core.scheduler.SingleCronJobScheduler;
import java.io.IOException;
import java.nio.file.Path;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;

/**
*
Expand All @@ -57,7 +46,7 @@ public class SiteConfigurationTest {

@BeforeEach
public void setup() throws IOException, SchedulerException {
siteConfig = ConfigurationFactory.siteConfiguration("dev", Path.of("configs"));
siteConfig = ConfigurationFactory.siteConfiguration("dev", Path.of("config"));

siteProperties = new ExtendedSiteProperties(siteConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void setup() throws IOException, SchedulerException {
configuration = TaxonomyConfiguration.builder(eventBus)
.id("taxonomy-config")
.hostBase(Path.of("."))
.addSource(YamlConfigSource.build(Path.of("configs/taxonomy.yaml")))
.addSource(TomlConfigSource.build(Path.of("configs/taxonomy.toml")))
.addSource(YamlConfigSource.build(Path.of("config/taxonomy.yaml")))
.addSource(TomlConfigSource.build(Path.of("config/taxonomy.toml")))
.build();
}

Expand Down

0 comments on commit e36e77f

Please sign in to comment.