Skip to content

Commit

Permalink
support Long to String conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
gpalos committed Sep 8, 2016
1 parent 0fd5a5b commit 80fd69a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Expand Up @@ -1360,6 +1360,9 @@ public <T> T getAttr(Set<Attribute> attributes, String attrName, Class<T> type,
if (type.isAssignableFrom(val.getClass())) {
return (T) val;
}
if (val.getClass() == Long.class && type == String.class){
return (T)Long.toString(((Long) val).longValue());
}
throw new InvalidAttributeValueException("Unsupported type " + val.getClass() + " for attribute " + attrName);
}
throw new InvalidAttributeValueException("More than one value for attribute " + attrName);
Expand Down
Expand Up @@ -536,6 +536,27 @@ public void testuserGroupRoleUpdate() throws RemoteException {

}

@Test
public void testCreateOrg(){
String orgName = "test root org 2";
ObjectClass objectClass = new ObjectClass(LiferayConnector.ORGANIZATION_NAME);
Set<Attribute> attributes = new HashSet<Attribute>();
attributes.add(AttributeBuilder.build(Name.NAME, orgName));
long parent = 0;
attributes.add(AttributeBuilder.build("parentOrganizationId", parent));

LiferayConfiguration config = new LiferayConfiguration();
config.setCompanyId(TestClient.COMPANY_ID);
config.setEndpoint("http://localhost:8080/api/axis/");
config.setUsername("test");
config.setPlainPassword("test");

LiferayConnector lc = new LiferayConnector();
lc.init(config);

lc.create(objectClass, attributes, null);
}

@Test
public void testOrganization() throws Exception {
Long test2Org = 24200l;
Expand Down

0 comments on commit 80fd69a

Please sign in to comment.