{
38 |
39 | //Private
40 | private String name="";
41 | private String value="";
42 |
43 | /**
44 | * Creates a new StringFieldModel object
45 | *
46 | * @param newName - Field name
47 | * @param newValue - Field Value
48 | */
49 | public StringFieldModel(String newName,String newValue){
50 |
51 | setValue(newName,newValue);
52 | }
53 |
54 | /**
55 | * get value
56 | */
57 | public String getValue() {
58 | return value;
59 | }
60 |
61 | /**
62 | * get name
63 | */
64 | public String getName(){
65 | return name;
66 | }
67 |
68 | /**
69 | * set value - name/value
70 | */
71 | public void setValue(String newName,String newValue){
72 |
73 | name = newName;
74 | value = newValue;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/sdk-src/src/main/java/com/hpe/adm/nga/sdk/network/OctaneHttpClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.network;
30 |
31 | import com.hpe.adm.nga.sdk.authentication.JSONAuthentication;
32 |
33 | /**
34 | *
35 | * HTTP Client
36 | *
37 | * Created by leufl on 2/11/2016.
38 | */
39 | public interface OctaneHttpClient {
40 |
41 | //Constants
42 | String OAUTH_AUTH_URL = "/authentication/sign_in";
43 | String OAUTH_SIGNOUT_URL = "/authentication/sign_out";
44 | String LWSSO_COOKIE_KEY = "LWSSO_COOKIE_KEY";
45 | String OCTANE_USER_COOKIE_KEY = "OCTANE_USER";
46 |
47 | /**
48 | * Authenticate with the Octane server using an implementation of the {@link JSONAuthentication} class.
49 | * If basic authentication is being used then the authentication is an inherent part of execute and therefore
50 | * authentication does not need to be called explicitly. True will be returned in this case
51 | *
52 | * @return true if the authentication was successful, false otherwise
53 | */
54 | boolean authenticate();
55 |
56 | /**
57 | * Signs out and removes cookies
58 | */
59 | void signOut();
60 |
61 | OctaneHttpResponse execute(OctaneHttpRequest octaneHttpRequest);
62 | }
63 |
--------------------------------------------------------------------------------
/sdk-src/src/main/java/com/hpe/adm/nga/sdk/query/NullField.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.query;
30 |
31 | public class NullField {
32 | public String toString() {
33 | return "null";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sdk-src/src/main/java/com/hpe/adm/nga/sdk/query/NullReferenceField.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.query;
30 |
31 | public class NullReferenceField {
32 | public String toString() {
33 | return "{null}";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sdk-src/src/main/java/com/hpe/adm/nga/sdk/siteadmin/Server.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.siteadmin;
30 |
31 | import com.hpe.adm.nga.sdk.network.OctaneHttpClient;
32 | import com.hpe.adm.nga.sdk.siteadmin.version.GetServerVersion;
33 |
34 | /**
35 | * Creates an instance that represents the {@code server} API
36 | */
37 | public class Server {
38 |
39 | // private members
40 | private final OctaneHttpClient octaneHttpClient;
41 | private final String urlDomain;
42 |
43 | /**
44 | * Creates a new Server object
45 | *
46 | * @param octaneHttpClient - Http Request Factory
47 | * @param siteAdminDomain - siteAdmin Domain Name
48 | */
49 | public Server(OctaneHttpClient octaneHttpClient, String siteAdminDomain) {
50 | urlDomain = siteAdminDomain + "server/";
51 | this.octaneHttpClient = octaneHttpClient;
52 | }
53 |
54 | /**
55 | * Gets the API for server version
56 | *
57 | * @return the correct API
58 | */
59 | public GetServerVersion getServerVersion() {
60 | return new GetServerVersion(octaneHttpClient, urlDomain);
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/sdk-src/src/main/overview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | The ALM Octane REST API Java SDK.
4 |
5 |
6 | To create a new instance use the {@link com.hpe.adm.nga.sdk.Octane} class. Once an Octane instance has been created
7 | the shared space and workspace contexts can be added. See the various documentation for more information.
8 |
9 |
10 | To create a new instance use the following example:
11 |
12 |
13 | Octane octane = new Octane.Builder(new SimpleUserAuthentication("user", "pass")).build();
14 |
15 |
--------------------------------------------------------------------------------
/sdk-src/src/test/java/com/hpe/adm/nga/sdk/attachments/TestAttachments.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.attachments;
30 |
31 | import com.hpe.adm.nga.sdk.Octane;
32 | import com.hpe.adm.nga.sdk.unit_tests.common.CommonMethods;
33 | import org.junit.BeforeClass;
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 | import org.mockito.internal.util.reflection.Whitebox;
37 | import org.powermock.api.mockito.PowerMockito;
38 | import org.powermock.core.classloader.annotations.PowerMockIgnore;
39 | import org.powermock.modules.junit4.PowerMockRunner;
40 |
41 | import static org.junit.Assert.assertEquals;
42 |
43 | @PowerMockIgnore("javax.management.*")
44 | @RunWith(PowerMockRunner.class)
45 | public class TestAttachments {
46 | private static Octane octane;
47 | private static AttachmentList spiedAttachments;
48 |
49 | @BeforeClass
50 | public static void setUpBeforeClass() throws Exception {
51 | octane = CommonMethods.getOctaneForTest();
52 | AttachmentList attachments = octane.attachmentList();
53 | spiedAttachments = PowerMockito.spy(attachments);
54 | }
55 |
56 | @Test
57 | public void testCorrectUrl(){
58 | String expectedResult = CommonMethods.getDomain() + "/api/shared_spaces/" + CommonMethods.getSharedSpace() + "/workspaces/" + CommonMethods.getWorkSpace() + "/attachments";
59 | String internalUrl = (String)Whitebox.getInternalState(spiedAttachments, "attachmentListDomain");
60 | assertEquals(expectedResult, internalUrl);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/sdk-src/src/test/java/com/hpe/adm/nga/sdk/network/TestOctaneUrl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.network;
30 |
31 | import com.hpe.adm.nga.sdk.unit_tests.common.CommonMethods;
32 | import org.junit.Test;
33 |
34 | import static org.junit.Assert.assertEquals;
35 |
36 | /**
37 | * Test for {@link OctaneUrl}
38 | */
39 | public class TestOctaneUrl {
40 |
41 | /**
42 | * Test correct build of URL with field specification, limits, offset and orderBy.
43 | * The method invokes internal protected method with retrieved private parameters.
44 | */
45 | @Test
46 | public void testUrlBuilder() {
47 | final String expectedResult = CommonMethods.getDomain() + "?offset=1&limit=10&order_by=-version_stamp&fields=version_stamp,item_type";
48 | OctaneUrl octaneUrl = new OctaneUrl(CommonMethods.getDomain());
49 | octaneUrl.addFieldsParam("version_stamp", "item_type");
50 | octaneUrl.setLimitParam(10);
51 | octaneUrl.setOffsetParam(1);
52 | octaneUrl.setOrderByParam("version_stamp", false);
53 |
54 | assertEquals(expectedResult, octaneUrl.toString());
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/file.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MicroFocus/ALMOctaneJavaRESTSDK/10d1e0c6ae350207b9b7883865beda60886f2304/sdk-src/src/test/resources/file.pdf
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/getEntitiesMetadataString.txt:
--------------------------------------------------------------------------------
1 | {"data":[{"features":[{"name":"subtype_of","type":"test"},{"name":"has_comments","relation_name":"comments_to_test_suite"},{"methods":["DELETE","POST","GET","PUT"],"name":"rest","url":"test_suites"},{"name":"has_attachments","relation_name":"attachments_to_test_suite"},{"name":"business_rules"}],"name":"test_suite","label":"Test Suite","type":"entity_metadata","can_modify_label":false},{"features":[{"name":"subtype_of","type":"taxonomy_node"},{"methods":["DELETE","POST","GET","PUT"],"name":"rest","url":"taxonomy_item_nodes"}],"name":"taxonomy_item_node","label":"Taxonomy Item Node","type":"entity_metadata","can_modify_label":false},{"features":[{"name":"has_comments","relation_name":"comments_to_theme"},{"name":"has_attachments","relation_name":"attachments_to_theme"},{"name":"subtype_of","type":"work_item"},{"name":"mailing","url":"mails"},{"methods":["DELETE","POST","GET","PUT"],"name":"rest","url":"themes"},{"parent_types":["work_item_root"],"root":{"type":"work_item_root","id":1001},"name":"hierarchical_entity","child_types":["feature"]},{"name":"business_rules"}],"name":"theme","label":"Theme","type":"entity_metadata","can_modify_label":false}],"total_count":3}
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/sample.pdf:
--------------------------------------------------------------------------------
1 | text file testing
2 |
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/test.txt:
--------------------------------------------------------------------------------
1 | text file testing
2 |
--------------------------------------------------------------------------------
/sdk-src/src/test/resources/test1.txt:
--------------------------------------------------------------------------------
1 | text file testing
2 |
--------------------------------------------------------------------------------
/sdk-usage-examples/src/main/java/com/hpe/adm/nga/sdk/examples/APIModeExample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.examples;
30 |
31 | import com.hpe.adm.nga.sdk.APIMode;
32 | import com.hpe.adm.nga.sdk.authentication.SimpleClientAuthentication;
33 |
34 | /**
35 | * An example to show how to use a different REST API mode
36 | */
37 | public class APIModeExample {
38 |
39 | public void setAPIMode() {
40 | // please note that this mode does not exist and is for an example only!
41 | APIMode privateMode = new APIMode() {
42 | @Override
43 | public String getHeaderValue() {
44 | return "OCTANE_PRIVATE_MODE";
45 | }
46 |
47 | @Override
48 | public String getHeaderKey() {
49 | return "true";
50 | }
51 | };
52 |
53 | new SimpleClientAuthentication("client", "secret", privateMode);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/sdk-usage-examples/src/main/java/com/hpe/adm/nga/sdk/examples/CreateContextExample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 Open Text.
3 | *
4 | * The only warranties for products and services of Open Text and
5 | * its affiliates and licensors (“Open Text”) are as may be set forth
6 | * in the express warranty statements accompanying such products and services.
7 | * Nothing herein should be construed as constituting an additional warranty.
8 | * Open Text shall not be liable for technical or editorial errors or
9 | * omissions contained herein. The information contained herein is subject
10 | * to change without notice.
11 | *
12 | * Except as specifically indicated otherwise, this document contains
13 | * confidential information and a valid license is required for possession,
14 | * use or copying. If this work is provided to the U.S. Government,
15 | * consistent with FAR 12.211 and 12.212, Commercial Computer Software,
16 | * Computer Software Documentation, and Technical Data for Commercial Items are
17 | * licensed to the U.S. Government under vendor's standard commercial license.
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | * http://www.apache.org/licenses/LICENSE-2.0
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an "AS IS" BASIS,
25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 | package com.hpe.adm.nga.sdk.examples;
30 |
31 | import com.hpe.adm.nga.sdk.Octane;
32 | import com.hpe.adm.nga.sdk.authentication.Authentication;
33 | import com.hpe.adm.nga.sdk.authentication.SimpleClientAuthentication;
34 |
35 | /**
36 | * Creates a simple context
37 | *
38 | * Created by brucesp on 03-Jan-17.
39 | */
40 | public class CreateContextExample {
41 |
42 | public static void main (String [] args){
43 | new CreateContextExample().createContext();
44 | }
45 |
46 | public void createContext() {
47 | // two types of authentication
48 | // 1) API Key
49 | Authentication clientAuthentication = new SimpleClientAuthentication("clientId", "clientSecret");
50 |
51 | // 2) User/pass
52 | //Authentication userPassAuthentication = new SimpleUserAuthentication("user", "password");
53 |
54 | // get instance of Octane Builder
55 | final Octane.Builder octaneBuilder = new Octane.Builder(clientAuthentication);
56 |
57 | // now we can add the server
58 | octaneBuilder.Server("http://myd-vm10632.hpeswlab.net:8081");
59 | // the sharedspace
60 | octaneBuilder.sharedSpace(1001);
61 | // the workspace
62 | octaneBuilder.workSpace(1002);
63 | //sets the client to HTTP2 client, by default is set to HTTP1.1
64 | //octaneBuilder.isHttp2(true);
65 |
66 | // finally we build the context and get an Octane instance:
67 |
68 | Octane octane = octaneBuilder.build();
69 |
70 | // octane.entityList("defects").get().limit(2).execute();
71 | octane.entityList("defects").get().execute();
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------