All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.regnosys.rosetta.generators.test.TestUtil.xtend Maven / Gradle / Ivy

There is a newer version: 11.22.0
Show newest version
package com.regnosys.rosetta.generators.test

import java.util.List
import java.io.File
import java.nio.file.Files
import com.google.inject.Inject
import com.google.inject.Provider
import org.eclipse.xtext.resource.XtextResourceSet
import com.regnosys.rosetta.tests.util.ModelHelper

class TestUtil {
	
	@Inject
    Provider resourceSetProvider
    
    @Inject
    extension ModelHelper
	
	def getRosettaFileContents(List srcPaths) {
        return srcPaths
        	.map[new File(it)]
        	.flatMap[listFiles[it.name.endsWith('.rosetta')].toList]
        	.map[Files.readAllBytes(toPath)]
        	.map[new String(it)]
        	.toList
	}
	
	def parseAllRosettaFiles(List srcPaths) {
        srcPaths.rosettaFileContents.parseRosetta

        return resourceSetProvider.get
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy