Skip to content

Commit

Permalink
Release 3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eddspencer authored Apr 8, 2022
2 parents b8ece29 + 87b8aaa commit d20b841
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 14 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@ can get data for both organization and organization brand pages.
## 3.0.4 (Apr 1, 2022)
* Update `JsonUtils.getValue` method to handle JsonNumeric values correctly.

## 3.0.5 (Work in progress)
## 3.0.5 (Apr 7, 2022)
* Updated `CommentAction.Attribute.value` to use AttributedEntity, to fix issue where share
requests with mentions aren't being persisted correctly.

## 3.0.6 (work in progress)
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use:
<dependency>
<groupId>com.echobox</groupId>
<artifactId>ebx-linkedin-sdk</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
</dependency>
```

Expand Down Expand Up @@ -128,12 +128,14 @@ Please use a merge (not rebase) commit when merging dev into master to perform t

To create a full release to Maven central please follow these steps:
1. Ensure the `CHANGELOG.md` is up to date with all the changes in the release, if not please raise
a suitable PR into `DEV`. Typically the change log should be updated as we go.
a suitable PR into `DEV`. Typically, the change log should be updated as we go.
3. Create a PR from `DEV` into `MASTER`. Ensure the version in the `pom.xml` is the
correct version to be released. Merging this PR into `MASTER` will automatically create the maven
and github releases. Please note that a release is final, it can not be undone/deleted/overwritten.
and github releases, **it must be squashed and merged so that all the changes of the PR are a
single commit**. Please note that a release is final, it can not be undone/deleted/overwritten.
5. Once the public release has been successful create a final PR into `DEV` that contains an
incremented `pom.xml` version to ensure the correct snapshot gets updated on subsequent merges
into `DEV`. This PR should also include:
into `DEV`. **This PR should never be squashed but just merged** to ensure all commits from dev
are included in master, it should include:
* An update to the `README.md` latest stable release version number.
* A 'Work In Progress' entry for the next anticipated release in `CHANGELOG.md`.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.echobox</groupId>
<artifactId>ebx-linkedin-sdk</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,71 @@ public static class Attribute {
@LinkedIn
private Integer start;

@LinkedIn("value")
private CommentAction.AttributedEntity value;

public CommentAction.CompanyAttributedEntity getCompanyValue() {
CommentAction.CompanyAttributedEntity companyValue =
new CommentAction.CompanyAttributedEntity();
companyValue.setCompany(value.getCompany());
return companyValue;
}

public void setCompanyValue(CommentAction.CompanyAttributedEntity companyValue) {
if (value == null) {
value = new AttributedEntity();
}
value.setCompany(companyValue.getCompany());
}

public CommentAction.MemberAttributedEntity getMemberVaue() {
CommentAction.MemberAttributedEntity memberValue =
new CommentAction.MemberAttributedEntity();
memberValue.setMember(value.getMember());
return memberValue;
}

public void setMemberVaue(CommentAction.MemberAttributedEntity memberValue) {
if (value == null) {
value = new AttributedEntity();
}
value.setMember(memberValue.getMember());
}

public CommentAction.CompanyAttributedEntity getSchoolValue() {
CommentAction.CompanyAttributedEntity schoolValue =
new CommentAction.CompanyAttributedEntity();
schoolValue.setCompany(value.getSchool());
return schoolValue;
}

public void setSchoolValue(CommentAction.SchoolAttributedEntity schoolValue) {
if (value == null) {
value = new AttributedEntity();
}
value.setSchool(schoolValue.getSchool());
}
}

/**
* Attributed Entity
*/
public static class AttributedEntity {

@Getter
@Setter
@LinkedIn("value")
private CommentAction.CompanyAttributedEntity companyValue;
@LinkedIn("com.linkedin.common.CompanyAttributedEntity")
private CompanyURN company;

@Getter
@Setter
@LinkedIn("value")
private CommentAction.MemberAttributedEntity memberVaue;
@LinkedIn("com.linkedin.common.MemberAttributedEntity")
private MemberURN member;

@Getter
@Setter
@LinkedIn("value")
private CommentAction.SchoolAttributedEntity schoolValue;
@LinkedIn("com.linkedin.common.SchoolAttributedEntity")
private CompanyURN school;

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.echobox.api.linkedin.types.social.actions;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.echobox.api.linkedin.jsonmapper.DefaultJsonMapper;
import com.echobox.api.linkedin.jsonmapper.DefaultJsonMapperTestBase;
import com.echobox.api.linkedin.types.ugc.UGCShare;
import com.echobox.api.linkedin.types.urn.URN;
import org.junit.Test;

/**
* CommentAction test
* @author lukemartin
*/
public class CommentActionTest extends DefaultJsonMapperTestBase {

@Test
public void testAttributeGetCompanyValue() {
String json =
readFileToString("com.echobox.api.linkedin.jsonmapper/ugcShareWithMentions.json");
DefaultJsonMapper defaultJsonMapper = new DefaultJsonMapper();
UGCShare ugcShare = defaultJsonMapper.toJavaObject(json, UGCShare.class);

URN urn = new URN("urn:li:organization:1337");

CommentAction.Attribute attribute =
ugcShare.getSpecificContent().getShareContent().getShareCommentary().getAttributes().get(0);

assertEquals(attribute.getCompanyValue().getCompany().getCompany().toString(),
urn.toString());
}

@Test
public void testAttributeSetCompanyValue() {
URN urn = new URN("urn:li:organization:1337");

CommentAction.CompanyURN companyURN = new CommentAction.CompanyURN();
companyURN.setCompany(new URN("urn:li:organization:1337"));

CommentAction.CompanyAttributedEntity companyAttributedEntity =
new CommentAction.CompanyAttributedEntity();
companyAttributedEntity.setCompany(companyURN);

CommentAction.Attribute attribute = new CommentAction.Attribute();
attribute.setCompanyValue(companyAttributedEntity);

assertEquals(attribute.getCompanyValue().getCompany().getCompany().toString(),
urn.toString());

}

@Test
public void testAttributeGetMemberValue() {
String json =
readFileToString("com.echobox.api.linkedin.jsonmapper/ugcShareWithMentions.json");
DefaultJsonMapper defaultJsonMapper = new DefaultJsonMapper();
UGCShare ugcShare = defaultJsonMapper.toJavaObject(json, UGCShare.class);

URN urn = new URN("urn:li:person:1337");

CommentAction.Attribute attribute =
ugcShare.getSpecificContent().getShareContent().getShareCommentary().getAttributes().get(1);

assertEquals(attribute.getMemberVaue().getMember().getMember().toString(),
urn.toString());

}

@Test
public void testAttributeSetMemberValue() {
URN urn = new URN("urn:li:person:1337");

CommentAction.MemberURN memberURN = new CommentAction.MemberURN();
memberURN.setMember(new URN("urn:li:person:1337"));

CommentAction.MemberAttributedEntity memberAttributedEntity =
new CommentAction.MemberAttributedEntity();
memberAttributedEntity.setMember(memberURN);

CommentAction.Attribute attribute = new CommentAction.Attribute();
attribute.setMemberVaue(memberAttributedEntity);

assertEquals(attribute.getMemberVaue().getMember().getMember().toString(),
urn.toString());

}

@Test
public void testAttributeGetSetSchoolValue() {
URN urn = new URN("urn:li:organization:1337");

CommentAction.CompanyURN companyURN = new CommentAction.CompanyURN();
companyURN.setCompany(new URN("urn:li:organization:1337"));

CommentAction.SchoolAttributedEntity schoolAttributedEntity =
new CommentAction.SchoolAttributedEntity();
schoolAttributedEntity.setSchool(companyURN);

CommentAction.Attribute attribute = new CommentAction.Attribute();
attribute.setSchoolValue(schoolAttributedEntity);

// SchoolAttributedEntity is now deprecated, must use CompanyAttributedEntity
assertTrue(schoolAttributedEntity instanceof CommentAction.SchoolAttributedEntity);
assertTrue(attribute.getSchoolValue() instanceof CommentAction.CompanyAttributedEntity);
assertEquals(attribute.getSchoolValue().getCompany().getCompany().toString(),
urn.toString());

}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"author": "urn:li:person:8675309",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"description": {
"attributes": [],
"text": "Official LinkedIn Blog - Your source for insights and information about LinkedIn."
},
"originalUrl": "https://blog.linkedin.com/",
"status": "READY",
"title": {
"attributes": [],
"text": "Official LinkedIn Blog"
}
}
],
"shareCommentary": {
"attributes": [
{
"length": 8,
"start": 20,
"value": {
"com.linkedin.common.CompanyAttributedEntity": {
"company": "urn:li:organization:1337"
}
}
},
{
"length": 8,
"start": 20,
"value": {
"com.linkedin.common.MemberAttributedEntity": {
"member": "urn:li:person:1337"
}
}
}
],
"text": "Learning more about LinkedIn by reading the LinkedIn Blog!"
},
"shareMediaCategory": "ARTICLE"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

0 comments on commit d20b841

Please sign in to comment.