use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class TestCompare method testIfc4Name.
@Test
public void testIfc4Name() {
try {
// Create a new BimServerClient with authentication
BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
// Create a new project
SProject newProject1 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc4");
SProject newProject2 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc4");
// Get the appropriate deserializer
SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", newProject1.getOid());
SSerializerPluginConfiguration serializer = bimServerClient.getServiceInterface().getSerializerByName("Ifc4");
// Checkin the file
bimServerClient.checkinSync(newProject1.getOid(), "test", deserializer.getOid(), false, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_name_rev_1.ifc"));
bimServerClient.checkinSync(newProject2.getOid(), "test", deserializer.getOid(), false, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_name_rev_2.ifc"));
newProject1 = bimServerClient.getServiceInterface().getProjectByPoid(newProject1.getOid());
newProject2 = bimServerClient.getServiceInterface().getProjectByPoid(newProject2.getOid());
SModelComparePluginConfiguration defaultModelCompare = bimServerClient.getPluginInterface().getModelCompareByName("Name based");
bimServerClient.getServiceInterface().compare(newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), SCompareType.ALL, defaultModelCompare.getOid());
long topicId = bimServerClient.getServiceInterface().downloadCompareResults(serializer.getOid(), newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), defaultModelCompare.getOid(), SCompareType.ALL, true);
bimServerClient.saveDownloadData(topicId, Paths.get("tmptestdata/ifc4namecompare.ifc"));
} catch (Throwable e) {
e.printStackTrace();
if (e instanceof AssertionError) {
throw (AssertionError) e;
}
fail(e.getMessage());
}
}
use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.
the class UpdateProject method test.
@Test
public void test() {
try {
// Create a new BimServerClient with authentication
BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
// Create a new project
String originalName = "test " + Math.random();
String newName = "test " + Math.random();
SProject newProject = bimServerClient.getServiceInterface().addProject(originalName, "ifc2x3tc1");
newProject.setName(newName);
bimServerClient.getServiceInterface().updateProject(newProject);
newProject = bimServerClient.getServiceInterface().getProjectByPoid(newProject.getOid());
if (newProject.getName().equals(originalName)) {
fail("Project name not updated");
} else if (!newProject.getName().equals(newName)) {
fail("Project name not updated to new name");
}
} catch (Throwable e) {
e.printStackTrace();
if (e instanceof AssertionError) {
throw (AssertionError) e;
}
fail(e.getMessage());
}
}
Aggregations