use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestAddExtendedData method start.
private void start() {
try {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
SFile file = new SFile();
file.setData("test".getBytes(Charsets.UTF_8));
file.setMime("text");
file.setFilename("test.txt");
long fileId = client.getServiceInterface().uploadFile(file);
System.out.println(client.getServiceInterface().getFile(fileId));
SProject project = client.getServiceInterface().addProject("test23", "ifc2x3tc1");
SDeserializerPluginConfiguration deserializerForExtension = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
client.checkin(project.getOid(), "initial", deserializerForExtension.getOid(), false, Flow.SYNC, Paths.get("../TestData/data/AC11-FZK-Haus-IFC.ifc"));
project = client.getServiceInterface().getProjectByPoid(project.getOid());
SExtendedDataSchema extendedDataSchemaByNamespace = client.getServiceInterface().getExtendedDataSchemaByName("http://extend.bimserver.org/validationreport");
SExtendedData extendedData = new SExtendedData();
extendedData.setFileId(fileId);
extendedData.setTitle("test3");
extendedData.setSchemaId(extendedDataSchemaByNamespace.getOid());
client.getServiceInterface().addExtendedDataToRevision(project.getLastRevisionId(), extendedData);
} catch (ServiceException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestChangeDescription method start.
private void start() {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
try {
SProject project = client.getServiceInterface().getProjectsByName("dfgfgdf").get(0);
IfcModelInterface model = client.getModel(project, project.getLastRevisionId(), false, true);
for (IfcWall wall : model.getAllWithSubTypes(IfcWall.class)) {
wall.setDescription(wall.getDescription() + " Changed");
}
model.commit("test");
} catch (UserException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestChangeWrappedValue method start.
private void start() {
try {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
long poid = 2686977;
long roid = 720899;
SProject project = client.getServiceInterface().getProjectByPoid(poid);
IfcModelInterface model = client.getModel(project, roid, true, false);
for (IfcPropertySingleValue prop : model.getAll(IfcPropertySingleValue.class)) {
// IfcValue value = ((IfcPropertySingleValue) prop).getNominalValue();
// if(value instanceof IfcLabel){
// System.out.println(prop.getOid() + " is " + ((IfcLabel) value).getWrappedValue() );
// ((IfcLabel) value).setWrappedValue(((IfcLabel) value).getWrappedValue() + " changed");
// }
IfcLabel label = model.create(IfcLabel.class);
label.setWrappedValue("blabla");
prop.setNominalValue(label);
}
model.commit("blaat");
} catch (ServiceException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (IfcModelInterfaceException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestDownloadBinaryGeometrySimultanous method start.
private void start() {
try {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
final SSerializerPluginConfiguration serializer = client.getServiceInterface().getSerializerByName("BinaryGeometrySerializer");
SProject project = client.getServiceInterface().getProjectByPoid(131073L);
for (int i = 0; i < 10; i++) {
Thread.sleep(200);
new Runner(client, serializer, project, i).start();
}
} catch (ServiceException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestManyUsersAndLogin method start.
private void start() {
try {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
int nrUsers = 10000;
long totalTimeAdding = 0;
List<Long> userIds = new ArrayList<>();
for (int i = 0; i < nrUsers; i++) {
long s = System.nanoTime();
try {
SUser user = client.getServiceInterface().addUserWithPassword("test" + i + "@bimserver.org", "password", "Test " + i, SUserType.USER, true, "");
userIds.add(user.getOid());
} catch (Exception e) {
}
long e = System.nanoTime();
totalTimeAdding += (e - s);
if (i % 100 == 0) {
System.out.println((totalTimeAdding / 1000000) + " ms for 100 users");
totalTimeAdding = 0;
}
}
long totalLoginTime = 0;
int nrProjects = 10000;
totalTimeAdding = 0;
List<Long> projectIds = new ArrayList<>();
for (int i = 0; i < nrProjects; i++) {
long s = System.nanoTime();
try {
SProject project = client.getServiceInterface().addProject("test" + i, "ifc2x3tc1");
projectIds.add(project.getOid());
} catch (Exception e) {
}
long e = System.nanoTime();
totalTimeAdding += (e - s);
if (i % 100 == 0) {
System.out.println((totalTimeAdding / 1000000) + " ms for 100 projects");
totalTimeAdding = 0;
}
}
int nrProjectUserLinks = 100000;
Random random = new Random();
totalTimeAdding = 0;
for (int i = 0; i < nrProjectUserLinks; i++) {
long s = System.nanoTime();
client.getServiceInterface().addUserToProject(userIds.get(random.nextInt(userIds.size())), projectIds.get(random.nextInt(projectIds.size())));
long e = System.nanoTime();
totalTimeAdding += (e - s);
if (i % 100 == 0) {
System.out.println((totalTimeAdding / 1000000) + " ms for 100 projects/user links");
totalTimeAdding = 0;
}
}
int loginAttempts = 100;
for (int i = 0; i < loginAttempts; i++) {
long s = System.nanoTime();
client.getAuthInterface().login("test" + new Random().nextInt(nrUsers) + "@bimserver.org", "password");
long e = System.nanoTime();
totalLoginTime += (e - s);
}
System.out.println("Average login time with " + nrUsers + " users in system: " + ((((totalLoginTime / loginAttempts) / 1000000) + " ms")));
} catch (ServiceException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
}
}
Aggregations