本文整理汇总了Java中play.libs.Yaml类的典型用法代码示例。如果您正苦于以下问题:Java Yaml类的具体用法?Java Yaml怎么用?Java Yaml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Yaml类属于play.libs包,在下文中一共展示了Yaml类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import play.libs.Yaml; //导入依赖的package包/类
public void onStart(Application app) {
super.onStart(app);
String info = buildinfo.BuildInfo.toString();
String datasource = PoseidonPropertyService.getDefaultDatasource();
String dburl = PoseidonPropertyService.getProperty("db." + datasource + ".url");
//noinspection unchecked
Map<String, List<Object>> data = (Map<String, List<Object>>) Yaml.load("initialdata.yml");
Map<String, List<Object>> qubadata = (Map<String, List<Object>>) Yaml.load("qubadata.yml");
Map<String, List<Object>> kundedbdata = (Map<String, List<Object>>) Yaml.load("kundedbdata.yml");
Map<String, List<Object>> distdbdata = (Map<String, List<Object>>) Yaml.load("distdbdata.yml");
loadInitConfig(data);
if (dburl != null && dburl.contains("h2:mem")) {
loadPoseidonTestData(data);
loadQubaTestData(qubadata);
loadDistdbTestData(distdbdata);
loadKundedbTestData(kundedbdata);
} else {
logger.info(info + " is starting...");
AkkaStartUp.startup(app);
}
}
示例2: onStart
import play.libs.Yaml; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onStart(Application app) {
/*
* Speichere YAML-Daten in die DB beim Applikationsstart, falls
* Applikation sich nicht im Testmodus befindet. Applikation ist u.a. im
* Testmodus, wenn die JUnit-Tests ausgeführt werden. Siehe
* FakeApplication in BaseModelTest.
*/
if (!app.isTest() && Point.findByAll().isEmpty()) {
LinkedHashMap<String, List<Object>> map = (LinkedHashMap<String, List<Object>>) Yaml
.load("initial-data.yml");
Ebean.save(map.get("points"));
Ebean.save(map.get("paths"));
Ebean.save(map.get("playgrounds"));
}
}
示例3: i_have_a_list_of_Target_result_on_view
import play.libs.Yaml; //导入依赖的package包/类
@Given("^I have a list of Target result on view$")
public void i_have_a_list_of_Target_result_on_view() throws Throwable {
running(fakeApplication(inMemoryDatabase()), new Runnable() {
@Override
public void run() {
Map<String,List<Target>> allTargets = (Map<String,List<Target>>)Yaml.load("testdata-targets.yml");
targets = allTargets.get("targets");
Logger.debug("targets: " + targets);
}
});
}
示例4: insert
import play.libs.Yaml; //导入依赖的package包/类
public static void insert(Application app) {
if (Ebean.find(User.class).findRowCount() == 0) {
@SuppressWarnings("unchecked")
Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml
.load("initial-data.yml");
// Insert devices
Ebean.save(all.get("devices"));
// Insert users
Ebean.save(all.get("users"));
// Insert users*-*devices
for (Object usersDevices : all.get("usersDevices")) {
@SuppressWarnings("unchecked")
Map<String, Object> usersDevicesMap = (Map<String, Object>) usersDevices;
User user = User.find.byId(Long
.valueOf((Integer) usersDevicesMap.get("userId")));
@SuppressWarnings("unchecked")
List<Object> devicesIds = (List<Object>) usersDevicesMap
.get("devicesIds");
for (Object deviceId : devicesIds) {
Device device = Device.find.byId(Long
.valueOf((Integer) deviceId));
user.devices.add(device);
}
user.saveManyToManyAssociations("devices");
}
}
}
示例5: startApp
import play.libs.Yaml; //导入依赖的package包/类
@BeforeClass
public static void startApp() {
app = fakeApplication(inMemoryDatabase());
start(app);
// We have to delete the default user
User.find.byId(1l).delete();
//We load the mock datas
Ebean.save((List) Yaml.load("test-data.yml"));
}
示例6: loadYamlDataFile
import play.libs.Yaml; //导入依赖的package包/类
/**
* Lädt conf/test-data.yml. Test funktioniert nicht in Eclipse-IDE, aber in
* play-console!
*/
@SuppressWarnings("unchecked")
@BeforeClass
public static void loadYamlDataFile() {
yamlData = (LinkedHashMap<String, List<Object>>) Yaml
.load("test-data.yml");
}
示例7: loadModelData
import play.libs.Yaml; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void loadModelData(Application app) {
LinkedHashMap<String, List<Object>> map = null;
/*
* If the application is not in test mode (DEV (play run) or PROD (play
* start|stage)) and test data do not exist load model by
* conf/initial-data.yml.
*/
if (PlaygroundService.getAllPlaygroundNames().size() == 0) {
if (!app.isTest()) {
Logger.info("Loading YAML test data from conf/initial-data.yml.");
map = (LinkedHashMap<String, List<Object>>) Yaml
.load("initial-data.yml");
Ebean.save(map.get("actions"));
Ebean.save(map.get("points"));
Ebean.save(map.get("paths"));
Ebean.save(map.get("playgrounds"));
}
/*
* If the application is in test mode and test data does not exist
* load model by conf/test-data.yml.
*/
if (app.isTest() && UserService.findUser("stefan") == null) {
Logger.info("Loading YAML test data from conf/test-data.yml.");
map = (LinkedHashMap<String, List<Object>>) Yaml
.load("test-data.yml");
Ebean.save(map.get("actions"));
Ebean.save(map.get("points"));
Ebean.save(map.get("paths"));
Ebean.save(map.get("playgrounds"));
Ebean.save(map.get("users"));
Ebean.save(map.get("games"));
}
}
}