use of com.enonic.xp.repository.Repository in project xp by enonic.
the class ProjectServiceImplTest method create_with_data.
@Test
void create_with_data() {
final RepositoryId projectRepoId = RepositoryId.from("com.enonic.cms.test-project");
final String displayName = "test display name";
final String description = "test description";
final PropertyTree data = new PropertyTree();
final PropertySet projectData = data.addSet(ProjectConstants.PROJECT_DATA_SET_NAME);
projectData.setString(ProjectConstants.PROJECT_DISPLAY_NAME_PROPERTY, displayName);
projectData.setString(ProjectConstants.PROJECT_DESCRIPTION_PROPERTY, description);
adminContext().callWith(() -> doCreateProject(ProjectName.from(projectRepoId), displayName, description));
adminContext().runWith(() -> {
final Repository projectRepo = repositoryService.get(projectRepoId);
assertEquals(data, projectRepo.getData());
});
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class ImportRunnableTask method initializeStoredRepositories.
private void initializeStoredRepositories() {
this.repositoryService.invalidateAll();
for (Repository repository : repositoryService.list()) {
if (!this.nodeRepositoryService.isInitialized(repository.getId())) {
final CreateRepositoryParams createRepositoryParams = CreateRepositoryParams.create().repositoryId(repository.getId()).repositorySettings(repository.getSettings()).data(repository.getData()).build();
this.nodeRepositoryService.create(createRepositoryParams);
}
}
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class CreateRepositoryHandler method execute.
public RepositoryMapper execute() {
final RepositorySettings repositorySettings = RepositorySettings.create().indexDefinitions(indexDefinitions).build();
final CreateRepositoryParams createRepositoryParams = CreateRepositoryParams.create().repositoryId(repositoryId).repositorySettings(repositorySettings).rootPermissions(rootPermissions).rootChildOrder(rootChildOrder).build();
final Repository repository = repositoryServiceSupplier.get().createRepository(createRepositoryParams);
return repository == null ? null : new RepositoryMapper(repository);
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class ListRepositoriesScriptTest method initialize.
@Override
public void initialize() throws Exception {
super.initialize();
repositoryService = Mockito.mock(RepositoryService.class);
Mockito.when(repositoryService.list()).thenAnswer(invocation -> {
final Repository testRepository = Repository.create().id(RepositoryId.from("test-repo")).branches(Branches.from(RepositoryConstants.MASTER_BRANCH)).build();
final Repository anotherRepository = Repository.create().id(RepositoryId.from("another-repo")).branches(Branches.from(RepositoryConstants.MASTER_BRANCH)).build();
return Repositories.from(testRepository, anotherRepository);
});
addService(RepositoryService.class, repositoryService);
}
use of com.enonic.xp.repository.Repository in project xp by enonic.
the class LoadRunnableTask method doLoadFromExport.
private SystemLoadResultJson doLoadFromExport(final Path rootDir) {
final SystemLoadResult.Builder builder = SystemLoadResult.create();
final Repositories repositories = repositoryService.list();
final long branchesCount = repositories.stream().flatMap(repository -> repository.getBranches().stream()).count();
loadDumpListener.totalBranches(branchesCount);
builder.add(importSystemRepo(rootDir));
this.repositoryService.invalidateAll();
for (Repository repository : repositories) {
initializeRepo(repository);
builder.add(importRepoBranches(rootDir, repository));
}
return SystemLoadResultJson.from(builder.build());
}
Aggregations