conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
protected static void initTextHovers(List<Class<? extends ILangEditorTextHover<?>>> textHoverSpecifications) {
textHoverSpecifications.add(ProblemHover.class);
textHoverSpecifications.add(GoDocHover.class);
textHoverSpecifications.add(AnnotationHover.class);
=======
@SuppressWarnings("unused")
protected static void initTextHovers_afterProblemHover(
List<Class<? extends ILangEditorTextHover<?>>> textHoverSpecifications) {
>>>>>>>
protected static void initTextHovers_afterProblemHover(
List<Class<? extends ILangEditorTextHover<?>>> textHoverSpecifications) {
textHoverSpecifications.add(GoDocHover.class); |
<<<<<<<
private boolean shouldStartAnimation;
private boolean layoutDone;
=======
private int progress;
>>>>>>>
private boolean shouldStartAnimation;
private boolean layoutDone;
private int progress;
<<<<<<<
layoutDone = true;
if (shouldStartAnimation) {
startAnimation();
}
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
drawIndeterminateProgress(canvas);
=======
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
drawProgress(canvas);
>>>>>>>
layoutDone = true;
if (shouldStartAnimation) {
startAnimation();
}
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
drawIndeterminateProgress(canvas);
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
drawProgress(canvas); |
<<<<<<<
import com.actionbarsherlock.app.SherlockActivity;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.enums.WidgetListType;
import com.battlelancer.seriesguide.util.Utils;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.battlelancer.seriesguide.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.Constants;
>>>>>>>
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.Constants; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.ui.SeriesGuidePreferences;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.enums.WidgetListType;
>>>>>>>
import com.battlelancer.seriesguide.enums.WidgetListType; |
<<<<<<<
package com.battlelancer.seriesguide.ui;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Window;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.battlelancer.seriesguide.ui.AddDialogFragment.OnAddShowListener;
import com.battlelancer.seriesguide.util.ShareUtils;
import com.battlelancer.seriesguide.util.TaskManager;
import com.viewpagerindicator.TabPageIndicator;
import com.viewpagerindicator.TitleProvider;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.widget.EditText;
public class AddActivity extends BaseActivity implements OnAddShowListener {
private AddPagerAdapter mAdapter;
private ViewPager mPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The TvdbAddFragment uses a progress bar
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.addactivity_pager);
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setProgressBarIndeterminateVisibility(Boolean.FALSE);
setSupportProgressBarIndeterminateVisibility(false);
mAdapter = new AddPagerAdapter(getSupportFragmentManager(), this);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(mPager);
}
public static class AddPagerAdapter extends FragmentPagerAdapter implements TitleProvider {
private Context mContext;
public AddPagerAdapter(FragmentManager fm, Context context) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
if (position == 0) {
return TvdbAddFragment.newInstance();
} else {
return TraktAddFragment.newInstance(position);
}
}
@Override
public int getCount() {
final boolean isValidCredentials = ShareUtils.isTraktCredentialsValid(mContext);
if (isValidCredentials) {
// show trakt recommended and libraried shows, too
return 4;
} else {
// show search results and trakt trending shows
return 2;
}
}
@Override
public String getTitle(int position) {
switch (position) {
case 1:
return mContext.getString(R.string.trending).toUpperCase();
case 2:
return mContext.getString(R.string.recommended).toUpperCase();
case 3:
return mContext.getString(R.string.library).toUpperCase();
default:
return mContext.getString(R.string.search_button).toUpperCase();
}
}
}
@Override
public void onAddShow(SearchResult show) {
// clear the search field (if it is shown)
EditText searchbox = (EditText) findViewById(R.id.searchbox);
if (searchbox != null) {
searchbox.setText("");
}
TaskManager.getInstance(this).performAddTask(show);
}
}
=======
package com.battlelancer.seriesguide.ui;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Window;
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.battlelancer.seriesguide.ui.dialogs.AddDialogFragment.OnAddShowListener;
import com.battlelancer.seriesguide.util.TaskManager;
import com.battlelancer.seriesguide.util.Utils;
import com.viewpagerindicator.TabPageIndicator;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.widget.EditText;
public class AddActivity extends BaseActivity implements OnAddShowListener {
private AddPagerAdapter mAdapter;
private ViewPager mPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The TvdbAddFragment uses a progress bar
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.addactivity_pager);
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setProgressBarIndeterminateVisibility(Boolean.FALSE);
setSupportProgressBarIndeterminateVisibility(false);
mAdapter = new AddPagerAdapter(getSupportFragmentManager(), this);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(mPager);
}
public static class AddPagerAdapter extends FragmentPagerAdapter {
private Context mContext;
public AddPagerAdapter(FragmentManager fm, Context context) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
if (position == 0) {
return TvdbAddFragment.newInstance();
} else {
return TraktAddFragment.newInstance(position);
}
}
@Override
public int getCount() {
final boolean isValidCredentials = Utils.isTraktCredentialsValid(mContext);
if (isValidCredentials) {
// show trakt recommended and libraried shows, too
return 4;
} else {
// show search results and trakt trending shows
return 2;
}
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 1:
return mContext.getString(R.string.trending).toUpperCase();
case 2:
return mContext.getString(R.string.recommended).toUpperCase();
case 3:
return mContext.getString(R.string.library).toUpperCase();
default:
return mContext.getString(R.string.search_button).toUpperCase();
}
}
}
@Override
public void onAddShow(SearchResult show) {
// clear the search field (if it is shown)
EditText searchbox = (EditText) findViewById(R.id.searchbox);
if (searchbox != null) {
searchbox.setText("");
}
TaskManager.getInstance(this).performAddTask(show);
}
}
>>>>>>>
package com.battlelancer.seriesguide.ui;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Window;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.battlelancer.seriesguide.ui.dialogs.AddDialogFragment.OnAddShowListener;
import com.battlelancer.seriesguide.util.TaskManager;
import com.battlelancer.seriesguide.util.Utils;
import com.viewpagerindicator.TabPageIndicator;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.widget.EditText;
public class AddActivity extends BaseActivity implements OnAddShowListener {
private AddPagerAdapter mAdapter;
private ViewPager mPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The TvdbAddFragment uses a progress bar
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.addactivity_pager);
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setProgressBarIndeterminateVisibility(Boolean.FALSE);
setSupportProgressBarIndeterminateVisibility(false);
mAdapter = new AddPagerAdapter(getSupportFragmentManager(), this);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(mPager);
}
public static class AddPagerAdapter extends FragmentPagerAdapter {
private Context mContext;
public AddPagerAdapter(FragmentManager fm, Context context) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
if (position == 0) {
return TvdbAddFragment.newInstance();
} else {
return TraktAddFragment.newInstance(position);
}
}
@Override
public int getCount() {
final boolean isValidCredentials = Utils.isTraktCredentialsValid(mContext);
if (isValidCredentials) {
// show trakt recommended and libraried shows, too
return 4;
} else {
// show search results and trakt trending shows
return 2;
}
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 1:
return mContext.getString(R.string.trending).toUpperCase();
case 2:
return mContext.getString(R.string.recommended).toUpperCase();
case 3:
return mContext.getString(R.string.library).toUpperCase();
default:
return mContext.getString(R.string.search_button).toUpperCase();
}
}
}
@Override
public void onAddShow(SearchResult show) {
// clear the search field (if it is shown)
EditText searchbox = (EditText) findViewById(R.id.searchbox);
if (searchbox != null) {
searchbox.setText("");
}
TaskManager.getInstance(this).performAddTask(show);
}
} |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.battlelancer.seriesguide.R; |
<<<<<<<
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.battlelancer.seriesguide.R; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
import com.battlelancer.thetvdbapi.SearchResult;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.thetvdbapi.SearchResult; |
<<<<<<<
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
=======
import net.minecraftforge.fe.event.player.PlayerPostInteractEvent;
>>>>>>>
import net.minecraftforge.fe.event.player.PlayerPostInteractEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
<<<<<<<
import com.forgeessentials.util.ServerUtil;
=======
import com.forgeessentials.playerlogger.event.LogEventPostInteract;
>>>>>>>
import com.forgeessentials.playerlogger.event.LogEventPostInteract;
import com.forgeessentials.util.ServerUtil; |
<<<<<<<
=======
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
>>>>>>>
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.google.analytics.tracking.android.EasyTracker;
=======
>>>>>>> |
<<<<<<<
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.battlelancer.thetvdbapi.TheTVDB;
import com.google.analytics.tracking.android.EasyTracker;
import com.uwetrottmann.androidutils.AndroidUtils;
import org.xml.sax.SAXException;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.Constants;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.Episode;
import com.battlelancer.seriesguide.items.Series;
import com.battlelancer.seriesguide.provider.SeriesContract.Episodes;
import com.battlelancer.seriesguide.provider.SeriesContract.Seasons;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.Constants;
import com.battlelancer.seriesguide.items.Episode;
import com.battlelancer.seriesguide.items.Series;
import com.battlelancer.seriesguide.provider.SeriesContract.Episodes;
import com.battlelancer.seriesguide.provider.SeriesContract.Seasons; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils; |
<<<<<<<
import com.actionbarsherlock.app.SherlockListFragment;
import com.battlelancer.seriesguide.R;
=======
import com.actionbarsherlock.app.SherlockFragment;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.actionbarsherlock.app.SherlockFragment;
import com.battlelancer.seriesguide.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;
import com.battlelancer.seriesguide.R; |
<<<<<<<
// display whats new dialog
int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
try {
int currentVersion = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_META_DATA).versionCode;
if (currentVersion > lastVersion) {
// BETA warning dialog switch
showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// set this as lastVersion
prefs.edit().putInt(SeriesGuideData.KEY_VERSION, currentVersion).commit();
}
} catch (NameNotFoundException e) {
// this should never happen
}
=======
// // display whats new dialog
// int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
// try {
// int currentVersion =
// getPackageManager().getPackageInfo(getPackageName(),
// PackageManager.GET_META_DATA).versionCode;
// if (currentVersion > lastVersion) {
// // BETA warning dialog switch
// showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// // set this as lastVersion
// prefs.edit().putInt(SeriesGuideData.KEY_VERSION,
// currentVersion).commit();
// }
// } catch (NameNotFoundException e) {
// // this should never happen
// }
prefs.registerOnSharedPreferenceChangeListener(mPrefsListener);
}
private void updateFilters(SharedPreferences prefs) {
mOnlyUnwatchedShows = prefs.getBoolean(SeriesGuidePreferences.KEY_ONLY_UNWATCHED_SHOWS,
false);
>>>>>>>
// display whats new dialog
int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
try {
int currentVersion = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_META_DATA).versionCode;
if (currentVersion > lastVersion) {
// BETA warning dialog switch
showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// set this as lastVersion
prefs.edit().putInt(SeriesGuideData.KEY_VERSION, currentVersion).commit();
}
} catch (NameNotFoundException e) {
// this should never happen
}
prefs.registerOnSharedPreferenceChangeListener(mPrefsListener);
}
private void updateFilters(SharedPreferences prefs) {
mOnlyUnwatchedShows = prefs.getBoolean(SeriesGuidePreferences.KEY_ONLY_UNWATCHED_SHOWS,
false); |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.provider.SeriesGuideDatabase;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.provider.SeriesGuideDatabase; |
<<<<<<<
=======
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.MenuItem;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.MenuItem;
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.Series;
>>>>>>>
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.Series; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.getglueapi.GetGlue.CheckInTask;
=======
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.getglueapi.GetGlue.CheckInTask; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.thetvdbapi.SearchResult;
=======
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.SearchResult;
>>>>>>>
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult; |
<<<<<<<
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
=======
import net.minecraftforge.fe.event.entity.EntityPortalEvent;
>>>>>>>
import net.minecraftforge.fe.event.entity.EntityPortalEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
import com.battlelancer.seriesguide.provider.SeriesContract.Episodes;
import com.battlelancer.seriesguide.ui.dialogs.AddDialogFragment;
import com.battlelancer.seriesguide.util.ImageDownloader;
import com.battlelancer.seriesguide.util.Utils;
import com.jakewharton.apibuilder.ApiException;
import com.jakewharton.trakt.ServiceManager;
import com.jakewharton.trakt.TraktException;
import com.jakewharton.trakt.entities.ActivityItem;
import com.jakewharton.trakt.entities.ActivityItemBase;
import com.jakewharton.trakt.entities.TvShow;
import com.jakewharton.trakt.entities.TvShowEpisode;
import com.jakewharton.trakt.entities.UserProfile;
import com.jakewharton.trakt.enumerations.ActivityType;
import com.uwetrottmann.androidutils.AndroidUtils;
=======
>>>>>>> |
<<<<<<<
import net.minecraft.util.BlockPos;
=======
import net.minecraft.server.MinecraftServer;
>>>>>>>
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
<<<<<<<
public boolean canConsoleUseCommand()
{
return false;
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
=======
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args)
>>>>>>>
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) |
<<<<<<<
import com.battlelancer.seriesguide.Constants.ShowSorting;
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.provider.SeriesContract;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
<<<<<<<
import com.battlelancer.seriesguide.ui.dialogs.ChangesDialogFragment;
import com.battlelancer.seriesguide.ui.dialogs.ConfirmDeleteDialogFragment;
import com.battlelancer.seriesguide.ui.dialogs.SortDialogFragment;
import com.battlelancer.seriesguide.ui.dialogs.WelcomeDialogFragment;
import com.battlelancer.seriesguide.util.CompatActionBarNavHandler;
import com.battlelancer.seriesguide.util.CompatActionBarNavListener;
import com.battlelancer.seriesguide.util.DBUtils;
=======
>>>>>>>
<<<<<<<
// Show Filter Ids
private static final int SHOWFILTER_ALL = 0;
private static final int SHOWFILTER_FAVORITES = 1;
private static final int SHOWFILTER_UNSEENEPISODES = 2;
private static final int SHOWFILTER_HIDDEN = 3;
private static final String FILTER_ID = "filterid";
private static final int VER_TRAKT_SEC_CHANGES = 139;
=======
private static final int VER_TRAKT_SEC_CHANGES = 131;
>>>>>>>
private static final int VER_TRAKT_SEC_CHANGES = 131; |
<<<<<<<
package com.battlelancer.seriesguide.util;
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.thetvdbapi.ImageCache;
import com.battlelancer.thetvdbapi.TheTVDB;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class FetchArtTask extends AsyncTask<Void, Void, Bitmap> {
private String mPath;
private ImageView mImageView;
private Context mContext;
private View mProgressContainer;
private View mContainer;
private ImageCache mImageCache;
private boolean mAnimate;
public FetchArtTask(String path, View container, Context context) {
mPath = path;
mContainer = container;
mContext = context;
mImageCache = ImageCache.getInstance(context);
}
@Override
protected void onPreExecute() {
// immediately hide container if there is no image
if (mPath.length() == 0) {
mContainer.setVisibility(View.GONE);
return;
} else {
mContainer.setVisibility(View.VISIBLE);
}
mImageView = (ImageView) mContainer.findViewById(R.id.ImageViewEpisodeImage);
mProgressContainer = mContainer.findViewById(R.id.progress_container);
// only make progress container visible if we will do long running op
if (!mImageCache.isCached(mPath)) {
mProgressContainer.setVisibility(View.VISIBLE);
mImageView.setVisibility(View.GONE);
}
}
@Override
protected Bitmap doInBackground(Void... params) {
if (isCancelled()) {
return null;
}
if (mPath.length() != 0) {
final Bitmap bitmap = mImageCache.get(mPath);
if (bitmap != null) {
// image is in cache
mAnimate = false;
return bitmap;
} else {
if (isCancelled()) {
return null;
}
// download image from TVDb
if (TheTVDB.fetchArt(mPath, false, mContext)) {
mAnimate = true;
return mImageCache.get(mPath);
}
}
}
return null;
}
@Override
protected void onCancelled() {
releaseReferences();
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null) {
mImageView.setImageBitmap(bitmap);
// make image view visible
if (mAnimate) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_out));
mImageView.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_in));
} else {
mProgressContainer.clearAnimation();
mImageView.clearAnimation();
}
mProgressContainer.setVisibility(View.GONE);
mImageView.setVisibility(View.VISIBLE);
} else {
mContainer.setVisibility(View.GONE);
}
releaseReferences();
}
private void releaseReferences() {
mContext = null;
mContainer = null;
mProgressContainer = null;
mImageView = null;
mImageCache = null;
}
}
=======
package com.battlelancer.seriesguide.util;
import com.battlelancer.seriesguide.R;
import com.battlelancer.thetvdbapi.ImageCache;
import com.battlelancer.thetvdbapi.TheTVDB;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class FetchArtTask extends AsyncTask<Void, Void, Bitmap> {
private String mPath;
private ImageView mImageView;
private Context mContext;
private View mProgressContainer;
private View mContainer;
private ImageCache mImageCache;
public FetchArtTask(String path, View container, Context context) {
mPath = path;
mContainer = container;
mContext = context;
mImageCache = ImageCache.getInstance(context);
}
@Override
protected void onPreExecute() {
// immediately hide container if there is no image
if (mPath.length() == 0) {
mContainer.setVisibility(View.GONE);
return;
} else {
mContainer.setVisibility(View.VISIBLE);
}
mImageView = (ImageView) mContainer.findViewById(R.id.ImageViewEpisodeImage);
mProgressContainer = mContainer.findViewById(R.id.progress_container);
// only make progress container visible if we will do long running op
if (!mImageCache.isCached(mPath)) {
mProgressContainer.setVisibility(View.VISIBLE);
mImageView.setVisibility(View.GONE);
}
}
@Override
protected Bitmap doInBackground(Void... params) {
if (isCancelled()) {
return null;
}
if (mPath.length() != 0) {
final Bitmap bitmap = mImageCache.get(mPath);
if (bitmap != null) {
// image is in cache
return bitmap;
} else {
if (isCancelled()) {
return null;
}
// download image from TVDb
if (TheTVDB.fetchArt(mPath, false, mContext)) {
return mImageCache.get(mPath);
}
}
}
return null;
}
@Override
protected void onCancelled() {
releaseReferences();
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null) {
mImageView.setImageBitmap(bitmap);
// make image view visible
if (mImageView.getVisibility() == View.GONE) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_out));
mImageView.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_in));
mProgressContainer.setVisibility(View.GONE);
mImageView.setVisibility(View.VISIBLE);
}
} else {
mContainer.setVisibility(View.GONE);
}
releaseReferences();
}
private void releaseReferences() {
mContext = null;
mContainer = null;
mProgressContainer = null;
mImageView = null;
mImageCache = null;
}
}
>>>>>>>
package com.battlelancer.seriesguide.util;
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.thetvdbapi.ImageCache;
import com.battlelancer.thetvdbapi.TheTVDB;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class FetchArtTask extends AsyncTask<Void, Void, Bitmap> {
private String mPath;
private ImageView mImageView;
private Context mContext;
private View mProgressContainer;
private View mContainer;
private ImageCache mImageCache;
public FetchArtTask(String path, View container, Context context) {
mPath = path;
mContainer = container;
mContext = context;
mImageCache = ImageCache.getInstance(context);
}
@Override
protected void onPreExecute() {
// immediately hide container if there is no image
if (mPath.length() == 0) {
mContainer.setVisibility(View.GONE);
return;
} else {
mContainer.setVisibility(View.VISIBLE);
}
mImageView = (ImageView) mContainer.findViewById(R.id.ImageViewEpisodeImage);
mProgressContainer = mContainer.findViewById(R.id.progress_container);
// only make progress container visible if we will do long running op
if (!mImageCache.isCached(mPath)) {
mProgressContainer.setVisibility(View.VISIBLE);
mImageView.setVisibility(View.GONE);
}
}
@Override
protected Bitmap doInBackground(Void... params) {
if (isCancelled()) {
return null;
}
if (mPath.length() != 0) {
final Bitmap bitmap = mImageCache.get(mPath);
if (bitmap != null) {
// image is in cache
return bitmap;
} else {
if (isCancelled()) {
return null;
}
// download image from TVDb
if (TheTVDB.fetchArt(mPath, false, mContext)) {
return mImageCache.get(mPath);
}
}
}
return null;
}
@Override
protected void onCancelled() {
releaseReferences();
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null) {
mImageView.setImageBitmap(bitmap);
// make image view visible
if (mImageView.getVisibility() == View.GONE) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_out));
mImageView.startAnimation(AnimationUtils.loadAnimation(mContext,
android.R.anim.fade_in));
mProgressContainer.setVisibility(View.GONE);
mImageView.setVisibility(View.VISIBLE);
}
} else {
mContainer.setVisibility(View.GONE);
}
releaseReferences();
}
private void releaseReferences() {
mContext = null;
mContainer = null;
mProgressContainer = null;
mImageView = null;
mImageCache = null;
}
} |
<<<<<<<
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.battlelancer.seriesguide.Constants.ShowSorting;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.provider.SeriesContract;
import com.battlelancer.seriesguide.provider.SeriesContract.Shows;
import com.battlelancer.seriesguide.ui.dialogs.ConfirmDeleteDialogFragment;
import com.battlelancer.seriesguide.ui.dialogs.SortDialogFragment;
import com.battlelancer.seriesguide.util.CompatActionBarNavHandler;
import com.battlelancer.seriesguide.util.CompatActionBarNavListener;
import com.battlelancer.seriesguide.util.DBUtils;
import com.battlelancer.seriesguide.util.ImageProvider;
import com.battlelancer.seriesguide.util.TaskManager;
import com.battlelancer.seriesguide.util.Utils;
import com.google.analytics.tracking.android.EasyTracker;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.thetvdbapi.SearchResult;
=======
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.SearchResult;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.SearchResult; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.ui.WelcomeDialogFragment;
>>>>>>>
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.ui.WelcomeDialogFragment; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.Series;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.Series; |
<<<<<<<
import com.battlelancer.seriesguide.Constants;
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.actionbarsherlock.app.SherlockDialogFragment;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.getglueapi.GetGlue;
import com.battlelancer.seriesguide.getglueapi.GetGlue.CheckInTask;
import com.battlelancer.seriesguide.getglueapi.PrepareRequestTokenActivity;
import com.battlelancer.seriesguide.ui.SeriesGuidePreferences;
import com.battlelancer.seriesguide.util.ShareUtils.ProgressDialog;
import com.battlelancer.seriesguide.util.ShareUtils.ShareItems;
import com.battlelancer.seriesguide.util.TraktTask;
import com.battlelancer.seriesguide.util.Utils;
import com.google.analytics.tracking.android.EasyTracker;
import com.uwetrottmann.androidutils.AndroidUtils;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.SeriesGuideData;
import com.battlelancer.seriesguide.SeriesGuideData.EpisodeSorting;
=======
import com.battlelancer.seriesguide.Constants;
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.Constants; |
<<<<<<<
=======
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.FALSE;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.OP;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.TRUE;
import java.util.HashMap;
import java.util.Map;
>>>>>>>
<<<<<<<
import java.util.HashMap;
import java.util.Map;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.FALSE;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.OP;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.TRUE;
=======
import cpw.mods.fml.common.FMLLog;
>>>>>>>
import java.util.HashMap;
import java.util.Map;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.FALSE;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.OP;
import static net.minecraftforge.permissions.PermissionsManager.RegisteredPermValue.TRUE;
import cpw.mods.fml.common.FMLLog; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.battlelancer.seriesguide.R; |
<<<<<<<
=======
public static boolean worldSaving;
>>>>>>>
public static boolean worldSaving;
<<<<<<<
=======
worldSaving = config.get(AUTOBACKUP, "worldSaving", true, "If false, doesn't save wold continuesly.").getBoolean(false);
>>>>>>>
worldSaving = config.get(AUTOBACKUP, "worldSaving", true, "If false, doesn't save wold continuesly.").getBoolean(false);
<<<<<<<
config.get(AUTOBACKUP, "interval", 30, "Interval in minutes. 0 to disable").set(autoInterval);
config.get(AUTOBACKUP, "worldSaveInterval", 10, "Does a save-all every X minutes. 0 to disable").set(worldSaveInterval);
config.get(AUTOBACKUP, "whitelist", new int[] {}, "Always make a backup of these dims. Even when empty.").set(whitelist.toArray(new String[0]));
config.get(AUTOBACKUP, "blacklist", new int[] {}, "Don't make automatic backups of these dims. Can still be done via command.").set(blacklist.toArray(new String[0]));
config.get(AUTOBACKUP, "extraFolders", new String[] { "" }, "Make a backup of these folders every autoBackup. Relative to server.jar").set(extraFolders.toArray(new String[0]));
=======
config.get(AUTOBACKUP, "interval", 30, "Interval in minutes. 0 to disable").value = autoInterval + "";
config.get(AUTOBACKUP, "worldSaveInterval", 10, "Does a save-all every X minutes. 0 to disable").value = worldSaveInterval + "";
config.get(AUTOBACKUP, "worldSaving", false, "If false, doesn't save wold continuesly.").value = worldSaving + "";
config.get(AUTOBACKUP, "whitelist", new int[] {}, "Always make a backup of these dims. Even when empty.").valueList = whitelist.toArray(new String[0]);
config.get(AUTOBACKUP, "blacklist", new int[] {}, "Don't make automatic backups of these dims. Can still be done via command.").valueList = blacklist.toArray(new String[0]);
config.get(AUTOBACKUP, "extraFolders", new String[] { "" }, "Make a backup of these folders every autoBackup. Relative to server.jar").valueList = extraFolders.toArray(new String[0]);
>>>>>>>
config.get(AUTOBACKUP, "interval", 30, "Interval in minutes. 0 to disable").set(autoInterval);
config.get(AUTOBACKUP, "worldSaveInterval", 10, "Does a save-all every X minutes. 0 to disable").set(worldSaveInterval);
config.get(AUTOBACKUP, "worldSaving", false, "If false, doesn't save wold continuesly.").set(worldSaving);
config.get(AUTOBACKUP, "whitelist", new int[] {}, "Always make a backup of these dims. Even when empty.").set(whitelist.toArray(new String[0]));
config.get(AUTOBACKUP, "blacklist", new int[] {}, "Don't make automatic backups of these dims. Can still be done via command.").set(blacklist.toArray(new String[0]));
config.get(AUTOBACKUP, "extraFolders", new String[] { "" }, "Make a backup of these folders every autoBackup. Relative to server.jar").set(extraFolders.toArray(new String[0]));
<<<<<<<
=======
worldSaving = config.get(AUTOBACKUP, "worldSaving", true, "If false, doesn't save wold continuesly.").getBoolean(false);
>>>>>>>
worldSaving = config.get(AUTOBACKUP, "worldSaving", true, "If false, doesn't save wold continuesly.").getBoolean(false); |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.thetvdbapi.SearchResult;
>>>>>>>
import com.battlelancer.seriesguide.R;
import com.battlelancer.thetvdbapi.SearchResult; |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.util.Utils;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils;
=======
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils; |
<<<<<<<
// display whats new dialog
int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
try {
int currentVersion = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_META_DATA).versionCode;
if (currentVersion > lastVersion) {
// BETA warning dialog switch
showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// set this as lastVersion
prefs.edit().putInt(SeriesGuideData.KEY_VERSION, currentVersion).commit();
}
} catch (NameNotFoundException e) {
// this should never happen
}
=======
// between-version upgrade code
int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
try {
int currentVersion = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_META_DATA).versionCode;
if (currentVersion > lastVersion) {
switch (currentVersion) {
case VER_TRAKT_SEC_CHANGES:
prefs.edit().putString(SeriesGuidePreferences.PREF_TRAKTPWD, "").commit();
}
// // BETA warning dialog switch
// showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// set this as lastVersion
prefs.edit().putInt(SeriesGuideData.KEY_VERSION, currentVersion).commit();
}
} catch (NameNotFoundException e) {
// this should never happen
}
>>>>>>>
// between-version upgrade code
int lastVersion = prefs.getInt(SeriesGuideData.KEY_VERSION, -1);
try {
int currentVersion = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_META_DATA).versionCode;
if (currentVersion > lastVersion) {
switch (currentVersion) {
case VER_TRAKT_SEC_CHANGES:
prefs.edit().putString(SeriesGuidePreferences.PREF_TRAKTPWD, "").commit();
}
// BETA warning dialog switch
showDialog(BETA_WARNING_DIALOG);
// showDialog(WHATS_NEW_DIALOG);
// set this as lastVersion
prefs.edit().putInt(SeriesGuideData.KEY_VERSION, currentVersion).commit();
}
} catch (NameNotFoundException e) {
// this should never happen
} |
<<<<<<<
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.Constants.ShowSorting;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.provider.SeriesContract;
import com.battlelancer.seriesguide.provider.SeriesContract.Episodes;
import com.battlelancer.seriesguide.provider.SeriesContract.Shows;
import com.battlelancer.seriesguide.ui.dialogs.CheckInDialogFragment;
import com.battlelancer.seriesguide.util.ImageProvider;
import com.battlelancer.seriesguide.util.ShareUtils;
import com.battlelancer.seriesguide.util.Utils;
import com.google.analytics.tracking.android.EasyTracker;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.util.AnalyticsUtils;
=======
import com.battlelancer.seriesguide.R;
import com.google.analytics.tracking.android.EasyTracker;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.google.analytics.tracking.android.EasyTracker; |
<<<<<<<
import com.battlelancer.seriesguide.Constants;
import com.battlelancer.seriesguide.beta.R;
=======
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.items.Series;
import com.battlelancer.seriesguide.util.DBUtils;
=======
import com.battlelancer.seriesguide.beta.R;
>>>>>>>
import com.battlelancer.seriesguide.beta.R;
import com.battlelancer.seriesguide.items.Series;
import com.battlelancer.seriesguide.util.DBUtils; |
<<<<<<<
import com.battlelancer.seriesguide.R;
=======
>>>>>>> |
<<<<<<<
import com.battlelancer.seriesguide.beta.R;
=======
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.R;
>>>>>>>
import com.actionbarsherlock.app.ActionBar;
import com.battlelancer.seriesguide.beta.R; |
<<<<<<<
import com.forgeessentials.util.ServerUtil;
=======
import com.forgeessentials.util.ItemUtil;
import cpw.mods.fml.common.registry.GameData;
>>>>>>>
import com.forgeessentials.util.ItemUtil;
import com.forgeessentials.util.ServerUtil;
<<<<<<<
public static int getItemDamage(ItemStack stack)
{
try
{
return stack.getItemDamage();
}
catch (Exception e)
{
return 0;
}
}
public static void parseSetprice(CommandParserArgs arguments) throws CommandException
=======
public static void parseSetprice(CommandParserArgs arguments)
>>>>>>>
public static void parseSetprice(CommandParserArgs arguments) throws CommandException
<<<<<<<
File craftRecipesFile = new File(ForgeEssentials.getFEDirectory(), "craft_recipes.txt");
try (BufferedWriter craftRecipes = new BufferedWriter(new FileWriter(craftRecipesFile)))
{
for (Iterator<IRecipe> iterator = recipes.iterator(); iterator.hasNext();)
{
IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput() == null)
continue;
List<?> recipeItems = getRecipeItems(recipe);
if (recipeItems == null)
continue;
craftRecipes.write(String.format("%s:%d\n", ServerUtil.getItemName(recipe.getRecipeOutput().getItem()),
getItemDamage(recipe.getRecipeOutput())));
for (Object stacks : recipeItems)
if (stacks != null)
{
ItemStack stack = null;
if (stacks instanceof List<?>)
{
if (!((List<?>) stacks).isEmpty())
stack = (ItemStack) ((List<?>) stacks).get(0);
}
else
stack = (ItemStack) stacks;
if (stack != null)
craftRecipes.write(String.format(" %s:%d\n", ServerUtil.getItemName(stack.getItem()), getItemDamage(stack)));
}
}
}
=======
>>>>>>>
<<<<<<<
String msg = String.format("%s:%d = %.0f -> %s", ServerUtil.getItemName(recipe.getRecipeOutput().getItem()),
getItemDamage(recipe.getRecipeOutput()), resultPrice == null ? 0 : resultPrice, (int) price);
=======
String msg = String.format("%s:%d = %.0f -> %s", getItemId(recipe.getRecipeOutput().getItem()),
ItemUtil.getItemDamage(recipe.getRecipeOutput()), resultPrice == null ? 0 : resultPrice, (int) price);
>>>>>>>
String msg = String.format("%s:%d = %.0f -> %s", ServerUtil.getItemName(recipe.getRecipeOutput().getItem()),
ItemUtil.getItemDamage(recipe.getRecipeOutput()), resultPrice == null ? 0 : resultPrice, (int) price);
<<<<<<<
msg += String.format("\n %.0f - %s:%d", priceMap.get(ModuleEconomy.getItemIdentifier(stack)),
ServerUtil.getItemName(stack.getItem()), getItemDamage(stack));
=======
msg += String.format("\n %.0f - %s:%d", priceMap.get(ItemUtil.getItemIdentifier(stack)),
getItemId(stack.getItem()), ItemUtil.getItemDamage(stack));
>>>>>>>
msg += String.format("\n %.0f - %s:%d", priceMap.get(ItemUtil.getItemIdentifier(stack)),
ServerUtil.getItemName(stack.getItem()), ItemUtil.getItemDamage(stack));
<<<<<<<
priceMap.put(ModuleEconomy.getItemIdentifier(recipe.getValue()), outPrice);
writer.write(String.format("%s:%d = %.0f -> %d\n %s\n", ServerUtil.getItemName(recipe.getValue().getItem()),
getItemDamage(recipe.getValue()), resultPrice == null ? 0 : resultPrice, (int) outPrice,
ServerUtil.getItemName(recipe.getKey().getItem())));
=======
priceMap.put(ItemUtil.getItemIdentifier(recipe.getValue()), outPrice);
writer.write(String.format("%s:%d = %.0f -> %d\n %s\n", getItemId(recipe.getValue().getItem()), ItemUtil.getItemDamage(recipe
.getValue()), resultPrice == null ? 0 : resultPrice, (int) outPrice, getItemId(recipe.getKey().getItem())));
>>>>>>>
priceMap.put(ItemUtil.getItemIdentifier(recipe.getValue()), outPrice);
writer.write(String.format("%s:%d = %.0f -> %d\n %s\n", ServerUtil.getItemName(recipe.getValue().getItem()), ItemUtil.getItemDamage(
recipe.getValue()), resultPrice == null ? 0 : resultPrice, (int) outPrice, ServerUtil.getItemName(recipe.getKey().getItem()))); |
<<<<<<<
public class CommandDoAs extends FEcmdModuleCommands
=======
import cpw.mods.fml.common.FMLCommonHandler;
public class CommandDoAs extends ForgeEssentialsCommandBase
>>>>>>>
public class CommandDoAs extends ForgeEssentialsCommandBase |
<<<<<<<
BlockArrayClipboard clipboard = new BlockArrayClipboard(cRegion);
clipboard.setOrigin(origin);
Extent source = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Extent destination = clipboard;
ForwardExtentCopy copy = new ForwardExtentCopy(source, cRegion, clipboard.getOrigin(), destination, clipboard.getOrigin());
BlockMask mask = new BlockMask(source, blockSet);
copy.setSourceMask(mask);
=======
>>>>>>> |
<<<<<<<
import static com.google.gerrit.json.OutputFormat.JSON;
=======
import static com.google.gerrit.server.OutputFormat.JSON;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthRequest;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
>>>>>>>
import static com.google.gerrit.json.OutputFormat.JSON;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthRequest;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
<<<<<<<
Response response = request.send();
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
}
if (log.isDebugEnabled()) {
log.debug("User info response: {}", response.getBody());
}
JsonElement userJson = JSON.newGson().fromJson(response.getBody(), JsonElement.class);
if (!userJson.isJsonObject()) {
throw new IOException(String.format("Invalid JSON '%s': not a JSON Object", userJson));
}
JsonObject jsonObject = userJson.getAsJsonObject();
=======
try (Response response = service.execute(request)) {
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
}
>>>>>>>
try (Response response = service.execute(request)) {
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
} |
<<<<<<<
import static com.google.gerrit.json.OutputFormat.JSON;
=======
import static com.google.gerrit.server.OutputFormat.JSON;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthRequest;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
>>>>>>>
import static com.google.gerrit.json.OutputFormat.JSON;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthRequest;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
<<<<<<<
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
}
JsonElement userJson = JSON.newGson().fromJson(response.getBody(), JsonElement.class);
=======
JsonElement userJson = null;
try (Response response = service.execute(request)) {
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
}
userJson = JSON.newGson().fromJson(response.getBody(), JsonElement.class);
>>>>>>>
JsonElement userJson = null;
try (Response response = service.execute(request)) {
if (response.getCode() != HttpServletResponse.SC_OK) {
throw new IOException(
String.format(
"Status %s (%s) for request %s",
response.getCode(), response.getBody(), request.getUrl()));
}
userJson = JSON.newGson().fromJson(response.getBody(), JsonElement.class); |
<<<<<<<
import com.forgeessentials.util.UserIdent;
import com.forgeessentials.commons.selections.WorldArea;
import com.forgeessentials.commons.selections.WorldPoint;
=======
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
>>>>>>>
import java.util.Collection;
import java.util.List;
import java.util.SortedSet;
import com.forgeessentials.util.UserIdent;
import com.forgeessentials.commons.selections.WorldArea;
import com.forgeessentials.commons.selections.WorldPoint; |
<<<<<<<
TestConfDir(String name, boolean writeExpireDate) {
this(name);
this.writeExpireDate = writeExpireDate;
}
=======
>>>>>>> |
<<<<<<<
public boolean canConsoleUseCommand()
{
return true;
}
@Override
public void registerExtraPermissions()
{
APIRegistry.perms.registerPermission(getPermissionNode() + ".edit", PermissionLevel.OP);
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
=======
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args)
>>>>>>>
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) |
<<<<<<<
=======
private static final int RETURN_SUCCESS = 0;
private static final int ERROR_CODE_INTERNAL = 125;
private static final int ERROR_CODE_INVALID_SIGNATURE_VALUE = 124;
private static final int ERROR_CODE_EXPIRED_CONF = 123;
private static final int ERROR_CODE_CANNOT_DOWNLOAD_CONF = 122;
private static final int ERROR_CODE_MISSING_PRIVATE_PARAMS = 121;
private static final int ERROR_CODE_ANCHOR_NOT_FOR_EXTERNAL_SOURCE = 120;
>>>>>>>
<<<<<<<
adminPort.addHandler("/execute", new AdminPort.SynchronousCallback() {
@Override
public void run() {
log.info("handler /execute");
try {
client.execute();
} catch (Exception e) {
throw translateException(e);
}
=======
adminPort.addHandler("/execute", (AdminPort.SynchronousCallback) () -> {
log.info("Execute from admin port...");
try {
client.execute();
} catch (Exception e) {
throw translateException(e);
>>>>>>>
adminPort.addHandler("/execute", new AdminPort.SynchronousCallback() {
@Override
public void run() {
log.info("handler /execute");
try {
client.execute();
} catch (Exception e) {
throw translateException(e);
}
<<<<<<<
/**
* Listens for daemon job completions and collects results
*/
@Slf4j
private static class ConfigurationClientJobListener implements JobListener {
public static final String LISTENER_NAME = "confClientJobListener";
// access only via synchronized getter/setter
private static DiagnosticsStatus status;
static {
status = new DiagnosticsStatus(DiagnosticsErrorCodes.ERROR_CODE_UNINITIALIZED, LocalTime.now(),
LocalTime.now().plusSeconds(SystemProperties.getConfigurationClientUpdateIntervalSeconds()));
}
private static synchronized void setStatus(DiagnosticsStatus newStatus) {
status = newStatus;
}
private static synchronized DiagnosticsStatus getStatus() {
return status;
}
@Override
public String getName() {
return LISTENER_NAME;
}
@Override
public void jobToBeExecuted(JobExecutionContext context) {
// NOP
}
@Override
public void jobExecutionVetoed(JobExecutionContext context) {
// NOP
}
@Override
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
log.info("job was executed result={}", context.getResult());
setStatus((DiagnosticsStatus) context.getResult());
}
}
=======
private static ParamsValidator getParamsValidator(CommandLine cmd) {
if (cmd.hasOption(OPTION_VERIFY_PRIVATE_PARAMS_EXISTS)) {
return new ParamsValidator(
CONTENT_ID_PRIVATE_PARAMETERS,
ERROR_CODE_MISSING_PRIVATE_PARAMS);
} else if (cmd.hasOption(OPTION_VERIFY_ANCHOR_FOR_EXTERNAL_SOURCE)) {
return new SharedParamsValidator(
CONTENT_ID_SHARED_PARAMETERS,
ERROR_CODE_ANCHOR_NOT_FOR_EXTERNAL_SOURCE);
} else {
return new ParamsValidator(null, 0);
}
}
private static class ParamsValidator {
protected final AtomicBoolean valid = new AtomicBoolean();
private final String expectedContentId;
private final int exitCodeWhenInvalid;
ParamsValidator(
String expectedContentId, int exitCodeWhenInvalid) {
this.expectedContentId = expectedContentId;
this.exitCodeWhenInvalid = exitCodeWhenInvalid;
}
void tryMarkValid(String contentId) {
log.trace("tryMarkValid({})", contentId);
if (valid.get()) {
return;
}
valid.set(StringUtils.isBlank(expectedContentId)
|| StringUtils.equals(expectedContentId, contentId));
}
int getExitCode() {
if (valid.get()) {
return RETURN_SUCCESS;
}
return exitCodeWhenInvalid;
}
}
private static class SharedParamsValidator extends ParamsValidator {
private final AtomicBoolean privateParametersIncluded =
new AtomicBoolean();
SharedParamsValidator(
String expectedContentId, int exitCodeWhenInvalid) {
super(expectedContentId, exitCodeWhenInvalid);
}
@Override
void tryMarkValid(String contentId) {
if (StringUtils.equals(contentId, CONTENT_ID_PRIVATE_PARAMETERS)) {
privateParametersIncluded.set(true);
}
if (privateParametersIncluded.get()) {
valid.set(false);
return;
}
super.tryMarkValid(contentId);
}
}
>>>>>>>
/**
* Listens for daemon job completions and collects results
*/
@Slf4j
private static class ConfigurationClientJobListener implements JobListener {
public static final String LISTENER_NAME = "confClientJobListener";
// access only via synchronized getter/setter
private static DiagnosticsStatus status;
static {
status = new DiagnosticsStatus(DiagnosticsErrorCodes.ERROR_CODE_UNINITIALIZED, LocalTime.now(),
LocalTime.now().plusSeconds(SystemProperties.getConfigurationClientUpdateIntervalSeconds()));
}
private static synchronized void setStatus(DiagnosticsStatus newStatus) {
status = newStatus;
}
private static synchronized DiagnosticsStatus getStatus() {
return status;
}
@Override
public String getName() {
return LISTENER_NAME;
}
@Override
public void jobToBeExecuted(JobExecutionContext context) {
// NOP
}
@Override
public void jobExecutionVetoed(JobExecutionContext context) {
// NOP
}
@Override
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
log.info("job was executed result={}", context.getResult());
setStatus((DiagnosticsStatus) context.getResult());
}
}
private static ParamsValidator getParamsValidator(CommandLine cmd) {
if (cmd.hasOption(OPTION_VERIFY_PRIVATE_PARAMS_EXISTS)) {
return new ParamsValidator(
CONTENT_ID_PRIVATE_PARAMETERS,
ERROR_CODE_MISSING_PRIVATE_PARAMS);
} else if (cmd.hasOption(OPTION_VERIFY_ANCHOR_FOR_EXTERNAL_SOURCE)) {
return new SharedParamsValidator(
CONTENT_ID_SHARED_PARAMETERS,
ERROR_CODE_ANCHOR_NOT_FOR_EXTERNAL_SOURCE);
} else {
return new ParamsValidator(null, 0);
}
}
private static class ParamsValidator {
protected final AtomicBoolean valid = new AtomicBoolean();
private final String expectedContentId;
private final int exitCodeWhenInvalid;
ParamsValidator(
String expectedContentId, int exitCodeWhenInvalid) {
this.expectedContentId = expectedContentId;
this.exitCodeWhenInvalid = exitCodeWhenInvalid;
}
void tryMarkValid(String contentId) {
log.trace("tryMarkValid({})", contentId);
if (valid.get()) {
return;
}
valid.set(StringUtils.isBlank(expectedContentId)
|| StringUtils.equals(expectedContentId, contentId));
}
int getExitCode() {
if (valid.get()) {
return RETURN_SUCCESS;
}
return exitCodeWhenInvalid;
}
}
private static class SharedParamsValidator extends ParamsValidator {
private final AtomicBoolean privateParametersIncluded =
new AtomicBoolean();
SharedParamsValidator(
String expectedContentId, int exitCodeWhenInvalid) {
super(expectedContentId, exitCodeWhenInvalid);
}
@Override
void tryMarkValid(String contentId) {
if (StringUtils.equals(contentId, CONTENT_ID_PRIVATE_PARAMETERS)) {
privateParametersIncluded.set(true);
}
if (privateParametersIncluded.get()) {
valid.set(false);
return;
}
super.tryMarkValid(contentId);
}
} |
<<<<<<<
import akka.actor.ActorRef;
=======
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.cert.ocsp.OCSPResp;
>>>>>>>
import static ee.ria.xroad.common.util.CryptoUtils.calculateCertHexHash;
import static ee.ria.xroad.common.util.CryptoUtils.encodeBase64;
import static ee.ria.xroad.common.util.CryptoUtils.readCertificate;
import static ee.ria.xroad.signer.protocol.ComponentNames.OCSP_CLIENT_JOB;
import static ee.ria.xroad.signer.tokenmanager.ServiceLocator.getOcspResponseManager;
import static java.util.Collections.emptyList;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.bouncycastle.cert.ocsp.OCSPResp;
import org.joda.time.DateTime;
import akka.actor.ActorRef;
<<<<<<<
import ee.ria.xroad.signer.OcspClientJob;
import ee.ria.xroad.signer.certmanager.OcspResponseManager.IsCachedOcspResponse;
=======
>>>>>>>
import ee.ria.xroad.signer.OcspClientJob;
import ee.ria.xroad.signer.certmanager.OcspResponseManager.IsCachedOcspResponse;
<<<<<<<
/**
* @return true if the response for given certificate does not exist,
* is expired (in which case it is also removed from cache) or is not
* valid
*/
boolean shouldFetchResponse(X509Certificate subject) throws Exception {
=======
boolean isCertValid(X509Certificate subject) {
>>>>>>>
/**
* @return true if the response for given certificate does not exist, is
* expired (in which case it is also removed from cache) or is not
* valid
*/
boolean shouldFetchResponse(X509Certificate subject) throws Exception {
<<<<<<<
String subjectHash = calculateCertHexHash(subject);
try {
log.trace("shouldFetchResponse for cert: {}", subjectHash);
return !isCachedOcspResponse(subjectHash);
} catch (Exception e) {
// Ignore this error, since any kind of failure to get the response
// or validate it means we should fetch the response from the responder.
return true;
}
}
boolean isCachedOcspResponse(String certHash) throws Exception {
// Check if the OCSP response is in the cache. We need to check if the
// OCSP response expires in the future in order to not leave a gap,
// where the OCSP is expired, but the new one is currently being
// retrieved.
Date atDate = new DateTime().plusSeconds(
getNextOcspFreshnessSeconds()).toDate();
Boolean isCachedOcspResponse = (Boolean) SignerUtil.ask(getOcspResponseManager(getContext()),
new IsCachedOcspResponse(certHash, atDate));
log.trace("isCachedOcspResponse(certHash: {}, atDate: {}) = {}", certHash,
atDate, isCachedOcspResponse);
return isCachedOcspResponse;
=======
return true;
>>>>>>>
String subjectHash = calculateCertHexHash(subject);
try {
log.trace("shouldFetchResponse for cert: {}", subjectHash);
return !isCachedOcspResponse(subjectHash);
} catch (Exception e) {
// Ignore this error, since any kind of failure to get the response
// or validate it means we should fetch the response from the
// responder.
return true;
}
}
boolean isCertValid(X509Certificate subject) {
try {
return shouldFetchResponse(subject);
} catch (Exception e) {
log.error("Unable to check if should fetch status for " + subject.getSerialNumber(), e);
return false;
}
}
boolean isCachedOcspResponse(String certHash) throws Exception {
// Check if the OCSP response is in the cache. We need to check if the
// OCSP response expires in the future in order to not leave a gap,
// where the OCSP is expired, but the new one is currently being
// retrieved.
Date atDate = new DateTime().plusSeconds(getNextOcspFreshnessSeconds()).toDate();
Boolean isCachedOcspResponse = (Boolean) SignerUtil.ask(getOcspResponseManager(getContext()),
new IsCachedOcspResponse(certHash, atDate));
log.trace("isCachedOcspResponse(certHash: {}, atDate: {}) = {}", certHash, atDate, isCachedOcspResponse);
return isCachedOcspResponse; |
<<<<<<<
new Members().items(Collections.singletonList(CLIENT_ID_SS2)));
=======
new InlineObject3().items(Collections.singletonList(CLIENT_ID_SS2)));
fail("should throw ConflictException");
>>>>>>>
new Members().items(Collections.singletonList(CLIENT_ID_SS2)));
fail("should throw ConflictException"); |
<<<<<<<
@Test(expected = TokenNotFoundException.class)
@WithMockUser(authorities = { "EDIT_KEYTABLE_FRIENDLY_NAMES", "VIEW_KEYS" })
=======
@Test(expected = TokenService.TokenNotFoundException.class)
>>>>>>>
@Test(expected = TokenNotFoundException.class)
<<<<<<<
@Test
@WithMockUser(authorities = { "VIEW_KEYS" })
public void getToken() throws Exception {
try {
tokenService.getToken(TOKEN_NOT_FOUND_TOKEN_ID);
} catch (TokenNotFoundException expected) {
}
TokenInfo tokenInfo = tokenService.getToken(GOOD_TOKEN_ID);
assertEquals(GOOD_TOKEN_NAME, tokenInfo.getFriendlyName());
}
=======
>>>>>>> |
<<<<<<<
=======
import java.util.Set;
import java.util.UUID;
>>>>>>>
import java.util.UUID;
<<<<<<<
=======
import static ee.ria.xroad.common.util.MimeUtils.HEADER_PROXY_VERSION;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_REQUEST_ID;
>>>>>>>
import static ee.ria.xroad.common.util.MimeUtils.HEADER_PROXY_VERSION;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_REQUEST_ID;
<<<<<<<
URI[] addresses = prepareRequest(httpSender, requestServiceId, requestSoap.getSecurityServer());
=======
// If we're using SSL, we need to include the provider name in
// the HTTP request so that server proxy could verify the SSL
// certificate properly.
if (isSslEnabled()) {
httpSender.setAttribute(AuthTrustVerifier.ID_PROVIDERNAME, requestServiceId);
}
// Start sending the request to server proxies. The underlying
// SSLConnectionSocketFactory will select the fastest address
// (socket that connects first) from the provided addresses.
List<URI> tmp = getServiceAddresses(requestServiceId, requestSoap.getSecurityServer());
Collections.shuffle(tmp);
URI[] addresses = tmp.toArray(new URI[0]);
updateOpMonitoringServiceSecurityServerAddress(addresses, httpSender);
httpSender.setAttribute(ID_TARGETS, addresses);
if (SystemProperties.isEnableClientProxyPooledConnectionReuse()) {
// set the servers with this subsystem as the user token, this will pool the connections per groups of
// security servers.
httpSender.setAttribute(HttpClientContext.USER_TOKEN, new TargetHostsUserToken(addresses));
}
httpSender.setConnectionTimeout(SystemProperties.getClientProxyTimeout());
httpSender.setSocketTimeout(SystemProperties.getClientProxyHttpClientTimeout());
// Add unique id to distinguish request/response pairs
httpSender.addHeader(HEADER_REQUEST_ID, xRequestId);
httpSender.addHeader(HEADER_HASH_ALGO_ID, SoapUtils.getHashAlgoId());
httpSender.addHeader(HEADER_PROXY_VERSION, ProxyMain.readProxyVersion());
// Preserve the original content type in the "x-original-content-type"
// HTTP header, which will be used to send the request to the
// service provider
httpSender.addHeader(HEADER_ORIGINAL_CONTENT_TYPE, servletRequest.getContentType());
>>>>>>>
URI[] addresses = prepareRequest(httpSender, requestServiceId, requestSoap.getSecurityServer()); |
<<<<<<<
import ee.ria.xroad.asyncdb.AsyncDB;
import ee.ria.xroad.asyncdb.WritingCtx;
import ee.ria.xroad.asyncdb.messagequeue.MessageQueue;
=======
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.Marshaller;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.HttpClient;
import org.bouncycastle.cert.ocsp.OCSPResp;
import org.bouncycastle.util.Arrays;
import org.w3c.dom.Node;
>>>>>>>
import static ee.ria.xroad.common.ErrorCodes.X_INCONSISTENT_RESPONSE;
import static ee.ria.xroad.common.ErrorCodes.X_INTERNAL_ERROR;
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_SECURITY_SERVER;
import static ee.ria.xroad.common.ErrorCodes.X_MALFORMED_SOAP;
import static ee.ria.xroad.common.ErrorCodes.X_MISSING_SIGNATURE;
import static ee.ria.xroad.common.ErrorCodes.X_MISSING_SOAP;
import static ee.ria.xroad.common.ErrorCodes.X_SERVICE_FAILED_X;
import static ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_MEMBER;
import static ee.ria.xroad.common.ErrorCodes.translateException;
import static ee.ria.xroad.common.SystemProperties.getServerProxyPort;
import static ee.ria.xroad.common.SystemProperties.isSslEnabled;
import static ee.ria.xroad.common.util.AbstractHttpSender.CHUNKED_LENGTH;
import static ee.ria.xroad.common.util.CryptoUtils.calculateDigest;
import static ee.ria.xroad.common.util.CryptoUtils.decodeBase64;
import static ee.ria.xroad.common.util.CryptoUtils.encodeBase64;
import static ee.ria.xroad.common.util.CryptoUtils.getAlgorithmId;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_HASH_ALGO_ID;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_ORIGINAL_CONTENT_TYPE;
import static ee.ria.xroad.common.util.MimeUtils.HEADER_PROXY_VERSION;
import static ee.ria.xroad.proxy.clientproxy.FastestConnectionSelectingSSLSocketFactory.ID_TARGETS;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.Marshaller;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.HttpClient;
import org.bouncycastle.cert.ocsp.OCSPResp;
import org.bouncycastle.util.Arrays;
import org.w3c.dom.Node;
<<<<<<<
private void logRequestMessage() throws Exception {
if (request != null) {
log.trace("logRequestMessage()");
MessageLog.log(requestSoap, request.getSignature(), true);
}
}
=======
>>>>>>>
<<<<<<<
if (!SystemProperties.isSslEnabled()) {
=======
if (!isSslEnabled()) {
>>>>>>>
if (!isSslEnabled()) {
<<<<<<<
final int port = SystemProperties.getServerProxyPort();
return new URI("https", null, "localhost", port, "/", null, null);
=======
return new URI("https", null, "localhost", getServerProxyPort(), "/",
null, null);
>>>>>>>
return new URI("https", null, "localhost", getServerProxyPort(), "/",
null, null);
<<<<<<<
if (serverId != null) {
final String securityServerAddress = GlobalConf.getSecurityServerAddress(serverId);
if (securityServerAddress == null) {
throw new CodedException(X_INVALID_SECURITY_SERVER,
"Could not find security server \"%s\"",
serverId);
}
if (!hostNames.contains(securityServerAddress)) {
throw new CodedException(X_INVALID_SECURITY_SERVER,
"Invalid security server \"%s\"",
serviceProvider);
}
hostNames = Collections.singleton(securityServerAddress);
}
String protocol = SystemProperties.isSslEnabled() ? "https" : "http";
int port = SystemProperties.getServerProxyPort();
=======
String protocol = isSslEnabled() ? "https" : "http";
int port = getServerProxyPort();
>>>>>>>
if (serverId != null) {
final String securityServerAddress = GlobalConf.getSecurityServerAddress(serverId);
if (securityServerAddress == null) {
throw new CodedException(X_INVALID_SECURITY_SERVER,
"Could not find security server \"%s\"",
serverId);
}
if (!hostNames.contains(securityServerAddress)) {
throw new CodedException(X_INVALID_SECURITY_SERVER,
"Invalid security server \"%s\"",
serviceProvider);
}
hostNames = Collections.singleton(securityServerAddress);
}
String protocol = isSslEnabled() ? "https" : "http";
int port = getServerProxyPort();
<<<<<<<
if (handler == null) {
chooseHandler();
}
handler.soap(message);
}
@Override
public void attachment(String contentType, InputStream content,
Map<String, String> additionalHeaders) throws Exception {
log.trace("attachment({})", contentType);
if (handler != null) {
handler.attachment(contentType, content, additionalHeaders);
} else {
throw new CodedException(X_INTERNAL_ERROR,
"No soap message handler present");
}
}
@Override
public void fault(SoapFault fault) throws Exception {
onError(fault.toCodedException());
}
private void chooseHandler() {
isAsync = requestSoap.isAsync() && (servletRequest.getHeader(
SoapUtils.X_IGNORE_ASYNC) == null);
if (isAsync) {
log.trace("Creating handler for asynchronous messages");
handler = new AsyncSoapMessageHandler();
} else {
log.trace("Creating handler for normal messages");
handler = new DefaultSoapMessageHandler();
}
}
@Override
public void onCompleted() {
log.trace("onCompleted()");
if (requestSoap == null) {
setError(new ClientException(X_MISSING_SOAP,
"Request does not contain SOAP message"));
return;
}
if (handler != null) {
handler.onCompleted();
}
try {
logRequestMessage();
} catch (Exception e) {
setError(e);
}
}
@Override
public void onError(Exception e) throws Exception {
log.error("onError(): ", e);
if (handler != null) {
handler.onError(e);
} else {
throw e;
}
}
@Override
public void close() {
handler.close();
}
}
private class DefaultSoapMessageHandler
implements SoapMessageDecoder.Callback {
@Override
public void soap(SoapMessage message) throws Exception {
=======
>>>>>>>
<<<<<<<
=======
}
private void logRequestMessage() throws Exception {
log.trace("logRequestMessage()");
MessageLog.log(requestSoap, request.getSignature(), true);
>>>>>>>
}
private void logRequestMessage() throws Exception {
log.trace("logRequestMessage()");
MessageLog.log(requestSoap, request.getSignature(), true);
<<<<<<<
=======
log.error("onError(): ", e);
>>>>>>>
log.error("onError(): ", e);
<<<<<<<
@Override
public void close() {
if (request != null) {
try {
request.close();
} catch (Exception e) {
setError(e);
}
}
}
}
private class AsyncSoapMessageHandler
implements SoapMessageDecoder.Callback {
WritingCtx writingCtx = null;
SoapMessageConsumer consumer = null;
@Override
public void soap(SoapMessage message) throws Exception {
if (writingCtx == null) {
MessageQueue queue =
AsyncDB.getMessageQueue(requestServiceId.getClientId());
writingCtx = queue.startWriting();
consumer = writingCtx.getConsumer();
}
consumer.soap(message);
}
=======
>>>>>>> |
<<<<<<<
import org.niis.xroad.restapi.converter.VersionConverter;
=======
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
>>>>>>>
import org.niis.xroad.restapi.converter.VersionConverter;
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
<<<<<<<
@Override
@PreAuthorize("hasAuthority('VIEW_VERSION')")
public ResponseEntity<Version> systemVersion() {
String softwareVersion = versionService.getVersion();
Version version = versionConverter.convert(softwareVersion);
return new ResponseEntity<>(version, HttpStatus.OK);
}
=======
@Override
@PreAuthorize("hasAuthority('GENERATE_INTERNAL_SSL')")
public ResponseEntity<Void> generateSystemTlsKeyAndCertificate() {
try {
internalTlsCertificateService.generateInternalTlsKeyAndCertificate();
} catch (InterruptedException e) {
throw new InternalServerErrorException(new ErrorDeviation(INTERNAL_KEY_CERT_INTERRUPTED));
}
return ApiUtil.createCreatedResponse("/api/system/certificate", null);
}
>>>>>>>
@Override
@PreAuthorize("hasAuthority('VIEW_VERSION')")
public ResponseEntity<Version> systemVersion() {
String softwareVersion = versionService.getVersion();
Version version = versionConverter.convert(softwareVersion);
return new ResponseEntity<>(version, HttpStatus.OK);
}
@Override
@PreAuthorize("hasAuthority('GENERATE_INTERNAL_SSL')")
public ResponseEntity<Void> generateSystemTlsKeyAndCertificate() {
try {
internalTlsCertificateService.generateInternalTlsKeyAndCertificate();
} catch (InterruptedException e) {
throw new InternalServerErrorException(new ErrorDeviation(INTERNAL_KEY_CERT_INTERRUPTED));
}
return ApiUtil.createCreatedResponse("/api/system/certificate", null);
} |
<<<<<<<
import ee.ria.xroad.signer.protocol.dto.KeyUsageInfo;
import ee.ria.xroad.signer.protocol.message.GenerateCertRequest;
=======
>>>>>>>
import ee.ria.xroad.signer.protocol.dto.KeyUsageInfo;
import ee.ria.xroad.signer.protocol.message.GenerateCertRequest;
<<<<<<<
import org.niis.xroad.restapi.converter.ClientConverter;
import org.niis.xroad.restapi.converter.CsrFormatMapping;
import org.niis.xroad.restapi.converter.CsrSubjectFieldDescriptionConverter;
=======
>>>>>>>
import org.niis.xroad.restapi.converter.ClientConverter;
import org.niis.xroad.restapi.converter.CsrFormatMapping;
<<<<<<<
import org.niis.xroad.restapi.converter.KeyUsageTypeMapping;
import org.niis.xroad.restapi.openapi.model.CsrGenerate;
import org.niis.xroad.restapi.openapi.model.CsrSubjectFieldDescription;
=======
>>>>>>>
import org.niis.xroad.restapi.converter.KeyUsageTypeMapping;
import org.niis.xroad.restapi.openapi.model.CsrGenerate;
<<<<<<<
import org.niis.xroad.restapi.openapi.model.KeyUsageType;
import org.niis.xroad.restapi.service.CertificateAuthorityNotFoundException;
import org.niis.xroad.restapi.service.CertificateAuthorityService;
import org.niis.xroad.restapi.service.CertificateProfileInstantiationException;
import org.niis.xroad.restapi.service.ClientNotFoundException;
import org.niis.xroad.restapi.service.DnFieldHelper;
=======
>>>>>>>
import org.niis.xroad.restapi.service.CertificateAuthorityNotFoundException;
import org.niis.xroad.restapi.service.CertificateProfileInstantiationException;
import org.niis.xroad.restapi.service.ClientNotFoundException;
import org.niis.xroad.restapi.service.DnFieldHelper;
<<<<<<<
private final CertificateAuthorityService certificateAuthorityService;
private final ClientConverter clientConverter;
private final CsrSubjectFieldDescriptionConverter subjectConverter;
private final TokenCertificateService tokenCertificateService;
private final ServerConfService serverConfService;
private final CsrFilenameCreator csrFilenameCreator;
=======
>>>>>>>
private final ClientConverter clientConverter;
private final TokenCertificateService tokenCertificateService;
private final ServerConfService serverConfService;
private final CsrFilenameCreator csrFilenameCreator;
<<<<<<<
* @param keyConverter
* @param keyService
* @param certificateAuthorityService
* @param subjectConverter
* @param clientConverter
* @param tokenCertificateService
* @param csrFilenameCreator
* @param serverConfService
=======
>>>>>>>
<<<<<<<
KeyConverter keyConverter,
CertificateAuthorityService certificateAuthorityService,
ClientConverter clientConverter,
CsrSubjectFieldDescriptionConverter subjectConverter,
TokenCertificateService tokenCertificateService,
ServerConfService serverConfService,
CsrFilenameCreator csrFilenameCreator) {
=======
KeyConverter keyConverter) {
>>>>>>>
KeyConverter keyConverter,
ClientConverter clientConverter,
TokenCertificateService tokenCertificateService,
ServerConfService serverConfService,
CsrFilenameCreator csrFilenameCreator) {
<<<<<<<
this.certificateAuthorityService = certificateAuthorityService;
this.clientConverter = clientConverter;
this.subjectConverter = subjectConverter;
this.tokenCertificateService = tokenCertificateService;
this.serverConfService = serverConfService;
this.csrFilenameCreator = csrFilenameCreator;
=======
>>>>>>>
this.clientConverter = clientConverter;
this.tokenCertificateService = tokenCertificateService;
this.serverConfService = serverConfService;
this.csrFilenameCreator = csrFilenameCreator;
<<<<<<<
@Override
@PreAuthorize("(hasAuthority('GENERATE_AUTH_CERT_REQ') and "
+ " (#keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).AUTHENTICATION"
+ " or #keyUsageType == null))"
+ "or (hasAuthority('GENERATE_SIGN_CERT_REQ') and "
+ "#keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).SIGNING)")
public ResponseEntity<List<CsrSubjectFieldDescription>> getCsrDnFieldDescriptions(
String keyId,
KeyUsageType keyUsageType,
String caName,
String encodedMemberId) {
KeyUsageInfo keyUsageInfo = KeyUsageTypeMapping.map(keyUsageType).get();
try {
KeyInfo keyInfo = keyService.getKey(keyId);
if (keyInfo.getUsage() != null) {
if (keyInfo.getUsage() != keyUsageInfo) {
throw new ResourceNotFoundException("key is for different usage");
}
}
ClientId memberId = clientConverter.convertId(encodedMemberId);
CertificateProfileInfo profileInfo;
profileInfo = certificateAuthorityService.getCertificateProfile(
caName, keyUsageInfo, memberId);
List<CsrSubjectFieldDescription> converted = subjectConverter.convert(
profileInfo.getSubjectFields());
return new ResponseEntity<>(converted, HttpStatus.OK);
} catch (WrongKeyUsageException e) {
throw new ResourceNotFoundException(e);
} catch (KeyService.KeyNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (CertificateAuthorityNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (ClientNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (CertificateProfileInstantiationException e) {
throw new InternalServerErrorException(e);
}
}
@Override
@PreAuthorize("(hasAuthority('GENERATE_AUTH_CERT_REQ') and "
+ "#csrGenerate.keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).AUTHENTICATION)"
+ " or (hasAuthority('GENERATE_SIGN_CERT_REQ') and "
+ "#csrGenerate.keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).SIGNING)")
public ResponseEntity<Resource> generateCsr(String keyId, CsrGenerate csrGenerate) {
KeyUsageInfo keyUsageInfo = KeyUsageTypeMapping.map(csrGenerate.getKeyUsageType()).get();
ClientId memberId = null;
if (KeyUsageInfo.SIGNING == keyUsageInfo) {
// memberId not used for authentication csrs
memberId = clientConverter.convertId(csrGenerate.getMemberId());
}
GenerateCertRequest.RequestFormat csrFormat = CsrFormatMapping.map(csrGenerate.getCsrFormat()).get();
byte[] csr = null;
try {
csr = tokenCertificateService.generateCertRequest(keyId,
memberId,
keyUsageInfo,
csrGenerate.getCaName(),
csrGenerate.getSubjectFieldValues(),
csrFormat);
} catch (WrongKeyUsageException | DnFieldHelper.InvalidDnParameterException
| ClientNotFoundException | CertificateAuthorityNotFoundException e) {
throw new BadRequestException(e);
} catch (KeyService.KeyNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (TokenCertificateService.KeyNotOperationalException e) {
throw new ConflictException(e);
} catch (TokenCertificateService.CsrCreationFailureException e) {
throw new InternalServerErrorException(e);
} catch (CertificateProfileInstantiationException e) {
throw new InternalServerErrorException(e);
}
String filename = csrFilenameCreator.createCsrFilename(keyUsageInfo, csrFormat, memberId,
serverConfService.getSecurityServerId());
return ApiUtil.createAttachmentResourceResponse(csr, filename);
}
=======
>>>>>>>
@Override
@PreAuthorize("(hasAuthority('GENERATE_AUTH_CERT_REQ') and "
+ "#csrGenerate.keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).AUTHENTICATION)"
+ " or (hasAuthority('GENERATE_SIGN_CERT_REQ') and "
+ "#csrGenerate.keyUsageType == T(org.niis.xroad.restapi.openapi.model.KeyUsageType).SIGNING)")
public ResponseEntity<Resource> generateCsr(String keyId, CsrGenerate csrGenerate) {
KeyUsageInfo keyUsageInfo = KeyUsageTypeMapping.map(csrGenerate.getKeyUsageType()).get();
ClientId memberId = null;
if (KeyUsageInfo.SIGNING == keyUsageInfo) {
// memberId not used for authentication csrs
memberId = clientConverter.convertId(csrGenerate.getMemberId());
}
GenerateCertRequest.RequestFormat csrFormat = CsrFormatMapping.map(csrGenerate.getCsrFormat()).get();
byte[] csr = null;
try {
csr = tokenCertificateService.generateCertRequest(keyId,
memberId,
keyUsageInfo,
csrGenerate.getCaName(),
csrGenerate.getSubjectFieldValues(),
csrFormat);
} catch (WrongKeyUsageException | DnFieldHelper.InvalidDnParameterException
| ClientNotFoundException | CertificateAuthorityNotFoundException e) {
throw new BadRequestException(e);
} catch (KeyService.KeyNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (TokenCertificateService.KeyNotOperationalException e) {
throw new ConflictException(e);
} catch (TokenCertificateService.CsrCreationFailureException e) {
throw new InternalServerErrorException(e);
} catch (CertificateProfileInstantiationException e) {
throw new InternalServerErrorException(e);
}
String filename = csrFilenameCreator.createCsrFilename(keyUsageInfo, csrFormat, memberId,
serverConfService.getSecurityServerId());
return ApiUtil.createAttachmentResourceResponse(csr, filename);
} |
<<<<<<<
TestUtils.SERVICE_CALCULATE_PRIME, subjectIds);
=======
TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds, localGroupIds);
>>>>>>>
TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds);
<<<<<<<
TestUtils.SERVICE_CALCULATE_PRIME, subjectIds);
=======
TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds, localGroupIds);
>>>>>>>
TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds);
<<<<<<<
subjectIds.add(LocalGroupId.create("group2"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.SERVICE_CALCULATE_PRIME, subjectIds);
=======
Set<Long> localGroupIds = new HashSet<>();
localGroupIds.add(2L);
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds,
localGroupIds);
>>>>>>>
subjectIds.add(LocalGroupId.create("group2"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds);
<<<<<<<
subjectIds.add(LocalGroupId.create("group1"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.SERVICE_CALCULATE_PRIME, subjectIds);
=======
Set<Long> localGroupIds = new HashSet<>();
localGroupIds.add(1L);
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds,
localGroupIds);
>>>>>>>
subjectIds.add(LocalGroupId.create("group1"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds);
<<<<<<<
TestUtils.SERVICE_CALCULATE_PRIME, subjectIds);
=======
TestUtils.FULL_SERVICE_CALCULATE_PRIME, null, localGroupIds);
>>>>>>>
TestUtils.FULL_SERVICE_CALCULATE_PRIME, subjectIds);
<<<<<<<
Set<XRoadId> subjectIds = new HashSet<>();
subjectIds.add(LocalGroupId.create("group1"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.SERVICE_BMI_OLD, subjectIds);
=======
Set<Long> localGroupIds = new HashSet<>();
localGroupIds.add(1L);
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CODE_BMI_OLD, null,
localGroupIds);
}
@Test(expected = ClientNotFoundException.class)
public void getClientServiceClientsFromUnexistingClient() throws Exception {
serviceClientService.getServiceClientsByClient(ClientId.create("NO", "SUCH", "CLIENT"));
}
@Test
public void getClientServiceClients() throws Exception {
ClientId clientId1 = ClientId.create("FI", "GOV", "M2", "SS6");
List<ServiceClientDto> serviceClients1 = serviceClientService.getServiceClientsByClient(clientId1);
assertTrue(serviceClients1.size() == 1);
ServiceClientDto arh1 = serviceClients1.get(0);
assertTrue(arh1.getSubjectId().getObjectType().equals(XRoadObjectType.SUBSYSTEM));
assertNull(arh1.getLocalGroupCode());
assertNull(arh1.getLocalGroupDescription());
assertNull(arh1.getLocalGroupId());
assertTrue(arh1.getSubjectId().getXRoadInstance().equals("FI"));
ClientId clientId2 = ClientId.create("FI", "GOV", "M1");
assertTrue(serviceClientService.getServiceClientsByClient(clientId2).isEmpty());
ClientId clientId3 = ClientId.create("FI", "GOV", "M1", "SS1");
List<ServiceClientDto> serviceClients3 = serviceClientService.getServiceClientsByClient(clientId3);
assertTrue(serviceClients3.size() == 4);
assertTrue(serviceClients3.stream().anyMatch(arh -> arh.getSubjectId()
.getObjectType().equals(XRoadObjectType.GLOBALGROUP)));
assertTrue(serviceClients3.stream().anyMatch(arh -> arh.getSubjectId()
.getObjectType().equals(XRoadObjectType.LOCALGROUP)));
assertTrue(serviceClients3.stream().anyMatch(arh -> arh.getSubjectId()
.getObjectType().equals(XRoadObjectType.SUBSYSTEM)
&& arh.getSubjectId().getXRoadInstance().equals("FI")));
}
@Test
public void getClientServiceClientsHasCorrectRightsGiven() throws Exception {
ClientId clientId = ClientId.create("FI", "GOV", "M1", "SS1");
List<ServiceClientDto> serviceClients = serviceClientService.getServiceClientsByClient(clientId);
XRoadId globalGroupId = GlobalGroupId.create("FI", "test-globalgroup");
Optional<ServiceClientDto> groupServiceClient = serviceClients.stream()
.filter(dto -> dto.getSubjectId().equals(globalGroupId))
.findFirst();
assertTrue(groupServiceClient.isPresent());
// data.sql populates times in local time zone
ZonedDateTime correctRightsGiven = LocalDateTime.parse("2020-01-01T09:07:22").atZone(ZoneId.systemDefault());
// persistence layer gives times in utc time zone, so compare instants
assertEquals(correctRightsGiven.toInstant(), groupServiceClient.get().getRightsGiven().toInstant());
>>>>>>>
Set<XRoadId> subjectIds = new HashSet<>();
subjectIds.add(LocalGroupId.create("group1"));
accessRightService.addSoapServiceAccessRights(clientId, TestUtils.FULL_SERVICE_CODE_BMI_OLD, subjectIds); |
<<<<<<<
import org.niis.xroad.restapi.cache.SecurityServerOwner;
import org.niis.xroad.restapi.exceptions.DeviationAwareRuntimeException;
=======
import org.niis.xroad.restapi.cache.CurrentSecurityServerId;
import org.niis.xroad.restapi.exceptions.DeviationAwareRuntimeException;
>>>>>>>
import org.niis.xroad.restapi.cache.CurrentSecurityServerId;
import org.niis.xroad.restapi.exceptions.DeviationAwareRuntimeException;
<<<<<<<
public ClientService(ClientRepository clientRepository, GlobalConfFacade globalConfFacade,
ManagementRequestSenderService managementRequestSenderService, SecurityServerOwner securityServerOwner,
ServerConfService serverConfService, GlobalConfService globalConfService,
IdentifierRepository identifierRepository) {
=======
public ClientService(ClientRepository clientRepository, GlobalConfFacade globalConfFacade,
ServerConfService serverConfService, GlobalConfService globalConfService,
IdentifierRepository identifierRepository, ManagementRequestSenderService managementRequestSenderService,
CurrentSecurityServerId currentSecurityServerId) {
>>>>>>>
public ClientService(ClientRepository clientRepository, GlobalConfFacade globalConfFacade,
ServerConfService serverConfService, GlobalConfService globalConfService,
IdentifierRepository identifierRepository, ManagementRequestSenderService managementRequestSenderService,
CurrentSecurityServerId currentSecurityServerId) {
<<<<<<<
* Registers a client
* @param clientId client to register
* @throws GlobalConfOutdatedException
* @throws ClientNotFoundException
*/
public void registerClient(ClientId clientId) throws GlobalConfOutdatedException, ClientNotFoundException {
ClientType client = getLocalClientOrThrowNotFound(clientId);
try {
managementRequestSenderService.sendClientRegisterRequest(clientId);
client.setClientStatus(ClientType.STATUS_REGINPROG);
clientRepository.saveOrUpdate(client);
} catch (ManagementRequestSendingFailedException e) {
throw new DeviationAwareRuntimeException(e, e.getErrorDeviation());
}
}
/**
* Unregister a client
* @param clientId client to unregister
* @throws GlobalConfOutdatedException
* @throws ClientNotFoundException
* @throws CannotUnregisterOwnerException when trying to unregister the security server owner
* @throws ActionNotPossibleException when trying do unregister a client that is already unregistered
*/
public void unregisterClient(ClientId clientId) throws GlobalConfOutdatedException, ClientNotFoundException,
CannotUnregisterOwnerException, ActionNotPossibleException {
ClientType client = getLocalClientOrThrowNotFound(clientId);
List<String> allowedStatuses = Arrays.asList(STATUS_REGISTERED, STATUS_REGINPROG);
if (!allowedStatuses.contains(client.getClientStatus())) {
throw new ActionNotPossibleException("cannot unregister client with status " + client.getClientStatus());
}
ClientId ownerId = securityServerOwner.getId();
if (clientId.equals(ownerId)) {
throw new CannotUnregisterOwnerException();
}
try {
managementRequestSenderService.sendClientUnregisterRequest(clientId);
client.setClientStatus(STATUS_DELINPROG);
clientRepository.saveOrUpdate(client);
} catch (ManagementRequestSendingFailedException e) {
throw new DeviationAwareRuntimeException(e, e.getErrorDeviation());
}
}
/**
=======
* Registers a client
* @param clientId client to register
* @throws GlobalConfOutdatedException
* @throws ClientNotFoundException
* @throws CannotRegisterOwnerException
*/
public void registerClient(ClientId clientId) throws GlobalConfOutdatedException, ClientNotFoundException,
CannotRegisterOwnerException, ActionNotPossibleException {
ClientType client = getLocalClientOrThrowNotFound(clientId);
ClientId ownerId = currentSecurityServerId.getServerId().getOwner();
if (ownerId.equals(client.getIdentifier())) {
throw new CannotRegisterOwnerException();
}
if (!client.getClientStatus().equals(ClientType.STATUS_SAVED)) {
throw new ActionNotPossibleException("Only clients with status 'saved' can be registered");
}
try {
managementRequestSenderService.sendClientRegisterRequest(clientId);
client.setClientStatus(ClientType.STATUS_REGINPROG);
clientRepository.saveOrUpdate(client);
} catch (ManagementRequestSendingFailedException e) {
throw new DeviationAwareRuntimeException(e, e.getErrorDeviation());
}
}
/**
>>>>>>>
* Registers a client
* @param clientId client to register
* @throws GlobalConfOutdatedException
* @throws ClientNotFoundException
* @throws CannotRegisterOwnerException
*/
public void registerClient(ClientId clientId) throws GlobalConfOutdatedException, ClientNotFoundException,
CannotRegisterOwnerException, ActionNotPossibleException {
ClientType client = getLocalClientOrThrowNotFound(clientId);
ClientId ownerId = currentSecurityServerId.getServerId().getOwner();
if (ownerId.equals(client.getIdentifier())) {
throw new CannotRegisterOwnerException();
}
if (!client.getClientStatus().equals(ClientType.STATUS_SAVED)) {
throw new ActionNotPossibleException("Only clients with status 'saved' can be registered");
}
try {
managementRequestSenderService.sendClientRegisterRequest(clientId);
client.setClientStatus(ClientType.STATUS_REGINPROG);
clientRepository.saveOrUpdate(client);
} catch (ManagementRequestSendingFailedException e) {
throw new DeviationAwareRuntimeException(e, e.getErrorDeviation());
}
}
/**
* Unregister a client
* @param clientId client to unregister
* @throws GlobalConfOutdatedException
* @throws ClientNotFoundException
* @throws CannotUnregisterOwnerException when trying to unregister the security server owner
* @throws ActionNotPossibleException when trying do unregister a client that is already unregistered
*/
public void unregisterClient(ClientId clientId) throws GlobalConfOutdatedException, ClientNotFoundException,
CannotUnregisterOwnerException, ActionNotPossibleException {
ClientType client = getLocalClientOrThrowNotFound(clientId);
List<String> allowedStatuses = Arrays.asList(STATUS_REGISTERED, STATUS_REGINPROG);
if (!allowedStatuses.contains(client.getClientStatus())) {
throw new ActionNotPossibleException("cannot unregister client with status " + client.getClientStatus());
}
ClientId ownerId = currentSecurityServerId.getServerId().getOwner();
if (clientId.equals(ownerId)) {
throw new CannotUnregisterOwnerException();
}
try {
managementRequestSenderService.sendClientUnregisterRequest(clientId);
client.setClientStatus(STATUS_DELINPROG);
clientRepository.saveOrUpdate(client);
} catch (ManagementRequestSendingFailedException e) {
throw new DeviationAwareRuntimeException(e, e.getErrorDeviation());
}
}
/**
<<<<<<<
/**
* Thrown when trying to unregister the security server owner
*/
public static class CannotUnregisterOwnerException extends ServiceException {
public static final String CANNOT_UNREGISTER_OWNER = "cannot_unregister_owner";
public CannotUnregisterOwnerException() {
super(new ErrorDeviation(CANNOT_UNREGISTER_OWNER));
}
}
=======
/**
* Thrown when trying to register the owner member
*/
public static class CannotRegisterOwnerException extends ServiceException {
public static final String ERROR_CANNOT_REGISTER_OWNER = "cannot_register_owner";
public CannotRegisterOwnerException() {
super(new ErrorDeviation(ERROR_CANNOT_REGISTER_OWNER));
}
}
>>>>>>>
/**
* Thrown when trying to register the owner member
*/
public static class CannotRegisterOwnerException extends ServiceException {
public static final String ERROR_CANNOT_REGISTER_OWNER = "cannot_register_owner";
public CannotRegisterOwnerException() {
super(new ErrorDeviation(ERROR_CANNOT_REGISTER_OWNER));
}
}
/**
* Thrown when trying to unregister the security server owner
*/
public static class CannotUnregisterOwnerException extends ServiceException {
public static final String CANNOT_UNREGISTER_OWNER = "cannot_unregister_owner";
public CannotUnregisterOwnerException() {
super(new ErrorDeviation(CANNOT_UNREGISTER_OWNER));
}
} |
<<<<<<<
import ee.ria.xroad.common.conf.globalconf.ApprovedCAInfo;
=======
import ee.ria.xroad.common.certificateprofile.SignCertificateProfileInfo;
import ee.ria.xroad.common.certificateprofile.impl.SignCertificateProfileInfoParameters;
>>>>>>>
import ee.ria.xroad.common.certificateprofile.SignCertificateProfileInfo;
import ee.ria.xroad.common.certificateprofile.impl.SignCertificateProfileInfoParameters;
import ee.ria.xroad.common.conf.globalconf.ApprovedCAInfo;
<<<<<<<
import java.util.Collection;
=======
import java.security.cert.X509Certificate;
>>>>>>>
import java.security.cert.X509Certificate;
import java.util.Collection;
<<<<<<<
/**
* {@link GlobalConf#getApprovedCAs(String)}
*/
public Collection<ApprovedCAInfo> getApprovedCAs(String instanceIdentifier) {
return GlobalConf.getApprovedCAs(instanceIdentifier);
}
/**
* {@link GlobalConf#getServerOwner(SecurityServerId)}
*/
public static ClientId getServerOwner(SecurityServerId serverId) {
return GlobalConf.getServerOwner(serverId);
}
=======
/**
* {@link GlobalConf#verifyValidity()}
*/
public void verifyValidity() {
GlobalConf.verifyValidity();
}
/**
* {@link GlobalConf#existsSecurityServer(SecurityServerId)}
*/
public boolean existsSecurityServer(SecurityServerId securityServerId) {
return GlobalConf.existsSecurityServer(securityServerId);
}
/**
* {@link GlobalConf#getSubjectName(SignCertificateProfileInfo.Parameters, X509Certificate)}
* @param signCertificateProfileInfoParameters
* @param cert
* @return
* @throws Exception
*/
public ClientId getSubjectName(SignCertificateProfileInfoParameters signCertificateProfileInfoParameters,
X509Certificate cert) throws Exception {
return GlobalConf.getSubjectName(signCertificateProfileInfoParameters, cert);
}
>>>>>>>
/**
* {@link GlobalConf#verifyValidity()}
*/
public void verifyValidity() {
GlobalConf.verifyValidity();
}
/**
* {@link GlobalConf#existsSecurityServer(SecurityServerId)}
*/
public boolean existsSecurityServer(SecurityServerId securityServerId) {
return GlobalConf.existsSecurityServer(securityServerId);
}
/**
* {@link GlobalConf#getSubjectName(SignCertificateProfileInfo.Parameters, X509Certificate)}
* @param signCertificateProfileInfoParameters
* @param cert
* @return
* @throws Exception
*/
public ClientId getSubjectName(SignCertificateProfileInfoParameters signCertificateProfileInfoParameters,
X509Certificate cert) throws Exception {
return GlobalConf.getSubjectName(signCertificateProfileInfoParameters, cert);
}
/**
* {@link GlobalConf#getApprovedCAs(String)}
*/
public Collection<ApprovedCAInfo> getApprovedCAs(String instanceIdentifier) {
return GlobalConf.getApprovedCAs(instanceIdentifier);
}
/**
* {@link GlobalConf#getServerOwner(SecurityServerId)}
*/
public static ClientId getServerOwner(SecurityServerId serverId) {
return GlobalConf.getServerOwner(serverId);
} |
<<<<<<<
=======
import java.io.InputStream;
import java.security.Signature;
import java.security.cert.X509Certificate;
import java.util.Map;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.cert.ocsp.OCSPResp;
>>>>>>>
import static ee.ria.xroad.common.ErrorCodes.X_CERT_VALIDATION;
import static ee.ria.xroad.common.ErrorCodes.X_INTERNAL_ERROR;
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_REQUEST;
import static ee.ria.xroad.common.ErrorCodes.X_INVALID_SIGNATURE_VALUE;
import static ee.ria.xroad.common.ErrorCodes.translateException;
import static ee.ria.xroad.common.util.CryptoUtils.readCertificate;
import java.io.InputStream;
import java.security.Signature;
import java.security.cert.X509Certificate;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.cert.ocsp.OCSPResp;
<<<<<<<
import ee.ria.xroad.common.conf.globalconfextension.GlobalConfExtensions;
=======
import ee.ria.xroad.common.identifier.ClientId;
>>>>>>>
import ee.ria.xroad.common.conf.globalconfextension.GlobalConfExtensions;
import ee.ria.xroad.common.identifier.ClientId; |
<<<<<<<
if (Boolean.TRUE == caInfo.getAuthenticationOnly() && KeyUsageInfo.SIGNING == keyUsageInfo) {
throw new WrongKeyUsageException();
=======
if (Boolean.TRUE.equals(caInfo.getAuthenticationOnly()) && KeyUsageInfo.SIGNING == keyUsageInfo) {
throw new CannotBeUsedForSigningException();
>>>>>>>
if (Boolean.TRUE.equals(caInfo.getAuthenticationOnly()) && KeyUsageInfo.SIGNING == keyUsageInfo) {
throw new WrongKeyUsageException(); |
<<<<<<<
=======
/**
* @param queryId the query ID
* @return MD5 hex digest of the given query ID
* @throws Exception if any errors occur
*/
public static String hashQueryId(String queryId) throws Exception {
return hexDigest(MD5_ID, queryId);
}
static String decodeBase64(String base64Encoded) {
return (base64Encoded != null && !base64Encoded.isEmpty())
? new String(CryptoUtils.decodeBase64(base64Encoded)) : null;
}
>>>>>>>
/**
* @param queryId the query ID
* @return MD5 hex digest of the given query ID
* @throws Exception if any errors occur
*/
public static String hashQueryId(String queryId) throws Exception {
return hexDigest(MD5_ID, queryId);
}
static String decodeBase64(String base64Encoded) {
return (base64Encoded != null && !base64Encoded.isEmpty())
? new String(CryptoUtils.decodeBase64(base64Encoded)) : null;
} |
<<<<<<<
import org.niis.xroad.restapi.exceptions.NotFoundException;
import org.niis.xroad.restapi.openapi.model.ServiceDescriptionDisabledNotice;
=======
import org.niis.xroad.restapi.openapi.model.InlineObject10;
>>>>>>>
import org.niis.xroad.restapi.openapi.model.ServiceDescriptionDisabledNotice; |
<<<<<<<
=======
import org.junit.runner.RunWith;
import org.niis.xroad.restapi.dto.InitializationStatusDto;
>>>>>>>
import org.niis.xroad.restapi.dto.InitializationStatusDto; |
<<<<<<<
/**
* {@link GlobalConf#getManagementRequestService()}
*/
public ClientId getManagementRequestService() {
return GlobalConf.getManagementRequestService();
}
=======
/**
* {@link GlobalConf#getApprovedCAs(String)}
*/
public Collection<ApprovedCAInfo> getApprovedCAs(String instanceIdentifier) {
return GlobalConf.getApprovedCAs(instanceIdentifier);
}
/**
* {@link GlobalConf#getServerOwner(SecurityServerId)}
*/
public static ClientId getServerOwner(SecurityServerId serverId) {
return GlobalConf.getServerOwner(serverId);
}
>>>>>>>
/**
* {@link GlobalConf#getApprovedCAs(String)}
*/
public Collection<ApprovedCAInfo> getApprovedCAs(String instanceIdentifier) {
return GlobalConf.getApprovedCAs(instanceIdentifier);
}
/**
* {@link GlobalConf#getServerOwner(SecurityServerId)}
*/
public static ClientId getServerOwner(SecurityServerId serverId) {
return GlobalConf.getServerOwner(serverId);
}
/**
* {@link GlobalConf#getManagementRequestService()}
*/
public ClientId getManagementRequestService() {
return GlobalConf.getManagementRequestService();
} |
<<<<<<<
import ee.ria.xroad.common.conf.serverconf.model.ServiceType;
import org.apache.commons.lang.StringUtils;
import org.niis.xroad.restapi.wsdl.WsdlParser;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
=======
import org.niis.xroad.restapi.exceptions.NotFoundException;
>>>>>>>
import ee.ria.xroad.common.conf.serverconf.model.ServiceType;
import org.apache.commons.lang.StringUtils;
import org.niis.xroad.restapi.exceptions.NotFoundException;
import org.niis.xroad.restapi.wsdl.WsdlParser;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
<<<<<<<
/**
* @param url
* @return true or false depending on the validity of the provided url
*/
public static boolean isValidUrl(String url) {
try {
URL wsdlUrl = new URL(url);
URI uri = wsdlUrl.toURI();
uri.parseServerAuthority();
} catch (MalformedURLException | URISyntaxException e) {
return false;
}
return true;
}
/**
* Get the full service name (e.g. myService.v1) from ServiceType object
* @param serviceType
* @return full service name as String
*/
public static String getServiceFullName(ServiceType serviceType) {
StringBuilder sb = new StringBuilder();
sb.append(serviceType.getServiceCode());
if (!StringUtils.isEmpty(serviceType.getServiceVersion())) {
sb.append(".").append(serviceType.getServiceVersion());
}
return sb.toString();
}
/**
* Get the full service name (e.g. myService.v1) from WsdlParser.ServiceInfo object
* @param serviceInfo
* @return full service name as String
*/
public static String getServiceFullName(WsdlParser.ServiceInfo serviceInfo) {
StringBuilder sb = new StringBuilder();
sb.append(serviceInfo.name);
if (!StringUtils.isEmpty(serviceInfo.version)) {
sb.append(".").append(serviceInfo.version);
}
return sb.toString();
}
=======
/**
* in case of NumberFormatException we throw NotFoundException. Client should not
* know about id parameter details, such as "it should be numeric" -
* the resource with given id just cant be found, and that's all there is to it
* @param id as String
* @return id as Long
*/
public static Long parseLongIdOrThrowNotFound(String id) throws NotFoundException {
Long groupId = null;
try {
groupId = Long.valueOf(id);
} catch (NumberFormatException nfe) {
throw new NotFoundException(nfe);
}
return groupId;
}
>>>>>>>
/**
* @param url
* @return true or false depending on the validity of the provided url
*/
public static boolean isValidUrl(String url) {
try {
URL wsdlUrl = new URL(url);
URI uri = wsdlUrl.toURI();
uri.parseServerAuthority();
} catch (MalformedURLException | URISyntaxException e) {
return false;
}
return true;
}
/**
* Get the full service name (e.g. myService.v1) from ServiceType object
* @param serviceType
* @return full service name as String
*/
public static String getServiceFullName(ServiceType serviceType) {
StringBuilder sb = new StringBuilder();
sb.append(serviceType.getServiceCode());
if (!StringUtils.isEmpty(serviceType.getServiceVersion())) {
sb.append(".").append(serviceType.getServiceVersion());
}
return sb.toString();
}
/**
* Get the full service name (e.g. myService.v1) from WsdlParser.ServiceInfo object
* @param serviceInfo
* @return full service name as String
*/
public static String getServiceFullName(WsdlParser.ServiceInfo serviceInfo) {
StringBuilder sb = new StringBuilder();
sb.append(serviceInfo.name);
if (!StringUtils.isEmpty(serviceInfo.version)) {
sb.append(".").append(serviceInfo.version);
}
return sb.toString();
}
/**
* in case of NumberFormatException we throw NotFoundException. Client should not
* know about id parameter details, such as "it should be numeric" -
* the resource with given id just cant be found, and that's all there is to it
* @param id as String
* @return id as Long
*/
public static Long parseLongIdOrThrowNotFound(String id) throws NotFoundException {
Long groupId = null;
try {
groupId = Long.valueOf(id);
} catch (NumberFormatException nfe) {
throw new NotFoundException(nfe);
}
return groupId;
} |
<<<<<<<
private String isAuthentication; // ClientType isAuthentication values (from DB)
private ConnectionType connectionTypeEnum;
=======
private final String isAuthentication; // ClientType isAuthentication values (from DB)
private final Client.ConnectionTypeEnum connectionTypeEnum;
>>>>>>>
private final String isAuthentication; // ClientType isAuthentication values (from DB)
private final ConnectionType connectionTypeEnum;
<<<<<<<
public static Optional<ConnectionType> map(String isAuthentication) {
Optional<ConnectionTypeMapping> mapping = getFor(isAuthentication);
if (mapping.isPresent()) {
return Optional.of(mapping.get().getConnectionTypeEnum());
} else {
return Optional.empty();
}
=======
public static Optional<Client.ConnectionTypeEnum> map(String isAuthentication) {
return getFor(isAuthentication).map(ConnectionTypeMapping::getConnectionTypeEnum);
>>>>>>>
public static Optional<ConnectionType> map(String isAuthentication) {
return getFor(isAuthentication).map(ConnectionTypeMapping::getConnectionTypeEnum);
<<<<<<<
public static Optional<String> map(ConnectionType connectionTypeEnum) {
Optional<ConnectionTypeMapping> mapping = getFor(connectionTypeEnum);
if (mapping.isPresent()) {
return Optional.of(mapping.get().getIsAuthentication());
} else {
return Optional.empty();
}
=======
public static Optional<String> map(Client.ConnectionTypeEnum connectionTypeEnum) {
return getFor(connectionTypeEnum).map(ConnectionTypeMapping::getIsAuthentication);
>>>>>>>
public static Optional<String> map(ConnectionType connectionTypeEnum) {
return getFor(connectionTypeEnum).map(ConnectionTypeMapping::getIsAuthentication); |
<<<<<<<
new JavaTestKit(system) {{
final Props props = Props.create(MessageRecordingLogManager.class, jobManager)
.withDispatcher("akka.control-aware-dispatcher");
final ActorRef subject = system.actorOf(props);
// request direct access to logmanager instance
subject.tell(MessageRecordingLogManager.GET_INSTANCE_MESSAGE, getRef());
// wait for response with handle to logmanager
final int timeout = 5000;
final FiniteDuration timeoutDuration = FiniteDuration.create(timeout, TimeUnit.MILLISECONDS);
MessageRecordingLogManager logManager = expectMsgClass(timeoutDuration, MessageRecordingLogManager.class);
// stop processing messages
log.debug("stopping processing");
logManager.stopProcessingMessages();
// send bunch of messages. first one will be received and
// then processing stops. once processing is freed, the
// next one (2nd overall) should be the control message
List<Future> replies = new ArrayList();
log.debug("asking first message");
replies.add(Patterns.ask(subject, "dummy first message guaranteed to be processed as first item", timeout));
// wait until the first message has arrived
// (this is needed for predictable results, otherwise 2nd message may overtake the first
// on the way to mailbox)
log.debug("waiting for first message");
logManager.waitForFirstMessageToArrive();
// then the rest of the messages - these are the actual test targets
log.debug("asking the rest of messages");
replies.add(Patterns.ask(subject, "another-foostring", timeout));
replies.add(Patterns.ask(subject, new SoapLogMessage(null, null, false), timeout));
replies.add(Patterns.ask(subject, new FindByQueryId(null, null, null), timeout));
replies.add(Patterns.ask(subject, new SetTimestampingStatusMessage(
SetTimestampingStatusMessage.Status.SUCCESS), timeout));
// enable processing
logManager.resumeProcessingMessages();
// wait for all processed
for (Future f : replies) {
Await.ready(f, timeoutDuration);
=======
new JavaTestKit(system) {
{
final Props props = Props.create(MessageRecordingLogManager.class, jobManager)
.withDispatcher("akka.control-aware-dispatcher");
final ActorRef subject = system.actorOf(props);
// request direct access to logmanager instance
subject.tell(MessageRecordingLogManager.GET_INSTANCE_MESSAGE, getRef());
// wait for response with handle to logmanager
final int timeout = 5000;
final FiniteDuration timeoutDuration = FiniteDuration.create(timeout, TimeUnit.MILLISECONDS);
MessageRecordingLogManager logManager = expectMsgClass(timeoutDuration,
MessageRecordingLogManager.class);
// stop processing messages
log.debug("stopping processing");
logManager.stopProcessingMessages();
// send bunch of messages. first one will be received and
// then processing stops. once processing is freed, the
// next one (2nd overall) should be the control message
List<Future> replies = new ArrayList();
log.debug("asking first message");
replies.add(Patterns.ask(subject, "dummy first message guaranteed to be processed as first item",
timeout));
// wait until the first message has arrived
// (this is needed for predictable results, otherwise 2nd message may overtake the first
// on the way to mailbox)
log.debug("waiting for first message");
logManager.waitForFirstMessageToArrive();
// then the rest of the messages - these are the actual test targets
log.debug("asking the rest of messages");
replies.add(Patterns.ask(subject, "another-foostring", timeout));
replies.add(Patterns.ask(subject, new LogMessage(null, null, false),
timeout));
replies.add(Patterns.ask(subject, new FindByQueryId(null, null, null),
timeout));
replies.add(Patterns.ask(subject, new SetTimestampingStatusMessage(
SetTimestampingStatusMessage.Status.SUCCESS), timeout));
// enable processing
logManager.resumeProcessingMessages();
// wait for all processed
for (Future f : replies) {
Await.ready(f, timeoutDuration);
}
List<Object> messages = logManager.getMessages();
log.debug("logManager mailbox contents: " + dumpMailbox(messages));
assertEquals(5, messages.size());
// check that item #2 is the control message
assertTrue("message should have been SetTimestampingStatusMessage, was "
+ messages.get(1), messages.get(1) instanceof SetTimestampingStatusMessage);
>>>>>>>
new JavaTestKit(system) {
{
final Props props = Props.create(MessageRecordingLogManager.class, jobManager)
.withDispatcher("akka.control-aware-dispatcher");
final ActorRef subject = system.actorOf(props);
// request direct access to logmanager instance
subject.tell(MessageRecordingLogManager.GET_INSTANCE_MESSAGE, getRef());
// wait for response with handle to logmanager
final int timeout = 5000;
final FiniteDuration timeoutDuration = FiniteDuration.create(timeout, TimeUnit.MILLISECONDS);
MessageRecordingLogManager logManager = expectMsgClass(timeoutDuration,
MessageRecordingLogManager.class);
// stop processing messages
log.debug("stopping processing");
logManager.stopProcessingMessages();
// send bunch of messages. first one will be received and
// then processing stops. once processing is freed, the
// next one (2nd overall) should be the control message
List<Future> replies = new ArrayList();
log.debug("asking first message");
replies.add(Patterns.ask(subject, "dummy first message guaranteed to be processed as first item",
timeout));
// wait until the first message has arrived
// (this is needed for predictable results, otherwise 2nd message may overtake the first
// on the way to mailbox)
log.debug("waiting for first message");
logManager.waitForFirstMessageToArrive();
// then the rest of the messages - these are the actual test targets
log.debug("asking the rest of messages");
replies.add(Patterns.ask(subject, "another-foostring", timeout));
replies.add(Patterns.ask(subject, new SoapLogMessage(null, null, false), timeout));
replies.add(Patterns.ask(subject, new FindByQueryId(null, null, null), timeout));
replies.add(Patterns.ask(subject, new SetTimestampingStatusMessage(
SetTimestampingStatusMessage.Status.SUCCESS), timeout));
// enable processing
logManager.resumeProcessingMessages();
// wait for all processed
for (Future f : replies) {
Await.ready(f, timeoutDuration);
}
List<Object> messages = logManager.getMessages();
log.debug("logManager mailbox contents: " + dumpMailbox(messages));
assertEquals(5, messages.size());
// check that item #2 is the control message
assertTrue("message should have been SetTimestampingStatusMessage, was "
+ messages.get(1), messages.get(1) instanceof SetTimestampingStatusMessage); |
<<<<<<<
import org.niis.xroad.restapi.config.audit.AuditDataHelper;
import org.niis.xroad.restapi.config.audit.AuditEventMethod;
=======
import org.niis.xroad.restapi.controller.ServiceClientHelper;
>>>>>>>
import org.niis.xroad.restapi.config.audit.AuditDataHelper;
import org.niis.xroad.restapi.config.audit.AuditEventMethod;
import org.niis.xroad.restapi.controller.ServiceClientHelper;
<<<<<<<
private final ServiceClientIdentifierConverter serviceClientIdentifierConverter;
private final AuditDataHelper auditDataHelper;
=======
private final ServiceClientHelper serviceClientHelper;
>>>>>>>
private final ServiceClientHelper serviceClientHelper;
private final AuditDataHelper auditDataHelper;
<<<<<<<
ServiceClientIdentifierConverter serviceClientIdentifierConverter,
AuditDataHelper auditDataHelper) {
=======
ServiceClientHelper serviceClientHelper) {
>>>>>>>
ServiceClientHelper serviceClientHelper,
ServiceClientIdentifierConverter serviceClientIdentifierConverter,
AuditDataHelper auditDataHelper) {
<<<<<<<
this.serviceClientIdentifierConverter = serviceClientIdentifierConverter;
this.auditDataHelper = auditDataHelper;
=======
this.serviceClientHelper = serviceClientHelper;
>>>>>>>
this.serviceClientHelper = serviceClientHelper;
this.auditDataHelper = auditDataHelper; |
<<<<<<<
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
=======
>>>>>>>
import lombok.RequiredArgsConstructor;
<<<<<<<
import org.springframework.cache.annotation.CacheEvict;
=======
import org.springframework.beans.factory.annotation.Autowired;
>>>>>>> |
<<<<<<<
public ServiceDescriptionType addWsdlServiceDescription(ClientId clientId,
String url,
boolean ignoreWarnings)
throws InvalidWsdlException,
WsdlParser.WsdlNotFoundException,
ClientNotFoundException,
UnhandledWarningsException,
ServiceAlreadyExistsException,
InvalidUrlException,
WsdlUrlAlreadyExistsException {
=======
public ServiceDescriptionType addWsdlServiceDescription(ClientId clientId, String url, boolean ignoreWarnings) {
>>>>>>>
public ServiceDescriptionType addWsdlServiceDescription(ClientId clientId, String url, boolean ignoreWarnings)
throws InvalidWsdlException,
WsdlParser.WsdlNotFoundException,
ClientNotFoundException,
UnhandledWarningsException,
ServiceAlreadyExistsException,
InvalidUrlException,
WsdlUrlAlreadyExistsException {
<<<<<<<
boolean ignoreWarnings)
throws InvalidWsdlException, WsdlParser.WsdlNotFoundException,
WrongServiceDescriptionTypeException, UnhandledWarningsException,
ServiceAlreadyExistsException, InvalidUrlException, WsdlUrlAlreadyExistsException {
=======
boolean ignoreWarnings) {
>>>>>>>
boolean ignoreWarnings)
throws InvalidWsdlException, WsdlParser.WsdlNotFoundException,
WrongServiceDescriptionTypeException, UnhandledWarningsException,
ServiceAlreadyExistsException, InvalidUrlException, WsdlUrlAlreadyExistsException {
<<<<<<<
WarningDeviation addedServicesWarningDeviation = new WarningDeviation(WARNING_ADDING_SERVICES,
changes.getAddedServices());
warnings.add(addedServicesWarningDeviation);
=======
Warning addedServicesWarning = new Warning(WARNING_ADDING_SERVICES,
changes.getAddedFullServiceCodes());
warnings.add(addedServicesWarning);
>>>>>>>
WarningDeviation addedServicesWarning = new WarningDeviation(WARNING_ADDING_SERVICES,
changes.getAddedFullServiceCodes());
warnings.add(addedServicesWarning);
<<<<<<<
WarningDeviation deletedServicesWarningDeviation = new WarningDeviation(WARNING_DELETING_SERVICES,
changes.getRemovedServices());
warnings.add(deletedServicesWarningDeviation);
=======
Warning deletedServicesWarning = new Warning(WARNING_DELETING_SERVICES,
changes.getRemovedFullServiceCodes());
warnings.add(deletedServicesWarning);
>>>>>>>
WarningDeviation deletedServicesWarning = new WarningDeviation(WARNING_DELETING_SERVICES,
changes.getRemovedFullServiceCodes());
warnings.add(deletedServicesWarning);
<<<<<<<
Long updatedServiceDescriptionId) throws WsdlUrlAlreadyExistsException {
for (ServiceDescriptionType serviceDescription : client.getServiceDescription()) {
=======
Long updatedServiceDescriptionId) throws ConflictException {
client.getServiceDescription().forEach(serviceDescription -> {
>>>>>>>
Long updatedServiceDescriptionId) throws WsdlUrlAlreadyExistsException {
for (ServiceDescriptionType serviceDescription : client.getServiceDescription()) {
<<<<<<<
* @throws WsdlValidator.WsdlValidationFailedException
* @throws WsdlValidator.WsdlValidatorNotExecutableException
* @throws InvalidUrlException
=======
* @throws BadRequestException if fatal validation errors occurred
>>>>>>>
* @throws WsdlValidator.WsdlValidationFailedException
* @throws WsdlValidator.WsdlValidatorNotExecutableException
* @throws InvalidUrlException
<<<<<<<
Long updatedServiceDescriptionId)
throws WsdlParser.WsdlNotFoundException,
InvalidWsdlException,
InvalidUrlException,
WsdlUrlAlreadyExistsException,
ServiceAlreadyExistsException {
=======
Long updatedServiceDescriptionId) {
>>>>>>>
Long updatedServiceDescriptionId)
throws WsdlParser.WsdlNotFoundException,
InvalidWsdlException,
InvalidUrlException,
WsdlUrlAlreadyExistsException,
ServiceAlreadyExistsException { |
<<<<<<<
private ClientId existingSavedClientId = ClientId.create("FI", "GOV", "M2", "SS6");
private ClientId existingRegisteredClientId = ClientId.create("FI", "GOV", "M1", "SS1");
private ClientId ownerClientId = ClientId.create("FI", "GOV", "M1", null);
@MockBean
private ManagementRequestSenderService managementRequestSenderService;
=======
private ClientId existingClientId = ClientId.create("FI", "GOV", "M2", "SS6");
@MockBean
private ManagementRequestSenderService managementRequestSenderService;
>>>>>>>
private ClientId existingSavedClientId = ClientId.create("FI", "GOV", "M2", "SS6");
private ClientId existingRegisteredClientId = ClientId.create("FI", "GOV", "M1", "SS1");
private ClientId ownerClientId = ClientId.create("FI", "GOV", "M1", null);
@MockBean
private ManagementRequestSenderService managementRequestSenderService;
private ClientId existingClientId = ClientId.create("FI", "GOV", "M2", "SS6");
<<<<<<<
@Test
public void registerClient() throws Exception {
ClientType clientType = clientService.getLocalClient(existingSavedClientId);
assertEquals(ClientType.STATUS_SAVED, clientType.getClientStatus());
clientService.registerClient(existingSavedClientId);
clientType = clientService.getLocalClient(existingSavedClientId);
assertEquals(ClientType.STATUS_REGINPROG, clientType.getClientStatus());
}
@Test(expected = CodedException.class)
public void registerClientCodedException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any())).thenThrow(CodedException.class);
clientService.registerClient(existingSavedClientId);
}
@Test(expected = DeviationAwareRuntimeException.class)
public void registerClientRuntimeException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any()))
.thenThrow(new ManagementRequestSendingFailedException(new Exception()));
clientService.registerClient(existingSavedClientId);
}
@Test
public void unregisterClient() throws Exception {
ClientType clientType = clientService.getLocalClient(existingRegisteredClientId);
assertEquals(ClientType.STATUS_REGISTERED, clientType.getClientStatus());
clientService.unregisterClient(existingRegisteredClientId);
clientType = clientService.getLocalClient(existingRegisteredClientId);
assertEquals(ClientType.STATUS_DELINPROG, clientType.getClientStatus());
}
@Test(expected = ActionNotPossibleException.class)
public void unregisterClientNotPossible() throws Exception {
ClientType clientType = clientService.getLocalClient(existingSavedClientId);
assertEquals(ClientType.STATUS_SAVED, clientType.getClientStatus());
clientService.unregisterClient(existingSavedClientId);
}
@Test(expected = ClientService.CannotUnregisterOwnerException.class)
public void unregisterOwnerClient() throws Exception {
clientService.unregisterClient(ownerClientId);
}
@Test(expected = CodedException.class)
public void unregisterClientCodedException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any())).thenThrow(CodedException.class);
clientService.registerClient(existingRegisteredClientId);
}
@Test(expected = DeviationAwareRuntimeException.class)
public void unregisterClientRuntimeException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any()))
.thenThrow(new ManagementRequestSendingFailedException(new Exception()));
clientService.registerClient(existingRegisteredClientId);
}
@Test(expected = ClientNotFoundException.class)
public void unregisterNonExistingClient() throws Exception {
clientService.unregisterClient(ClientId.create("non", "existing", "client", null));
}
=======
@Test
public void registerClient() throws Exception {
ClientType clientType = clientService.getLocalClient(existingClientId);
assertEquals(ClientType.STATUS_SAVED, clientType.getClientStatus());
clientService.registerClient(existingClientId);
clientType = clientService.getLocalClient(existingClientId);
assertEquals(ClientType.STATUS_REGINPROG, clientType.getClientStatus());
}
@Test(expected = ClientNotFoundException.class)
public void registerNonExistingClient() throws Exception {
clientService.registerClient(ClientId.create("non", "existing", "client", null));
}
@Test(expected = CodedException.class)
public void registerClientCodedException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any())).thenThrow(CodedException.class);
clientService.registerClient(existingClientId);
}
@Test(expected = DeviationAwareRuntimeException.class)
public void registerClientRuntimeException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any()))
.thenThrow(new ManagementRequestSendingFailedException(new Exception()));
clientService.registerClient(existingClientId);
}
>>>>>>>
@Test
public void registerClient() throws Exception {
ClientType clientType = clientService.getLocalClient(existingClientId);
assertEquals(ClientType.STATUS_SAVED, clientType.getClientStatus());
clientService.registerClient(existingClientId);
clientType = clientService.getLocalClient(existingClientId);
assertEquals(ClientType.STATUS_REGINPROG, clientType.getClientStatus());
}
@Test(expected = ClientNotFoundException.class)
public void registerNonExistingClient() throws Exception {
clientService.registerClient(ClientId.create("non", "existing", "client", null));
}
@Test(expected = CodedException.class)
public void registerClientCodedException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any())).thenThrow(CodedException.class);
clientService.registerClient(existingSavedClientId);
}
@Test(expected = DeviationAwareRuntimeException.class)
public void registerClientRuntimeException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any()))
.thenThrow(new ManagementRequestSendingFailedException(new Exception()));
clientService.registerClient(existingSavedClientId);
}
@Test
public void unregisterClient() throws Exception {
ClientType clientType = clientService.getLocalClient(existingRegisteredClientId);
assertEquals(ClientType.STATUS_REGISTERED, clientType.getClientStatus());
clientService.unregisterClient(existingRegisteredClientId);
clientType = clientService.getLocalClient(existingRegisteredClientId);
assertEquals(ClientType.STATUS_DELINPROG, clientType.getClientStatus());
}
@Test(expected = ActionNotPossibleException.class)
public void unregisterClientNotPossible() throws Exception {
ClientType clientType = clientService.getLocalClient(existingSavedClientId);
assertEquals(ClientType.STATUS_SAVED, clientType.getClientStatus());
clientService.unregisterClient(existingSavedClientId);
}
@Test(expected = ClientService.CannotUnregisterOwnerException.class)
public void unregisterOwnerClient() throws Exception {
clientService.unregisterClient(ownerClientId);
}
@Test(expected = CodedException.class)
public void unregisterClientCodedException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any())).thenThrow(CodedException.class);
clientService.registerClient(existingRegisteredClientId);
}
@Test(expected = DeviationAwareRuntimeException.class)
public void unregisterClientRuntimeException() throws Exception {
when(managementRequestSenderService.sendClientRegisterRequest(any()))
.thenThrow(new ManagementRequestSendingFailedException(new Exception()));
clientService.registerClient(existingRegisteredClientId);
}
@Test(expected = ClientNotFoundException.class)
public void unregisterNonExistingClient() throws Exception {
clientService.unregisterClient(ClientId.create("non", "existing", "client", null));
} |
<<<<<<<
ICommand command = (ICommand) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().getCommands().get(name);
=======
ICommand command = MinecraftServer.getServer().getCommandManager().getCommands().get(name);
>>>>>>>
ICommand command = FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().getCommands().get(name); |
<<<<<<<
import akka.pattern.Patterns;
import akka.util.Timeout;
=======
import akka.actor.Cancellable;
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.UntypedActor;
>>>>>>>
import akka.pattern.Patterns;
import akka.util.Timeout;
<<<<<<<
=======
private static Boolean connected = true;
>>>>>>>
<<<<<<<
=======
//system.actorOf(Props.create(ConnectionPinger.class),
// "ConnectionPinger");
>>>>>>> |
<<<<<<<
import org.niis.xroad.restapi.openapi.model.SecurityServerAddress;
=======
import org.niis.xroad.restapi.openapi.model.PossibleAction;
>>>>>>>
import org.niis.xroad.restapi.openapi.model.PossibleAction;
import org.niis.xroad.restapi.openapi.model.SecurityServerAddress;
<<<<<<<
@Override
@PreAuthorize("hasAuthority('SEND_AUTH_CERT_REG_REQ')")
public ResponseEntity<Void> registerCertificate(String hash, SecurityServerAddress securityServerAddress) {
try {
tokenCertificateService.registerAuthCert(hash, securityServerAddress.getAddress());
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (GlobalConfService.GlobalConfOutdatedException
| TokenCertificateService.InvalidCertificateException
| TokenCertificateService.SignCertificateNotSupportedException e) {
throw new BadRequestException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
@PreAuthorize("hasAuthority('SEND_AUTH_CERT_DEL_REQ')")
public ResponseEntity<Void> unregisterCertificate(String hash) {
try {
tokenCertificateService.unregisterAuthCert(hash);
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (GlobalConfService.GlobalConfOutdatedException | TokenCertificateService.InvalidCertificateException
| TokenCertificateService.SignCertificateNotSupportedException e) {
throw new BadRequestException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
=======
@Override
@PreAuthorize("hasAuthority('DELETE_AUTH_CERT') or hasAuthority('DELETE_SIGN_CERT')")
public ResponseEntity<Void> deleteCertificate(String hash) {
try {
tokenCertificateService.deleteCertificate(hash);
} catch (CertificateNotFoundException | KeyNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (TokenCertificateService.KeyNotOperationalException
| TokenCertificateService.SignerOperationFailedException e) {
throw new InternalServerErrorException(e);
} catch (ActionNotPossibleException e) {
throw new ConflictException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
@PreAuthorize("hasAuthority('VIEW_KEYS')")
public ResponseEntity<List<PossibleAction>> getPossibleActionsForCertificate(String hash) {
try {
EnumSet<PossibleActionEnum> actions = tokenCertificateService
.getPossibleActionsForCertificate(hash);
return new ResponseEntity<>(possibleActionConverter.convert(actions), HttpStatus.OK);
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
}
}
>>>>>>>
@Override
@PreAuthorize("hasAuthority('DELETE_AUTH_CERT') or hasAuthority('DELETE_SIGN_CERT')")
public ResponseEntity<Void> deleteCertificate(String hash) {
try {
tokenCertificateService.deleteCertificate(hash);
} catch (CertificateNotFoundException | KeyNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (TokenCertificateService.KeyNotOperationalException
| TokenCertificateService.SignerOperationFailedException e) {
throw new InternalServerErrorException(e);
} catch (ActionNotPossibleException e) {
throw new ConflictException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
@PreAuthorize("hasAuthority('VIEW_KEYS')")
public ResponseEntity<List<PossibleAction>> getPossibleActionsForCertificate(String hash) {
try {
EnumSet<PossibleActionEnum> actions = tokenCertificateService
.getPossibleActionsForCertificate(hash);
return new ResponseEntity<>(possibleActionConverter.convert(actions), HttpStatus.OK);
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
}
}
@Override
@PreAuthorize("hasAuthority('SEND_AUTH_CERT_REG_REQ')")
public ResponseEntity<Void> registerCertificate(String hash, SecurityServerAddress securityServerAddress) {
try {
tokenCertificateService.registerAuthCert(hash, securityServerAddress.getAddress());
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (GlobalConfService.GlobalConfOutdatedException
| TokenCertificateService.InvalidCertificateException
| TokenCertificateService.SignCertificateNotSupportedException e) {
throw new BadRequestException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
@PreAuthorize("hasAuthority('SEND_AUTH_CERT_DEL_REQ')")
public ResponseEntity<Void> unregisterCertificate(String hash) {
try {
tokenCertificateService.unregisterAuthCert(hash);
} catch (CertificateNotFoundException e) {
throw new ResourceNotFoundException(e);
} catch (GlobalConfService.GlobalConfOutdatedException | TokenCertificateService.InvalidCertificateException
| TokenCertificateService.SignCertificateNotSupportedException e) {
throw new BadRequestException(e);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} |
<<<<<<<
public ResponseEntity<Void> changeOwner(String encodedClientId) {
ClientId clientId = clientConverter.convertId(encodedClientId);
=======
@AuditEventMethod(event = SEND_OWNER_CHANGE_REQ)
public ResponseEntity<Void> changeOwner(Client client) {
>>>>>>>
@AuditEventMethod(event = SEND_OWNER_CHANGE_REQ)
public ResponseEntity<Void> changeOwner(String encodedClientId) {
ClientId clientId = clientConverter.convertId(encodedClientId); |
<<<<<<<
verifyServiceClientIdentifiersExist(clientType, new HashSet(Arrays.asList(subjectId)));
=======
identifierService.verifyServiceClientIdentifiersExist(clientType, subjectIds);
// make sure subject id exists in serverconf db IDENTIFIER table
subjectIds = identifierService.getOrPersistXroadIds(subjectIds);
>>>>>>>
identifierService.verifyServiceClientIdentifiersExist(clientType, new HashSet(Arrays.asList(subjectId))); |
<<<<<<<
assertEquals(4, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.SERVICE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.SERVICE_CALCULATE_PRIME));
assertEquals(4, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_GET_RANDOM));
=======
assertEquals(3, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CODE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CALCULATE_PRIME));
assertEquals(2, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
>>>>>>>
assertEquals(4, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CODE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CALCULATE_PRIME));
assertEquals(3, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
<<<<<<<
assertEquals(4, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.SERVICE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.SERVICE_CALCULATE_PRIME));
assertEquals(4, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_GET_RANDOM));
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CALCULATE_PRIME));
=======
assertEquals(3, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CODE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CALCULATE_PRIME));
assertEquals(2, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
>>>>>>>
assertEquals(4, serviceIds.size());
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CODE_GET_RANDOM));
assertTrue(serviceIds.contains(TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.FULL_SERVICE_CALCULATE_PRIME));
assertEquals(4, serviceCodes.size());
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
assertTrue(serviceCodes.contains(TestUtils.SERVICE_CODE_GET_RANDOM));
<<<<<<<
assertEquals(4, services.size());
Service getRandomService = getService(services, TestUtils.CLIENT_ID_SS1 + ":" + TestUtils.SERVICE_GET_RANDOM);
=======
assertEquals(3, services.size());
Service getRandomService = getService(services, TestUtils.CLIENT_ID_SS1 + ":"
+ TestUtils.FULL_SERVICE_CODE_GET_RANDOM);
>>>>>>>
assertEquals(4, services.size());
Service getRandomService = getService(services, TestUtils.CLIENT_ID_SS1 + ":"
+ TestUtils.FULL_SERVICE_CODE_GET_RANDOM); |
<<<<<<<
import org.niis.xroad.restapi.exceptions.DeviationAwareRuntimeException;
=======
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
import org.niis.xroad.restapi.exceptions.WarningDeviation;
>>>>>>>
import org.niis.xroad.restapi.exceptions.DeviationAwareRuntimeException;
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
import org.niis.xroad.restapi.exceptions.WarningDeviation;
<<<<<<<
private final ManagementRequestSenderService managementRequestSenderService;
=======
private final ServerConfService serverConfService;
private final IdentifierRepository identifierRepository;
>>>>>>>
private final ServerConfService serverConfService;
private final IdentifierRepository identifierRepository;
private final ManagementRequestSenderService managementRequestSenderService;
<<<<<<<
public ClientService(ClientRepository clientRepository, GlobalConfFacade globalConfFacade,
ManagementRequestSenderService managementRequestSenderService) {
=======
public ClientService(ClientRepository clientRepository,
GlobalConfFacade globalConfFacade,
ServerConfService serverConfService,
GlobalConfService globalConfService,
IdentifierRepository identifierRepository) {
>>>>>>>
public ClientService(ClientRepository clientRepository, GlobalConfFacade globalConfFacade,
ServerConfService serverConfService, GlobalConfService globalConfService,
IdentifierRepository identifierRepository, ManagementRequestSenderService managementRequestSenderService) {
<<<<<<<
this.managementRequestSenderService = managementRequestSenderService;
=======
this.serverConfService = serverConfService;
this.globalConfService = globalConfService;
this.identifierRepository = identifierRepository;
>>>>>>>
this.serverConfService = serverConfService;
this.globalConfService = globalConfService;
this.identifierRepository = identifierRepository;
this.managementRequestSenderService = managementRequestSenderService; |
<<<<<<<
import org.niis.xroad.restapi.service.GlobalConfService;
import org.niis.xroad.restapi.service.WsdlUrlValidator;
=======
>>>>>>>
import org.niis.xroad.restapi.service.WsdlUrlValidator; |
<<<<<<<
import ee.ria.xroad.common.identifier.XRoadObjectType;
=======
import ee.ria.xroad.signer.protocol.dto.CertificateInfo;
>>>>>>>
import ee.ria.xroad.common.identifier.XRoadObjectType;
import ee.ria.xroad.signer.protocol.dto.CertificateInfo;
<<<<<<<
import org.niis.xroad.restapi.converter.SubjectConverter;
import org.niis.xroad.restapi.converter.SubjectTypeMapping;
import org.niis.xroad.restapi.dto.AccessRightHolderDto;
=======
import org.niis.xroad.restapi.converter.TokenCertificateConverter;
>>>>>>>
import org.niis.xroad.restapi.converter.SubjectConverter;
import org.niis.xroad.restapi.converter.SubjectTypeMapping;
import org.niis.xroad.restapi.converter.TokenCertificateConverter;
import org.niis.xroad.restapi.dto.AccessRightHolderDto;
<<<<<<<
import org.niis.xroad.restapi.openapi.model.Subject;
import org.niis.xroad.restapi.openapi.model.SubjectType;
import org.niis.xroad.restapi.service.AccessRightService;
=======
import org.niis.xroad.restapi.openapi.model.TokenCertificate;
>>>>>>>
import org.niis.xroad.restapi.openapi.model.Subject;
import org.niis.xroad.restapi.openapi.model.SubjectType;
import org.niis.xroad.restapi.openapi.model.TokenCertificate;
import org.niis.xroad.restapi.service.AccessRightService;
<<<<<<<
private final ServiceService serviceService;
private final AccessRightService accessRightService;
private final SubjectConverter subjectConverter;
=======
private final TokenCertificateConverter tokenCertificateConverter;
>>>>>>>
private final AccessRightService accessRightService;
private final SubjectConverter subjectConverter;
private final TokenCertificateConverter tokenCertificateConverter;
<<<<<<<
* @param serviceService
* @param accessRightService
* @param subjectConverter
=======
* @param tokenCertificateConverter
>>>>>>>
* @param accessRightService
* @param subjectConverter
* @param tokenCertificateConverter
<<<<<<<
ServiceDescriptionService serviceDescriptionService, ServiceService serviceService,
AccessRightService accessRightService, SubjectConverter subjectConverter) {
=======
ServiceDescriptionService serviceDescriptionService,
TokenCertificateConverter tokenCertificateConverter) {
>>>>>>>
ServiceDescriptionService serviceDescriptionService, AccessRightService accessRightService,
SubjectConverter subjectConverter, TokenCertificateConverter tokenCertificateConverter) {
<<<<<<<
this.serviceService = serviceService;
this.accessRightService = accessRightService;
this.subjectConverter = subjectConverter;
=======
this.tokenCertificateConverter = tokenCertificateConverter;
>>>>>>>
this.accessRightService = accessRightService;
this.subjectConverter = subjectConverter;
this.tokenCertificateConverter = tokenCertificateConverter; |
<<<<<<<
import ee.ria.xroad.signer.protocol.dto.KeyInfo;
import ee.ria.xroad.signer.protocol.dto.TokenInfo;
import ee.ria.xroad.signer.protocol.dto.TokenInfoAndKeyId;
=======
import ee.ria.xroad.signer.protocol.dto.KeyInfo;
import ee.ria.xroad.signer.protocol.dto.KeyUsageInfo;
import ee.ria.xroad.signer.protocol.message.GenerateCertRequest;
>>>>>>>
import ee.ria.xroad.signer.protocol.dto.KeyInfo;
import ee.ria.xroad.signer.protocol.dto.KeyUsageInfo;
import ee.ria.xroad.signer.protocol.dto.TokenInfo;
import ee.ria.xroad.signer.protocol.dto.TokenInfoAndKeyId;
import ee.ria.xroad.signer.protocol.message.GenerateCertRequest;
<<<<<<<
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
=======
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
>>>>>>>
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
<<<<<<<
private final KeyService keyService;
private final StateChangeActionHelper stateChangeActionHelper;
private final TokenService tokenService;
=======
private final ClientService clientService;
private final CertificateAuthorityService certificateAuthorityService;
private final KeyService keyService;
private final DnFieldHelper dnFieldHelper;
>>>>>>>
private final ClientService clientService;
private final CertificateAuthorityService certificateAuthorityService;
private final KeyService keyService;
private final DnFieldHelper dnFieldHelper;
private final StateChangeActionHelper stateChangeActionHelper;
private final TokenService tokenService;
<<<<<<<
public TokenCertificateService(GlobalConfService globalConfService, GlobalConfFacade globalConfFacade,
SignerProxyFacade signerProxyFacade, ClientRepository clientRepository,
KeyService keyService,
StateChangeActionHelper stateChangeActionHelper,
TokenService tokenService) {
=======
public TokenCertificateService(SignerProxyFacade signerProxyFacade, ClientService clientService,
CertificateAuthorityService certificateAuthorityService,
KeyService keyService, DnFieldHelper dnFieldHelper,
GlobalConfService globalConfService,
GlobalConfFacade globalConfFacade,
ClientRepository clientRepository) {
this.signerProxyFacade = signerProxyFacade;
this.clientService = clientService;
this.certificateAuthorityService = certificateAuthorityService;
this.keyService = keyService;
this.dnFieldHelper = dnFieldHelper;
>>>>>>>
public TokenCertificateService(SignerProxyFacade signerProxyFacade, ClientService clientService,
CertificateAuthorityService certificateAuthorityService,
KeyService keyService, DnFieldHelper dnFieldHelper,
GlobalConfService globalConfService,
GlobalConfFacade globalConfFacade,
ClientRepository clientRepository,
StateChangeActionHelper stateChangeActionHelper,
TokenService tokenService) {
this.signerProxyFacade = signerProxyFacade;
this.clientService = clientService;
this.certificateAuthorityService = certificateAuthorityService;
this.keyService = keyService;
this.dnFieldHelper = dnFieldHelper; |
<<<<<<<
private final ManagementRequestService managementRequestService;
private final ServerConfService serverConfService;
=======
private final ClientService clientService;
private final CertificateAuthorityService certificateAuthorityService;
private final KeyService keyService;
private final DnFieldHelper dnFieldHelper;
>>>>>>>
private final ManagementRequestService managementRequestService;
private final ServerConfService serverConfService;
private final ClientService clientService;
private final CertificateAuthorityService certificateAuthorityService;
private final KeyService keyService;
private final DnFieldHelper dnFieldHelper;
<<<<<<<
public TokenCertificateService(GlobalConfService globalConfService, GlobalConfFacade globalConfFacade,
SignerProxyFacade signerProxyFacade, ClientRepository clientRepository,
ManagementRequestService managementRequestService, ServerConfService serverConfService) {
=======
public TokenCertificateService(SignerProxyFacade signerProxyFacade, ClientService clientService,
CertificateAuthorityService certificateAuthorityService,
KeyService keyService, DnFieldHelper dnFieldHelper,
GlobalConfService globalConfService,
GlobalConfFacade globalConfFacade,
ClientRepository clientRepository) {
this.signerProxyFacade = signerProxyFacade;
this.clientService = clientService;
this.certificateAuthorityService = certificateAuthorityService;
this.keyService = keyService;
this.dnFieldHelper = dnFieldHelper;
>>>>>>>
public TokenCertificateService(SignerProxyFacade signerProxyFacade, ClientService clientService,
CertificateAuthorityService certificateAuthorityService,
KeyService keyService, DnFieldHelper dnFieldHelper,
GlobalConfService globalConfService,
GlobalConfFacade globalConfFacade,
ClientRepository clientRepository,
ManagementRequestService managementRequestService, ServerConfService serverConfService) {
this.signerProxyFacade = signerProxyFacade;
this.clientService = clientService;
this.certificateAuthorityService = certificateAuthorityService;
this.keyService = keyService;
this.dnFieldHelper = dnFieldHelper; |
<<<<<<<
import org.niis.xroad.restapi.converter.SubjectConverter;
import org.niis.xroad.restapi.converter.SubjectTypeMapping;
import org.niis.xroad.restapi.dto.AccessRightHolderDto;
import org.niis.xroad.restapi.exceptions.BadRequestException;
import org.niis.xroad.restapi.exceptions.Error;
import org.niis.xroad.restapi.exceptions.InvalidParametersException;
import org.niis.xroad.restapi.exceptions.NotFoundException;
=======
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
>>>>>>>
import org.niis.xroad.restapi.converter.SubjectConverter;
import org.niis.xroad.restapi.converter.SubjectTypeMapping;
import org.niis.xroad.restapi.dto.AccessRightHolderDto;
import org.niis.xroad.restapi.exceptions.ErrorDeviation;
<<<<<<<
import org.niis.xroad.restapi.openapi.model.Subject;
import org.niis.xroad.restapi.openapi.model.SubjectType;
=======
import org.niis.xroad.restapi.service.CertificateNotFoundException;
import org.niis.xroad.restapi.service.ClientNotFoundException;
>>>>>>>
import org.niis.xroad.restapi.openapi.model.Subject;
import org.niis.xroad.restapi.openapi.model.SubjectType;
import org.niis.xroad.restapi.service.CertificateNotFoundException;
import org.niis.xroad.restapi.service.ClientNotFoundException;
<<<<<<<
ServiceDescriptionService serviceDescriptionService, ServiceService serviceService,
SubjectConverter subjectConverter) {
this.request = request;
=======
ServiceDescriptionService serviceDescriptionService) {
>>>>>>>
ServiceDescriptionService serviceDescriptionService, ServiceService serviceService,
SubjectConverter subjectConverter) { |
<<<<<<<
// Cluster node configuration ------------------------------------------ //
/**
* The type of this server node in the cluster. Default is {@link #STANDALONE} which means this server is not
* part of a cluster.
*/
public enum NodeType {
STANDALONE, MASTER, SLAVE;
/** Parse an enum (ignoring case) from the given String or return the default {@link #STANDALONE}
* if the argument is not understood.
* @param name
* @return
*/
public static NodeType fromStringIgnoreCaseOrReturnDefault(String name) {
return Arrays.stream(NodeType.values())
.filter(e -> e.name().equalsIgnoreCase(name))
.findAny()
.orElse(STANDALONE);
}
}
public static final String NODE_TYPE = PREFIX + "node.type";
=======
// Environmental Monitoring -------------------------- //
/** Property name of environmental monitor port. */
public static final String ENV_MONITOR_PORT =
PREFIX + "env-monitor.port";
/** Property name of system metrics sensor interval. */
public static final String ENV_MONITOR_SYSTEM_METRICS_SENSOR_INTERVAL =
PREFIX + "env-monitor.system-metrics-sensor-interval";
/** Property name of disk space sensor interval. */
public static final String ENV_MONITOR_DISK_SPACE_SENSOR_INTERVAL =
PREFIX + "env-monitor.disk-space-sensor-interval";
/** Property name of system metrics sensor interval. */
public static final String ENV_MONITOR_EXEC_LISTING_SENSOR_INTERVAL =
PREFIX + "env-monitor.exec-listing-sensor-interval";
>>>>>>>
// Environmental Monitoring -------------------------- //
/** Property name of environmental monitor port. */
public static final String ENV_MONITOR_PORT =
PREFIX + "env-monitor.port";
/** Property name of system metrics sensor interval. */
public static final String ENV_MONITOR_SYSTEM_METRICS_SENSOR_INTERVAL =
PREFIX + "env-monitor.system-metrics-sensor-interval";
/** Property name of disk space sensor interval. */
public static final String ENV_MONITOR_DISK_SPACE_SENSOR_INTERVAL =
PREFIX + "env-monitor.disk-space-sensor-interval";
/** Property name of system metrics sensor interval. */
public static final String ENV_MONITOR_EXEC_LISTING_SENSOR_INTERVAL =
PREFIX + "env-monitor.exec-listing-sensor-interval";
// Cluster node configuration ------------------------------------------ //
/**
* The type of this server node in the cluster. Default is {@link #STANDALONE} which means this server is not
* part of a cluster.
*/
public enum NodeType {
STANDALONE, MASTER, SLAVE;
/** Parse an enum (ignoring case) from the given String or return the default {@link #STANDALONE}
* if the argument is not understood.
* @param name
* @return
*/
public static NodeType fromStringIgnoreCaseOrReturnDefault(String name) {
return Arrays.stream(NodeType.values())
.filter(e -> e.name().equalsIgnoreCase(name))
.findAny()
.orElse(STANDALONE);
}
}
public static final String NODE_TYPE = PREFIX + "node.type"; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.