use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.
the class TestGetProperties method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/AC9R1-Haus-G-H-Ver2-2x3.ifc");
SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, new CheckinProgressHandler() {
@Override
public void progress(String title, int progress) {
System.out.println(title + ": " + progress);
}
});
ClientIfcModel model = client.getModel(project, actionState.getRoid(), false, false);
for (IfcWall wall : model.getAllWithSubTypes(IfcWall.class)) {
String layerName = IfcUtils.getStringProperty(wall, "Layername");
Assert.assertNotNull(layerName);
Assert.assertFalse(layerName.isEmpty());
}
}
}
Thread.sleep(1000);
}
use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.
the class TestIfc4TwoDimensional3 method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc4");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/ifc4add2tc1/slab-standard-case.ifc");
SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
ClientIfcModel model = client.getModel(project, actionState.getRoid(), true, false);
List<IfcIndexedPolyCurve> polyCurves = model.getAll(IfcIndexedPolyCurve.class);
Assert.assertEquals(1, polyCurves.size());
for (IfcIndexedPolyCurve ifcIndexedPolyCurve : polyCurves) {
EList<IfcSegmentIndexSelect> segments = ifcIndexedPolyCurve.getSegments();
Assert.assertEquals(4, segments.size());
for (IfcSegmentIndexSelect ifcSegmentIndexSelect : segments) {
if (ifcSegmentIndexSelect instanceof IfcLineIndex) {
Assert.assertEquals(2, ((IfcLineIndex) ifcSegmentIndexSelect).getWrappedValue().size());
} else if (ifcSegmentIndexSelect instanceof IfcArcIndex) {
Assert.assertEquals(3, ((IfcArcIndex) ifcSegmentIndexSelect).getWrappedValue().size());
}
}
}
}
Thread.sleep(500);
}
}
use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.
the class TestCopy method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/export1.ifc");
SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
long roid = actionState.getRoid();
client.getServiceInterface().clone(roid, "Clone-" + RandomStringUtils.randomAlphabetic(10), "Cloned", true);
}
}
Thread.sleep(1000);
}
use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.
the class TestDeserializerErrorCode2 method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc2x3tc1");
Path path = Paths.get("../../TestFiles/TestData/data/ADT-FZK-Haus-2005-2006.ifc");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
SLongCheckinActionState checkinSync = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, new CheckinProgressHandler() {
@Override
public void progress(String title, int progress) {
System.out.println(title + ": " + progress);
}
});
Assert.assertEquals(DeserializerErrorCode.IFC_SCHEMA_NOT_SUPPORTED_BY_DESERIALIZER, ErrorCode.fromCode(checkinSync.getDeserializeErrorCode()));
}
}
}
use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.
the class TestIfc4TwoDimensional2 method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc4");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/ifc4add2tc1/basin-advanced-brep.ifc");
SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
ClientIfcModel model = client.getModel(project, actionState.getRoid(), true, false);
List<IfcBSplineCurveWithKnots> bSplineCurves = model.getAll(IfcBSplineCurveWithKnots.class);
Assert.assertEquals(4, bSplineCurves.size());
for (IfcBSplineCurveWithKnots bSplineCurve : bSplineCurves) {
Assert.assertEquals(7, bSplineCurve.getControlPointsList().size());
for (org.bimserver.models.ifc4.IfcCartesianPoint point : bSplineCurve.getControlPointsList()) {
Assert.assertNotNull(point);
Assert.assertTrue(point.getCoordinates().size() == 2 || point.getCoordinates().size() == 3);
}
}
List<IfcBSplineSurfaceWithKnots> bSplineSurfaces = model.getAll(IfcBSplineSurfaceWithKnots.class);
Assert.assertEquals(2, bSplineSurfaces.size());
for (IfcBSplineSurfaceWithKnots bSplineSurface : bSplineSurfaces) {
Assert.assertEquals(4, bSplineSurface.getControlPointsList().size());
for (ListOfIfcCartesianPoint pointList : bSplineSurface.getControlPointsList()) {
// This assertion fails, error seems to be in client.
// 1st pointlist is of size 1, 2nd of size 2 and so on
// with duplication of the first point's coordinates
Assert.assertEquals(7, pointList.getList().size());
for (IfcCartesianPoint point : pointList.getList()) {
Assert.assertNotNull(point);
Assert.assertEquals(3, point.getCoordinates().size());
}
}
}
}
Thread.sleep(500);
}
}
Aggregations