Skip to content

Commit

Permalink
Add connect/signup and create association to production
Browse files Browse the repository at this point in the history
Add features for 0.1.0 release
  • Loading branch information
vbouquet authored Feb 28, 2017
2 parents b58a8ab + 2547e4e commit 32d556b
Show file tree
Hide file tree
Showing 40 changed files with 1,854 additions and 247 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ Master | Develop
--- | --- | ---
[![Build Status](https://travis-ci.org/Bouquet2/AssoGenda.svg?branch=master)](https://travis-ci.org/Bouquet2/AssoGenda) | [![Build Status](https://travis-ci.org/Bouquet2/AssoGenda.svg?branch=develop)](https://travis-ci.org/Bouquet2/AssoGenda)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/726fc6a1a7514acc91f321082a3d2b51?branch=master)](https://www.codacy.com/app/Bouquet2/AssoGenda?utm_source=github.com&utm_medium=referral&utm_content=Bouquet2/AssoGenda&utm_campaign=badger) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/726fc6a1a7514acc91f321082a3d2b51?branch=develop)](https://www.codacy.com/app/Bouquet2/AssoGenda?utm_source=github.com&utm_medium=referral&utm_content=Bouquet2/AssoGenda&utm_campaign=badger)
[![Coverage Status](https://coveralls.io/repos/github/Bouquet2/AssoGenda/badge.svg?branch=master)](https://coveralls.io/github/Bouquet2/AssoGenda?branch=master) | [![Coverage Status](https://coveralls.io/repos/github/Bouquet2/AssoGenda/badge.svg?branch=master)](https://coveralls.io/github/Bouquet2/AssoGenda?branch=develop)
[![Coverage Status](https://coveralls.io/repos/github/Bouquet2/AssoGenda/badge.svg?branch=master)](https://coveralls.io/github/Bouquet2/AssoGenda?branch=master) | [![Coverage Status](https://coveralls.io/repos/github/Bouquet2/AssoGenda/badge.svg?branch=develop)](https://coveralls.io/github/Bouquet2/AssoGenda?branch=develop)

Asso’Genda est une application android de gestion et de partage d’événements associatifs ayant deux objectifs principaux :

- Permettre aux étudiants de différentes universités de générer un agenda des événements associatifs étudiants qui leur sont accessible au sein de leur université et en fonction de leurs préférences. Une bonne opportunité pour découvrir des associations et les suivre.
- Centraliser les événements associatifs par université. Une association peut gérer ses informations et ses membres. Elle peut créer et mettre en avant ses événements et avoir plus de visibilité.

### Installation ###
AssoGenda utilise android sdk version 23.0.2.
Vérifiez qu'il est installé et que la variable d'environnement ANDROID_HOME est présente dans votre PATH.

### Use Case ###

![](/diagrams/usecase_associations.png)
Expand Down
17 changes: 15 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'org.sonarqube'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'jacoco'

android {
compileSdkVersion 23
Expand All @@ -27,15 +28,27 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.0.57-beta'

androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support'
})
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2'

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
}

sonarqube {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package fr.paris10.projet.assogenda.assogenda.daos;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class DAOAssociationTest {

private DAOAssociation daoAssociation;

@Before
public void setUp() throws Exception {
this.daoAssociation = DAOAssociation.getInstance();
}

@After
public void tearDown() throws Exception {
this.daoAssociation = null;
}

@Test
public void testInitDAO() throws Exception {
assertNotNull(daoAssociation);
}

@Test
public void testValidateAssociation() throws Exception {
assertFalse(daoAssociation.validateAssociation(null, null, null));
assertFalse(daoAssociation.validateAssociationName(null));

//Test if association name contains more than 2 caracters
assertFalse(daoAssociation.validateAssociationName("Na"));

assertFalse(daoAssociation.validateAssociationUniversity(null));
assertFalse(daoAssociation.validateAssociationUniversity("Un"));

assertFalse(daoAssociation.validateAssociationDescription(null));
assertFalse(daoAssociation.validateAssociationDescription("De"));

assertTrue(daoAssociation.validateAssociation("Name", "University", "Description"));
assertTrue(daoAssociation.validateAssociationName("Name"));
assertTrue(daoAssociation.validateAssociationUniversity("University"));
assertTrue(daoAssociation.validateAssociationDescription("Description"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package fr.paris10.projet.assogenda.assogenda.daos;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import fr.paris10.projet.assogenda.assogenda.model.User;

import static org.junit.Assert.*;

@RunWith(AndroidJUnit4.class)
public class DAOUserTest {
private Context appContext;
private DAOUser daoUser;

@Before
public void setUp() throws Exception {
this.appContext = InstrumentationRegistry.getTargetContext();
this.daoUser = DAOUser.getInstance();
}

@After
public void tearDown() throws Exception {
this.appContext = null;
this.daoUser = null;
}

@Test
public void testInitDAO() throws Exception {
assertNotNull(daoUser);
}

@Test
public void testValidateUser() throws Exception {
final String userCreate = "User should have been created";
final String userNotCreate = "User should have not been created";
User user = new User("[email protected]", "test", "supertest");
assertFalse(userNotCreate, daoUser.validateUser(null, null, null, null));
assertTrue(userCreate, daoUser.validateUser(user, "superpassword"));
assertFalse(userNotCreate, daoUser.validateUser(user, null));
user.email="test.fr";
assertFalse(userNotCreate, daoUser.validateUser(user, "superpassword"));
user.email=null;
assertFalse(userNotCreate, daoUser.validateUser(user, "superpassword"));
assertFalse(userNotCreate, daoUser.validateUser((String) null, null));
assertFalse(userNotCreate, daoUser.validateUser("fakeemail.fr", "password"));
assertFalse(userNotCreate, daoUser.validateUser("[email protected]", "123"));
assertTrue(userCreate, daoUser.validateUser("[email protected]", "password"));
}

@Test
public void testSignInAndOut() throws Exception {
if (daoUser.isLoggedIn())
daoUser.signOut();
assertFalse(daoUser.isLoggedIn());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fr.paris10.projet.assogenda.assogenda.ui.activites;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import fr.paris10.projet.assogenda.assogenda.R;
import fr.paris10.projet.assogenda.assogenda.daos.DAOUser;

import static org.junit.Assert.*;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule =
new ActivityTestRule<>(MainActivity.class);

@Test
public void testLogOutButton() {
DAOUser daoUser = DAOUser.getInstance();
if (daoUser.isLoggedIn()) {
onView(withId(R.id.main_logout_button)).perform(click());
assertFalse(daoUser.isLoggedIn());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package fr.paris10.projet.assogenda.assogenda.ui.fragment;

import org.junit.Test;

import fr.paris10.projet.assogenda.assogenda.R;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.notNullValue;

public class AssociationMainFragmentTest {

@Test
public void testCreateAssociationButton() {

onView(withId(R.id.fragment_association_main_button_create_association)).check(matches(notNullValue() ));
onView(withId(R.id.fragment_association_main_button_create_association)).perform(click());
onView(withId(R.id.fragment_create_association_name_title))
.check(matches(withText((R.string.fragment_create_association_name_title))));
}
}
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".examples.UserActivity"></activity>
<activity android:name=".ui.activites.SignUpActivity" />
<activity android:name=".ui.activites.LoginActivity"></activity>
<activity android:name=".ui.activites.AssociationDashboardActivity"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package fr.paris10.projet.assogenda.assogenda.daos;

import fr.paris10.projet.assogenda.assogenda.daos.firebase.DAOFirebaseAssociation;

public class DAOAssociation {

private DAOFirebaseAssociation daoFirebaseAssociation;
private static DAOAssociation instance = null;

public DAOAssociation() {
daoFirebaseAssociation = DAOFirebaseAssociation.getInstance();
}

public static DAOAssociation getInstance() {
if(instance == null) {
instance = new DAOAssociation();
}
return instance;
}

public void createAssociation(String associationName, String associationUniversity, String associationDescription, String logo) {
daoFirebaseAssociation.createAssociation(associationName, associationUniversity, associationDescription, logo);
}

public boolean validateAssociationName(String associationName) {
return daoFirebaseAssociation.validateAssociationName(associationName);
}

public boolean validateAssociationUniversity(String associationUniversity) {
return daoFirebaseAssociation.validateAssociationUniversity(associationUniversity);
}

public boolean validateAssociationDescription(String associationDescription) {
return daoFirebaseAssociation.validateAssociationDescription(associationDescription);
}

public boolean validateAssociation(String associationName, String associationUniversity, String associationDescription) {
return daoFirebaseAssociation.validateAssociation(associationName, associationUniversity, associationDescription);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package fr.paris10.projet.assogenda.assogenda.daos;

import com.google.firebase.auth.FirebaseAuth;

import fr.paris10.projet.assogenda.assogenda.daos.firebase.DAOFirebaseUser;
import fr.paris10.projet.assogenda.assogenda.model.User;

public class DAOUser {
private DAOFirebaseUser database;
private static DAOUser instance = null;

private DAOUser() {
database = DAOFirebaseUser.getInstance();
}

public static DAOUser getInstance() {
if (instance == null)
instance = new DAOUser();
return instance;
}

public boolean isLoggedIn() {
return database.isLoggedIn();
}

public void signOut() {
database.signOut();
}

public boolean validateUser(User user, String password) {
return database.validateUser(user, password);
}

public boolean validateUser(String email, String password, String firstName, String lastName) {
return database.validateUser(email, password, firstName, lastName);
}

public boolean validateUser(final String email, final String password) {
return database.validateUser(email, password);
}

public void createUser(String uid, String email, String firstName, String lastName) {
database.createUser(uid, email, firstName, lastName);
}

public FirebaseAuth getAuth() {
return FirebaseAuth.getInstance();
}
}
Loading

0 comments on commit 32d556b

Please sign in to comment.