Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading of taxonomies #378

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading