Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
<id>tmortagne</id>
<name>Thomas Mortagne</name>
</developer>
<developer>
<id>martindelille</id>
<name>Martin Delille</name>
</developer>
</developers>
<modules>
<module>usersync-api</module>
Expand Down Expand Up @@ -85,4 +89,16 @@
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.7.1</version>
</dependency>
</dependencies>
Comment thread
MartinDelille marked this conversation as resolved.
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
package org.xwiki.contrib.usersync.discourse.internal;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
Expand All @@ -29,9 +31,15 @@

import com.xpn.xwiki.objects.BaseObject;

import retrofit2.Retrofit;
import retrofit2.Retrofit.Builder;
import retrofit2.Call;

import org.xwiki.contrib.usersync.discourse.internal.DiscourseService;

/**
* {@link UserSyncConnector} implementation for Discourse.
*
*
* @version $Id$
*/
@Component
Expand All @@ -40,8 +48,9 @@
public class DiscourseUserSyncConnector implements UserSyncConnector
{
private static final String PREFIX_CONFIGURATION = "usersync.discourse.";

private static final String CONFIGURATION_URL = PREFIX_CONFIGURATION + "url";
private static final String API_KEY = PREFIX_CONFIGURATION + "api_key";
Comment thread
MartinDelille marked this conversation as resolved.
Outdated

@Inject
private ConfigurationSource configuration;
Expand All @@ -57,8 +66,19 @@ public void createUser(BaseObject user)

// Get the URL of the discourse server to synchronize with
String discourseURL = this.configuration.getProperty(CONFIGURATION_URL);
String discourseApiKey = this.configuration.getProperty(API_KEY);

// TODO
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.github.com/")
.build();

DiscourseService service = retrofit.create(DiscourseService.class);
Call<List<Repo>> repos = service.listRepos("martindelille");
Comment thread
MartinDelille marked this conversation as resolved.
Outdated


System.out.println("url");
System.out.println(discourseURL);
System.out.println("end");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void before()
}

@Test
public void createUser() throws ComponentLookupException
{
// Call the component
this.mocker.getComponentUnderTest().createUser(this.newUser);
}

public void modifyUser() throws ComponentLookupException
{
// Modify the user
Expand Down