-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from lolaent/sync_branch
Sync branch
- Loading branch information
Showing
27 changed files
with
1,330 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,50 @@ | ||
package com.lucidworks.fusion.connector; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.lucidworks.fusion.connector.model.DrupalLoginRequest; | ||
import com.lucidworks.fusion.connector.model.DrupalLoginResponse; | ||
import com.lucidworks.fusion.connector.model.TopLevelJsonapi; | ||
import com.lucidworks.fusion.connector.service.ConnectorService; | ||
import com.lucidworks.fusion.connector.service.ContentService; | ||
import com.lucidworks.fusion.connector.service.DrupalOkHttp; | ||
import com.lucidworks.fusion.connector.util.DataUtil; | ||
|
||
import java.util.Map; | ||
|
||
public class Runner { | ||
|
||
public static void main(String[] args) { | ||
String baseUrl = "http://s5ee7c4bb7c413wcrxueduzw.devcloud.acquia-sites.com/"; | ||
DrupalOkHttp drupalOkHttp = new DrupalOkHttp(); | ||
ObjectMapper mapper = new ObjectMapper(); | ||
ContentService contentService = new ContentService(drupalOkHttp, mapper); | ||
|
||
DrupalLoginResponse drupalLoginResponse = contentService.login(baseUrl, "authenticated", "authenticated"); | ||
DrupalOkHttp drupalOkHttp = new DrupalOkHttp(mapper); | ||
ContentService contentService = new ContentService(mapper); | ||
|
||
ConnectorService connectorService = new ConnectorService(baseUrl + "fusion", drupalLoginResponse, contentService); | ||
DrupalLoginRequest drupalLoginRequest = new DrupalLoginRequest("authenticated", "authenticated"); | ||
|
||
DrupalLoginResponse drupalLoginResponse = drupalOkHttp.loginResponse(normalizeUrl(baseUrl) + normalizeUrl("/user/login"), drupalLoginRequest); | ||
|
||
ConnectorService connectorService = new ConnectorService(normalizeUrl(baseUrl) + normalizeUrl("/en/fusion/node/article"), new DrupalLoginResponse(), contentService, mapper); | ||
|
||
Map<String, String> response = connectorService.prepareDataToUpload(); | ||
|
||
response.forEach((currentUrl, content) -> { | ||
System.out.println(currentUrl); | ||
//System.out.println(content); | ||
}); | ||
Map<String, TopLevelJsonapi> topLevelJsonapiMap = contentService.getTopLevelJsonapiDataMap(); | ||
|
||
Map<String, Map<String, Object>> objectMap = DataUtil.generateObjectMap(topLevelJsonapiMap); | ||
|
||
for (String key : objectMap.keySet()) { | ||
Map<String, Object> pageContentMap = objectMap.get(key); | ||
System.out.println(pageContentMap.values().toString()); | ||
} | ||
|
||
System.out.println("Logout is successful: " + drupalOkHttp.logout(normalizeUrl(baseUrl) + "/user/logout", drupalLoginResponse)); | ||
} | ||
|
||
|
||
private static String normalizeUrl(String initialUrl) { | ||
String normalizedUrl = initialUrl.endsWith("/") ? | ||
initialUrl.substring(0, initialUrl.length() - 1) : initialUrl; | ||
|
||
return normalizedUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.