mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Make test data creation configurable.
This commit is contained in:
@@ -352,6 +352,16 @@
|
|||||||
/>
|
/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="org.briarproject.briar.android.test.TestDataActivity"
|
||||||
|
android:label="Create test data"
|
||||||
|
android:parentActivityName="org.briarproject.briar.android.settings.SettingsActivity">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="org.briarproject.briar.android.settings.SettingsActivity"
|
||||||
|
/>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.briarproject.briar.android.panic.PanicPreferencesActivity"
|
android:name="org.briarproject.briar.android.panic.PanicPreferencesActivity"
|
||||||
android:label="@string/panic_setting"
|
android:label="@string/panic_setting"
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import org.briarproject.briar.android.sharing.ShareForumFragment;
|
|||||||
import org.briarproject.briar.android.sharing.ShareForumMessageFragment;
|
import org.briarproject.briar.android.sharing.ShareForumMessageFragment;
|
||||||
import org.briarproject.briar.android.sharing.SharingModule;
|
import org.briarproject.briar.android.sharing.SharingModule;
|
||||||
import org.briarproject.briar.android.splash.SplashScreenActivity;
|
import org.briarproject.briar.android.splash.SplashScreenActivity;
|
||||||
|
import org.briarproject.briar.android.test.TestDataActivity;
|
||||||
|
|
||||||
import dagger.Component;
|
import dagger.Component;
|
||||||
|
|
||||||
@@ -147,6 +148,8 @@ public interface ActivityComponent {
|
|||||||
|
|
||||||
void inject(SettingsActivity activity);
|
void inject(SettingsActivity activity);
|
||||||
|
|
||||||
|
void inject(TestDataActivity activity);
|
||||||
|
|
||||||
void inject(ChangePasswordActivity activity);
|
void inject(ChangePasswordActivity activity);
|
||||||
|
|
||||||
void inject(IntroductionActivity activity);
|
void inject(IntroductionActivity activity);
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import org.briarproject.bramble.api.system.AndroidExecutor;
|
|||||||
import org.briarproject.bramble.util.StringUtils;
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.briarproject.briar.R;
|
import org.briarproject.briar.R;
|
||||||
import org.briarproject.briar.android.util.UserFeedback;
|
import org.briarproject.briar.android.util.UserFeedback;
|
||||||
import org.briarproject.briar.api.test.TestDataCreator;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -105,8 +104,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AndroidExecutor androidExecutor;
|
AndroidExecutor androidExecutor;
|
||||||
@Inject
|
|
||||||
TestDataCreator testDataCreator;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
@@ -153,14 +150,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
});
|
});
|
||||||
|
|
||||||
Preference testData = findPreference("pref_key_test_data");
|
Preference testData = findPreference("pref_key_test_data");
|
||||||
if (IS_DEBUG_BUILD) {
|
if (!IS_DEBUG_BUILD) {
|
||||||
testData.setOnPreferenceClickListener(preference -> {
|
|
||||||
LOG.info("Creating test data");
|
|
||||||
testDataCreator.createTestData();
|
|
||||||
getActivity().finish();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
testData.setVisible(false);
|
testData.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package org.briarproject.briar.android.test;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.briarproject.briar.R;
|
||||||
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
|
import org.briarproject.briar.android.activity.BriarActivity;
|
||||||
|
import org.briarproject.briar.android.navdrawer.NavDrawerActivity;
|
||||||
|
import org.briarproject.briar.api.test.TestDataCreator;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
public class TestDataActivity extends BriarActivity {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
TestDataCreator testDataCreator;
|
||||||
|
|
||||||
|
private TextView[] textviews = new TextView[5];
|
||||||
|
private SeekBar[] seekbars = new SeekBar[5];
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle bundle) {
|
||||||
|
super.onCreate(bundle);
|
||||||
|
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_test_data);
|
||||||
|
textviews[0] = findViewById(R.id.textViewContactsSb);
|
||||||
|
textviews[1] = findViewById(R.id.textViewMessagesSb);
|
||||||
|
textviews[2] = findViewById(R.id.TextViewBlogPostsSb);
|
||||||
|
textviews[3] = findViewById(R.id.TextViewForumsSb);
|
||||||
|
textviews[4] = findViewById(R.id.TextViewForumMessagesSb);
|
||||||
|
seekbars[0] = findViewById(R.id.seekBarContacts);
|
||||||
|
seekbars[1] = findViewById(R.id.seekBarMessages);
|
||||||
|
seekbars[2] = findViewById(R.id.seekBarBlogPosts);
|
||||||
|
seekbars[3] = findViewById(R.id.seekBarForums);
|
||||||
|
seekbars[4] = findViewById(R.id.seekBarForumMessages);
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
final TextView textView = textviews[i];
|
||||||
|
seekbars[i].setOnSeekBarChangeListener(
|
||||||
|
new OnSeekBarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(SeekBar seekBar,
|
||||||
|
int progress,
|
||||||
|
boolean fromUser) {
|
||||||
|
textView.setText("" + progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
findViewById(R.id.buttonCreateTestData).setOnClickListener(
|
||||||
|
v -> {
|
||||||
|
createTestData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTestData() {
|
||||||
|
testDataCreator.createTestData(seekbars[0].getProgress(),
|
||||||
|
seekbars[1].getProgress(), seekbars[2].getProgress(),
|
||||||
|
seekbars[3].getProgress(), seekbars[4].getProgress());
|
||||||
|
Intent intent = new Intent(this, NavDrawerActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectActivity(ActivityComponent component) {
|
||||||
|
component.inject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
170
briar-android/src/main/res/layout/activity_test_data.xml
Normal file
170
briar-android/src/main/res/layout/activity_test_data.xml
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewContacts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Number of contacts"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBarContacts"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="50"
|
||||||
|
android:progress="20"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/textViewContactsSb"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewContacts"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewContactsSb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="2"
|
||||||
|
android:text="20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/seekBarContacts"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewMessages"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Number of messages per contact"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBarContacts"/>
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBarMessages"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="50"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:progress="15"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/textViewMessagesSb"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewMessages"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewMessagesSb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="2"
|
||||||
|
android:text="20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/seekBarMessages"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewBlogPosts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Number of blog posts"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBarMessages"/>
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBarBlogPosts"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="50"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:progress="30"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/TextViewBlogPostsSb"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewBlogPosts"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TextViewBlogPostsSb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="2"
|
||||||
|
android:text="20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/seekBarBlogPosts"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewForums"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Number of forums"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBarBlogPosts"/>
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBarForums"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="10"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:progress="3"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/TextViewForumsSb"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewForums"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TextViewForumsSb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="2"
|
||||||
|
android:text="20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/seekBarForums"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewForumMessages"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Number of forum messages"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBarForums"/>
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBarForumMessages"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="50"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:progress="30"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/TextViewForumMessagesSb"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewForumMessages"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TextViewForumMessagesSb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="2"
|
||||||
|
android:text="20"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/seekBarForumMessages"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonCreateTestData"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:text="Create test data"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBarForumMessages"/>
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
@@ -124,6 +124,11 @@
|
|||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="pref_key_test_data"
|
android:key="pref_key_test_data"
|
||||||
android:title="Create Test Data"/>
|
android:title="Create Test Data">
|
||||||
|
|
||||||
</PreferenceScreen>
|
<intent
|
||||||
|
android:targetClass="org.briarproject.briar.android.test.TestDataActivity"
|
||||||
|
android:targetPackage="@string/app_package"/>
|
||||||
|
</Preference>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -8,4 +8,17 @@ public interface TestDataCreator {
|
|||||||
/* Creates fake test data on the DatabaseExecutor */
|
/* Creates fake test data on the DatabaseExecutor */
|
||||||
void createTestData();
|
void createTestData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a configurable amount of fake test data on the DatabaseExecutor
|
||||||
|
*
|
||||||
|
* @param numContacts Number of contacts to create.
|
||||||
|
* @param numPrivateMsgs Number of private messages to create for each
|
||||||
|
* contact.
|
||||||
|
* @param numBlogPosts Number of blog posts to create.
|
||||||
|
* @param numForums Number of forums to create.
|
||||||
|
* @param numForumPosts Number of forum posts to create per forum.
|
||||||
|
*/
|
||||||
|
void createTestData(int numContacts, int numPrivateMsgs, int numBlogPosts,
|
||||||
|
int numForums, int numForumPosts);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,6 @@ import static org.briarproject.briar.test.TestData.GROUP_NAMES;
|
|||||||
|
|
||||||
public class TestDataCreatorImpl implements TestDataCreator {
|
public class TestDataCreatorImpl implements TestDataCreator {
|
||||||
|
|
||||||
private final static int NUM_CONTACTS = 20;
|
|
||||||
private final static int NUM_PRIVATE_MSGS = 15;
|
|
||||||
private final static int NUM_BLOG_POSTS = 30;
|
|
||||||
private final static int NUM_FORUMS = 3;
|
|
||||||
private final static int NUM_FORUM_POSTS = 30;
|
|
||||||
|
|
||||||
private final Logger LOG =
|
private final Logger LOG =
|
||||||
Logger.getLogger(TestDataCreatorImpl.class.getName());
|
Logger.getLogger(TestDataCreatorImpl.class.getName());
|
||||||
|
|
||||||
@@ -92,6 +86,12 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
private final Map<Contact, LocalAuthor> localAuthors = new HashMap<>();
|
private final Map<Contact, LocalAuthor> localAuthors = new HashMap<>();
|
||||||
|
|
||||||
|
private int numContacts = 20;
|
||||||
|
private int numPrivateMsgs = 15;
|
||||||
|
private int numBlogPosts = 30;
|
||||||
|
private int numForums = 3;
|
||||||
|
private int numForumPosts = 30;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
TestDataCreatorImpl(AuthorFactory authorFactory, Clock clock,
|
TestDataCreatorImpl(AuthorFactory authorFactory, Clock clock,
|
||||||
PrivateMessageFactory privateMessageFactory,
|
PrivateMessageFactory privateMessageFactory,
|
||||||
@@ -119,6 +119,16 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
this.ioExecutor = ioExecutor;
|
this.ioExecutor = ioExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createTestData(int numContacts, int numPrivateMsgs, int numBlogPosts, int numForums,
|
||||||
|
int numForumPosts){
|
||||||
|
this.numContacts = numContacts;
|
||||||
|
this.numPrivateMsgs = numPrivateMsgs;
|
||||||
|
this.numBlogPosts = numBlogPosts;
|
||||||
|
this.numForums = numForums;
|
||||||
|
this.numForumPosts = numForumPosts;
|
||||||
|
createTestData();
|
||||||
|
}
|
||||||
|
|
||||||
public void createTestData() {
|
public void createTestData() {
|
||||||
ioExecutor.execute(() -> {
|
ioExecutor.execute(() -> {
|
||||||
try {
|
try {
|
||||||
@@ -143,9 +153,9 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<Contact> createContacts() throws DbException {
|
private List<Contact> createContacts() throws DbException {
|
||||||
List<Contact> contacts = new ArrayList<>(NUM_CONTACTS);
|
List<Contact> contacts = new ArrayList<>(numContacts);
|
||||||
LocalAuthor localAuthor = identityManager.getLocalAuthor();
|
LocalAuthor localAuthor = identityManager.getLocalAuthor();
|
||||||
for (int i = 0; i < NUM_CONTACTS; i++) {
|
for (int i = 0; i < numContacts; i++) {
|
||||||
Contact contact = addRandomContact(localAuthor);
|
Contact contact = addRandomContact(localAuthor);
|
||||||
contacts.add(contact);
|
contacts.add(contact);
|
||||||
}
|
}
|
||||||
@@ -210,7 +220,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
String btAddress = getRandomBluetoothAddress();
|
String btAddress = getRandomBluetoothAddress();
|
||||||
String uuid = getRandomUUID();
|
String uuid = getRandomUUID();
|
||||||
bt.put(BluetoothConstants.PROP_ADDRESS, btAddress);
|
bt.put(BluetoothConstants.PROP_ADDRESS, btAddress);
|
||||||
bt.put(BluetoothConstants.PROP_UUID,uuid);
|
bt.put(BluetoothConstants.PROP_UUID, uuid);
|
||||||
props.put(BluetoothConstants.ID, bt);
|
props.put(BluetoothConstants.ID, bt);
|
||||||
|
|
||||||
// LAN
|
// LAN
|
||||||
@@ -275,7 +285,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
throws DbException {
|
throws DbException {
|
||||||
for (Contact contact : contacts) {
|
for (Contact contact : contacts) {
|
||||||
Group group = messagingManager.getContactGroup(contact);
|
Group group = messagingManager.getContactGroup(contact);
|
||||||
for (int i = 0; i < NUM_PRIVATE_MSGS; i++) {
|
for (int i = 0; i < numPrivateMsgs; i++) {
|
||||||
try {
|
try {
|
||||||
createPrivateMessage(group.getId(), i);
|
createPrivateMessage(group.getId(), i);
|
||||||
} catch (FormatException e) {
|
} catch (FormatException e) {
|
||||||
@@ -284,7 +294,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Created " + NUM_PRIVATE_MSGS +
|
LOG.info("Created " + numPrivateMsgs +
|
||||||
" private messages per contact.");
|
" private messages per contact.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,13 +325,13 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
|
|
||||||
private void createBlogPosts(List<Contact> contacts)
|
private void createBlogPosts(List<Contact> contacts)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
for (int i = 0; i < NUM_BLOG_POSTS; i++) {
|
for (int i = 0; i < numBlogPosts; i++) {
|
||||||
Contact contact = contacts.get(random.nextInt(contacts.size()));
|
Contact contact = contacts.get(random.nextInt(contacts.size()));
|
||||||
LocalAuthor author = localAuthors.get(contact);
|
LocalAuthor author = localAuthors.get(contact);
|
||||||
addBlogPost(author, i);
|
addBlogPost(author, i);
|
||||||
}
|
}
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Created " + NUM_BLOG_POSTS + " blog posts.");
|
LOG.info("Created " + numBlogPosts + " blog posts.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,8 +351,8 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
|
|
||||||
private List<Forum> createForums(List<Contact> contacts)
|
private List<Forum> createForums(List<Contact> contacts)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
List<Forum> forums = new ArrayList<>(NUM_FORUMS);
|
List<Forum> forums = new ArrayList<>(numForums);
|
||||||
for (int i = 0; i < NUM_FORUMS; i++) {
|
for (int i = 0; i < numForums; i++) {
|
||||||
// create forum
|
// create forum
|
||||||
String name = GROUP_NAMES[random.nextInt(GROUP_NAMES.length)];
|
String name = GROUP_NAMES[random.nextInt(GROUP_NAMES.length)];
|
||||||
Forum forum = forumManager.addForum(name);
|
Forum forum = forumManager.addForum(name);
|
||||||
@@ -361,8 +371,8 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
forums.add(forum);
|
forums.add(forum);
|
||||||
}
|
}
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Created " + NUM_FORUMS + " forums with " +
|
LOG.info("Created " + numForums + " forums with " +
|
||||||
NUM_FORUM_POSTS + " posts each.");
|
numForumPosts + " posts each.");
|
||||||
}
|
}
|
||||||
return forums;
|
return forums;
|
||||||
}
|
}
|
||||||
@@ -370,7 +380,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
|
|||||||
private void createRandomForumPosts(Forum forum, List<Contact> contacts)
|
private void createRandomForumPosts(Forum forum, List<Contact> contacts)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
List<ForumPost> posts = new ArrayList<>();
|
List<ForumPost> posts = new ArrayList<>();
|
||||||
for (int i = 0; i < NUM_FORUM_POSTS; i++) {
|
for (int i = 0; i < numForumPosts; i++) {
|
||||||
Contact contact = contacts.get(random.nextInt(contacts.size()));
|
Contact contact = contacts.get(random.nextInt(contacts.size()));
|
||||||
LocalAuthor author = localAuthors.get(contact);
|
LocalAuthor author = localAuthors.get(contact);
|
||||||
long timestamp = clock.currentTimeMillis() - i * 60 * 1000;
|
long timestamp = clock.currentTimeMillis() - i * 60 * 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user