Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create user #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
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>
MartinDelille marked this conversation as resolved.
Show resolved Hide 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";
MartinDelille marked this conversation as resolved.
Show resolved Hide resolved

@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");
MartinDelille marked this conversation as resolved.
Show resolved Hide resolved


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