use of org.structr.core.property.PropertyMap in project structr by structr.
the class GeoTest method createTestNode.
protected <T extends AbstractNode> T createTestNode(final Class<T> type, final String name) throws FrameworkException {
final PropertyMap map = new PropertyMap();
map.put(AbstractNode.name, name);
return (T) createTestNode(type, map);
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SSHTest method createFTPFile.
protected File createFTPFile(final String path, final String name) throws FrameworkException {
PropertyMap props = new PropertyMap();
props.put(StructrApp.key(File.class, "name"), name);
props.put(StructrApp.key(File.class, "size"), 0L);
props.put(StructrApp.key(File.class, "owner"), ftpUser);
File file = (File) createTestNodes(File.class, 1, props).get(0);
if (StringUtils.isNotBlank(path)) {
AbstractFile parent = FileHelper.getFileByAbsolutePath(securityContext, path);
if (parent != null && parent instanceof Folder) {
Folder parentFolder = (Folder) parent;
file.setParent(parentFolder);
}
}
logger.info("FTP file {} created successfully.", file);
return file;
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SSHTest method createFTPDirectory.
protected Folder createFTPDirectory(final String path, final String name) throws FrameworkException {
PropertyMap props = new PropertyMap();
props.put(Folder.name, name);
props.put(Folder.owner, ftpUser);
Folder dir = (Folder) createTestNodes(Folder.class, 1, props).get(0);
if (StringUtils.isNotBlank(path)) {
AbstractFile parent = FileHelper.getFileByAbsolutePath(securityContext, path);
if (parent != null && parent instanceof Folder) {
Folder parentFolder = (Folder) parent;
dir.setParent(parentFolder);
}
}
logger.info("FTP directory {} created successfully.", dir);
return dir;
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class SSHTest method createFTPUser.
protected User createFTPUser(final String username, final String password) throws FrameworkException {
PropertyMap props = new PropertyMap();
props.put(StructrApp.key(Principal.class, "name"), username);
props.put(StructrApp.key(Principal.class, "password"), password);
return (User) createTestNodes(User.class, 1, props).get(0);
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class StructrDataFeedsModuleTest method createTestNodes.
protected <T extends AbstractNode> List<T> createTestNodes(final Class<T> type, final int number, final long delay) throws FrameworkException {
try (final Tx tx = app.tx()) {
final PropertyMap properties = new PropertyMap();
final List<T> nodes = new LinkedList<>();
properties.put(NodeInterface.visibleToAuthenticatedUsers, false);
properties.put(NodeInterface.visibleToPublicUsers, false);
properties.put(NodeInterface.deleted, false);
properties.put(NodeInterface.hidden, false);
for (int i = 0; i < number; i++) {
nodes.add(app.create(type, properties));
try {
Thread.sleep(delay);
} catch (InterruptedException ex) {
}
}
tx.success();
return nodes;
} catch (Throwable t) {
logger.warn("", t);
}
return null;
}
Aggregations