text:
package com.cidesign.jianghomestylephone.async;

import java.util.HashMap;
import java.util.List;

import com.cidesign.jianghomestylephone.R;
import com.cidesign.jianghomestylephone.adapter.CommunityViewpagerAdapter;
import com.cidesign.jianghomestylephone.adapter.HumanityViewpagerAdapter;
import com.cidesign.jianghomestylephone.adapter.LandscapeViewpagerAdapter;
import com.cidesign.jianghomestylephone.adapter.StoryViewpagerAdapter;
import com.cidesign.jianghomestylephone.db.DatabaseHelper;
import com.cidesign.jianghomestylephone.entity.ArticleEntity;
import com.cidesign.jianghomestylephone.tools.CategoryDataLoadingLogic;
import com.cidesign.jianghomestylephone.tools.LoadingDataFromDB;
import com.cidesign.jianghomestylephone.tools.LoadingImageTools;
import com.cidesign.jianghomestylephone.tools.StorageUtils;
import com.cidesign.jianghomestylephone.tools.TimeTools;
import com.cidesign.jianghomestylephone.tools.WidgetCache;
import com.cidesign.jianghomestylephone.widget.CommunityRelativeLayout;
import com.cidesign.jianghomestylephone.widget.HumanityRelativeLayout;
import com.cidesign.jianghomestylephone.widget.LandscapeRelativeLayout;
import com.cidesign.jianghomestylephone.widget.StoryRelativeLayout;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;

public class AsyncInitData extends AsyncTask<Void, Void, Object[]>
{
	private Activity activity;
	private int screenWidth;
	private LoadingDataFromDB loadingDataFromDB = null;
	private DatabaseHelper dbHelper;
	private LayoutInflater inflater = null;

	private ProgressBar progressBar = null;

	private HashMap<Integer, View> widgetCache;

	// ·ç¾°ÄÚÈÝÃæ°å¿Ø¼þ
	private ImageButton landscapePreClick;
	private ImageButton landscapeNextClick;
	private ViewPager landscapeViewPager;
	private LandscapeViewpagerAdapter landscapeViewpagerAdapter;

	// ÈËÎÄ
	private ImageButton humanityPreClick;
	private ImageButton humanityNextClick;
	private ViewPager humanityViewPager;
	private HumanityViewpagerAdapter humanityViewpagerAdapter;

	// ÎïÓïÄÚÈÝÃæ°å¿Ø¼þ
	private ImageButton storyPreClick;
	private ImageButton storyNextClick;
	private ViewPager storyViewPager;
	private StoryViewpagerAdapter storyViewpagerAdapter;

	// С¼ÇÄÚÈÝÃæ°å¿Ø¼þ
	private ImageButton communityPreClick;
	private ImageButton communityNextClick;
	private ViewPager communityViewPager;
	private CommunityViewpagerAdapter communityViewpagerAdapter;

	public AsyncInitData(Activity activity, DatabaseHelper dbHelper, LayoutInflater inflater, int screenWidth)
	{
		this.activity = activity;
		this.dbHelper = dbHelper;
		this.inflater = inflater;
		this.screenWidth = screenWidth;
	}

	@Override
	protected void onPreExecute()
	{
		loadingDataFromDB = new LoadingDataFromDB();
		widgetCache = WidgetCache.getInstance().getViewCache();

		landscapePreClick = (ImageButton)widgetCache.get(R.id.landscapePreClick);
		landscapeNextClick = (ImageButton)widgetCache.get(R.id.landscapeNextClick);
		LandscapeRelativeLayout landscapeRelativeLayout = (LandscapeRelativeLayout)widgetCache.get(R.id.landscapeRelativeLayout);
		landscapeRelativeLayout.setLandscapePreClick(landscapePreClick);
		landscapeRelativeLayout.setLandscapeNextClick(landscapeNextClick);
		landscapeViewPager = (ViewPager)widgetCache.get(R.id.landscapeViewPager);

		humanityPreClick = (ImageButton)widgetCache.get(R.id.humanityPreClick);
		humanityNextClick = (ImageButton)widgetCache.get(R.id.humanityNextClick);
		HumanityRelativeLayout humanityRelativeLayout = (HumanityRelativeLayout)widgetCache.get(R.id.humanityRelativeLayout);
		humanityRelativeLayout.setHumanityPreClick(humanityPreClick);
		humanityRelativeLayout.setHumanityNextClick(humanityNextClick);
		humanityViewPager = (ViewPager)widgetCache.get(R.id.humanityViewPager);

		storyPreClick = (ImageButton)widgetCache.get(R.id.storyPreClick);
		storyNextClick = (ImageButton)widgetCache.get(R.id.storyNextClick);
		StoryRelativeLayout storyRelativeLayout = (StoryRelativeLayout)widgetCache.get(R.id.storyRelativeLayout);
		storyRelativeLayout.setStoryPreClick(storyPreClick);
		storyRelativeLayout.setStoryNextClick(storyNextClick);
		storyViewPager = (ViewPager)widgetCache.get(R.id.storyViewPager);

		communityPreClick = (ImageButton)widgetCache.get(R.id.communityPreClick);
		communityNextClick = (ImageButton)widgetCache.get(R.id.communityNextClick);
		CommunityRelativeLayout communityRelativeLayout = (CommunityRelativeLayout)widgetCache.get(R.id.communityRelativeLayout);
		communityRelativeLayout.setCommunityPreClick(communityPreClick);
		communityRelativeLayout.setCommunityNextClick(communityNextClick);
		communityViewPager = (ViewPager)widgetCache.get(R.id.communityViewPager);

	}

	@Override
	protected Object[] doInBackground(Void... arg0)
	{
		Object[] objectArray = new Object[5];
		// ¶ÁÈ¡Êý¾Ý¿â¼ÓÔØÊý¾Ý
		List<ArticleEntity> topFourList = loadingDataFromDB.loadTopFourArticle(dbHelper.getArticleListDataDao());
		objectArray[0] = topFourList;

		// ³õ'»¯·ç¾°
		List<ArticleEntity> landscapeList = loadingDataFromDB.loadLandscapeArticle(dbHelper.getArticleListDataDao());
		objectArray[1] = landscapeList;

		// ³õ'»¯ÈËÎÄ
		List<ArticleEntity> humanityList = loadingDataFromDB.loadHumanityArticle(dbHelper.getArticleListDataDao());
		objectArray[2] = humanityList;

		// ³õ'»¯ÎïÓï
		List<ArticleEntity> storyList = loadingDataFromDB.loadStoryArticle(dbHelper.getArticleListDataDao());
		objectArray[3] = storyList;

		// ³õ'»¯ÉçÇø
		List<ArticleEntity> communityList = loadingDataFromDB.loadCommunityArticle(dbHelper.getArticleListDataDao());
		objectArray[4] = communityList;
		return objectArray;
	}

	@Override
	protected void onPostExecute(Object[] result)
	{
		@SuppressWarnings("unchecked")
		List<ArticleEntity> topFourList = (List<ArticleEntity>) result[0];
		@SuppressWarnings("unchecked")
		List<ArticleEntity> landscapeList = (List<ArticleEntity>) result[1];
		@SuppressWarnings("unchecked")
		List<ArticleEntity> humanityList = (List<ArticleEntity>) result[2];
		@SuppressWarnings("unchecked")
		List<ArticleEntity> storyList = (List<ArticleEntity>) result[3];
		@SuppressWarnings("unchecked")
		List<ArticleEntity> communityList = (List<ArticleEntity>) result[4];

		if (topFourList.size() >= 1)
		{
			ArticleEntity aEntity = topFourList.get(0);

			LoadingImageTools loadingImg = new LoadingImageTools();

			ImageView homeBgImg = (ImageView) widgetCache.get(R.id.homeBigBg);
			final VideoView mVideoView = (VideoView) widgetCache.get(R.id.videoView);

			if (aEntity.getMax_bg_img() == null || aEntity.getMax_bg_img().equals(""))
			{
				homeBgImg.setVisibility(View.VISIBLE);
				loadingImg.loadingNativeImage(activity, homeBgImg, "bg1.jpg");
			}
			else if (aEntity.getMax_bg_img().endsWith(".mp4"))
			{
				if (mVideoView != null)
				{
					final String videoPath = "file://" + StorageUtils.FILE_ROOT + aEntity.getServerID() + "/"
							+ aEntity.getMax_bg_img();
					homeBgImg.setVisibility(View.GONE);
					mVideoView.setVisibility(View.VISIBLE);
					mVideoView.setVideoPath(videoPath);
					mVideoView.start();
					mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
					{

						@Override
						public void onPrepared(MediaPlayer mp)
						{
							mp.start();
							mp.setLooping(true);

						}
					});

					mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
					{

						@Override
						public void onCompletion(MediaPlayer mp)
						{
							mVideoView.setVideoPath(videoPath);
							mVideoView.start();

						}
					});

					mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener()
					{

						@Override
						public boolean onError(MediaPlayer mp, int what, int extra)
						{
							Toast.makeText(activity, "ÎÞ·¨²¥·Å±³¾°ÊÓƵÎļþ!", Toast.LENGTH_LONG).show();
							return true;
						}
					});
				}
			}
			else
			{
				homeBgImg.setVisibility(View.VISIBLE);
				loadingImg
						.loadingImage(homeBgImg, StorageUtils.FILE_ROOT + aEntity.getServerID() + "/" + aEntity.getMax_bg_img());
			}
			((TextView) widgetCache.get(R.id.homeArticleTitle)).setText(aEntity.getTitle());
			((TextView) widgetCache.get(R.id.homeArticleTime)).setText(TimeTools.getTimeByTimestap(Long.parseLong(aEntity.getPost_date())));
			((LinearLayout) widgetCache.get(R.id.homeLinearLayout)).setTag(aEntity);
			if (topFourList.size() >= 2)
			{
				CategoryDataLoadingLogic.loadHeadLineData(topFourList, (LinearLayout) widgetCache.get(R.id.recommandLayout),
						screenWidth, inflater); // ³õ'»¯Í·Ìõ
			}
		}

		if (landscapeList != null && landscapeList.size() > 0)
		{
			landscapeViewpagerAdapter = new LandscapeViewpagerAdapter();
			landscapeViewpagerAdapter.setActivity(activity);
			landscapeViewpagerAdapter.setScreenWidth(screenWidth);
			landscapeViewpagerAdapter.getList().addAll(landscapeList);
			landscapeViewPager.setAdapter(landscapeViewpagerAdapter);
		}

		if (humanityList != null && humanityList.size() > 0)
		{
			humanityViewpagerAdapter = new HumanityViewpagerAdapter();
			humanityViewpagerAdapter.setActivity(activity);
			humanityViewpagerAdapter.setScreenWidth(screenWidth);
			humanityViewpagerAdapter.getList().addAll(humanityList);
			humanityViewPager.setAdapter(humanityViewpagerAdapter);
		}

		if (storyList != null && storyList.size() > 0)
		{
			storyViewpagerAdapter = new StoryViewpagerAdapter();
			storyViewpagerAdapter.setActivity(activity);
			storyViewpagerAdapter.setScreenWidth(screenWidth);
			storyViewpagerAdapter.getList().addAll(storyList);
			storyViewPager.setAdapter(storyViewpagerAdapter);
		}

		if (communityList != null && communityList.size() > 0)
		{
			communityViewpagerAdapter = new CommunityViewpagerAdapter();
			communityViewpagerAdapter.setActivity(activity);
			communityViewpagerAdapter.setScreenWidth(screenWidth);
			communityViewpagerAdapter.getList().addAll(communityList);
			communityViewPager.setAdapter(communityViewpagerAdapter);
		}
		((ProgressBar) widgetCache.get(R.id.loadingProgressBar)).setVisibility(View.INVISIBLE);
	}
}


text:
import mock
import unittest

from kfp_component.google.dataproc import submit_sparksql_job

MODULE = 'kfp_component.google.dataproc._submit_sparksql_job'

@mock.patch(MODULE + '.submit_job')
class TestSubmitSparkSqlJob(unittest.TestCase):

    def test_submit_sparksql_job_with_expected_payload(self, mock_submit_job):
        submit_sparksql_job('mock-project', 'mock-region', 'mock-cluster',
            job_id_output_path='/tmp/kfp/output/dataproc/job_id.txt',
            queries=['select * from mock_table'],
            script_variables={'var-1': 'value1'},
            sparksql_job={ 'jarFileUris': ['gs://jar/file.jar'] },
            job={ 'labels': {'key1': 'value1'}})

        mock_submit_job.assert_called_with('mock-project', 'mock-region', 'mock-cluster',
            {
                'sparkSqlJob': {
                    'queryList': { 'queries': [
                        'select * from mock_table'
                    ]},
                    'scriptVariables': {'var-1': 'value1'},
                    'jarFileUris': ['gs://jar/file.jar']
                },
                'labels': {
                    'key1': 'value1'
                }
            }, 30, job_id_output_path='/tmp/kfp/output/dataproc/job_id.txt')

redpajama_set_name: RedPajamaGithub


text:
| Schema | [config](../../schemas/config.md) |
| ------ | ----------------------------------------------- |
| Materialized View Name | smtp_config_scrud_view |
| Owner | frapid_db_user |
| Tablespace | DEFAULT |
| Description |  |

**Source:**

```plpgsql
 CREATE OR REPLACE VIEW config.smtp_config_scrud_view
 AS
 SELECT smtp_configs.smtp_config_id,
    smtp_configs.configuration_name,
    smtp_configs.enabled,
    smtp_configs.is_default,
    smtp_configs.from_display_name,
    smtp_configs.from_email_address
   FROM config.smtp_configs
  WHERE NOT smtp_configs.deleted;
```

### Related Contents
* [Schema List](../../schemas.md)
* [View List](../../views.md)
* [Materialized View List](../../materialized-views.md)
* [Table of Contents](../../README.md)


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<title>Knights of Columbus - Kansas State Council</title>
	<link rel="stylesheet" type="text/css" media="all" href="../../../../index.php@css=site%252Fsite_css.css" />
	<link rel="shortcut icon" href="favicon.ico.html" >

Knights of Columbus
Kansas State Council

		Your browser does not support JavaScript, therefore, some of the functionality of this site will not be available to you (including the menu).

Click here to go to the Site Map.

Other Information

						Career Opportunities

						Insurance in Kansas

						Is the insurance any good?

Protecting Families for Generations

Father McGivney understood that the first duty of a Catholic husband and father is to his family - to care for their needs while alive and, to the best of his ability, to provide for their care in the event of his death. He also knew well the tragic needs of Catholic families of the deceased men in his community. Central to Father McGivney’s founding vision for the Knights of Columbus was providing for the financial security of Catholic families, particularly the widows and orphans of deceased members.

The first purpose listed in the Order’s 1882 charter is “rendering pecuniary aid to its members, their families, and beneficiaries of members and their families.” The establishment of a financially sound insurance program for members of the Order was a primary goal. Today, lack of adequate financial resources is still a great threat to family life. Now, more than ever, the Knights of Columbus continues to address the temporal needs of Catholic families, especially through one of the most highly-rated insurance programs in the world.

The corporate charter of the Knights of Columbus, granted by the Connecticut General Assembly on March 29, 1882, provides that: “The purposes for which said corporation is formed are the following: (a) of rendering pecuniary aid to its members, their families and beneficiaries of members and their families; (b) of rendering mutual aid and assistance to its sick, disabled and needy members and their families; (c) of promoting social and intellectual intercourse among its members and their families; and (d) of promoting and conducting educational, charitable, religious, social welfare, war relief and welfare, and public relief work.”

The Knights of Columbus meets the goals of this charter by sponsoring council activities, by providing assistance to the Catholic Church, by doing charitable work in the communities where we exist, and by offering high-quality, individual life insurance to its members and families.

Father Michael J. McGivney - our founder - recognized and believed that the people of his day needed the protection that a life insurance program would bring. He wanted to guarantee that the Catholic widow and children of his time would be able to sustain the loss of their breadwinner, and continue with a life not afflicted with poverty and despair.

Today, 119 years later, the Knights of Columbus goal remains the same: protection of the Catholic families that choose membership in our Order.

(Reprinted from the Supreme Council on August 3, 2002:)

In the days of Father McGivney, the insurance feature was a rudimentary system of collecting money and distributing benefits. Today it encompasses more than $31 billion of life insurance in force, with more than 1.3 million individual policies. A professional and knowledgeable agency field force numbering 1,350 brings the program to the home of every eligible Knight, tailoring a plan of life insurance coverage to meet his family’s individual needs.

The Knights of Columbus insurance program has provided peace of mind to millions of men and women for more than a century. The continuing growth of the number of policies and the insurance in force is a testament to the confidence members have in the Order’s ability to provide protection for them today, and well into the future.

The Knights of Columbus sells its insurance to its members, wives of members, and dependents. It is sold through a career sales force that currently consists of more than 1,350 full-time professionally trained field agents.

These agents are equipped with one of the most modern computer programs available. It enables them to perform a needs analysis of the member and his family. This needs analysis allows the agent and the Knight to determine together the total amount of insurance protection needed, and calculate the best way to package the products to meet those needs.

Our products have been “Protecting Families for Generations.” We would like nothing better than to have the opportunity to help you protect your family.

Read About Our Insurance Program at the Knights of Columbus Insurance Web site by clicking here.

	&copy Knights of Columbus - Kansas State Council

	For comments or questions please email webmaster@kansas-kofc.org


text:
import os

client_types = {"Base": 0, "A La Carte": 1, "Standing Order": 2, "Catering": 3}
client_attribute_order = ["id", "client_type", "name", "phone", "address",
                          "delivery", "hash", "tax_exempt", "tax_exempt", "contact",
                          "contact_phone", "contact_email", "weekly_money", "monday_salads",
                          "thursday_salads", "salad_dressings", "monday_hotplates",
                          "tuesday_hotplates", "thursday_hotplates", "allergies",
                          "dietary_preferences", "protein", "salad_dislikes",
                          "salad_loves", "hotplate_likes", "hotplate_dislikes",
                          "hotplate_loves", "general_notes", "salad_notes",
                          "hotplate_notes"]
client_type_order = ["Base", "A La Carte", "Standing Order", "Catering"]
client_attributes = {}
client_attributes[0] = sorted(["name", "phone", "general_notes"
                               ],
                              key=lambda x: client_attribute_order.index(x))
client_attributes[1] = sorted(client_attributes[0]
                              + ["address", "delivery",
                                 "allergies", "dietary_preferences"],
                              key=lambda x: client_attribute_order.index(x))
client_attributes[2] = sorted(client_attributes[0]
                              + ["address", "delivery",
                                 "allergies", "dietary_preferences",
                                 "weekly_money", "monday_salads", "thursday_salads",
                                 "salad_dressings", "protein", "salad_dislikes",
                                 "salad_loves", "salad_notes", "hotplate_likes",
                                 "hotplate_dislikes", "hotplate_loves",
                                 "hotplate_notes", "monday_hotplates",
                                 "tuesday_hotplates", "thursday_hotplates"],
                              key=lambda x: client_attribute_order.index(x))
client_attributes[3] = sorted(client_attributes[0]
                              + ["address", "delivery",
                                 "tax_exempt", "contact", "contact_phone", "contact_email"],
                              key=lambda x: client_attribute_order.index(x))
input_types = {
    "default_text": ["address", "monday_salads", "thursday_salads",
                     "monday_hotplates", "tuesday_hotplates", "thursday_hotplates", "contact",
                     "contact_email"],
    "opinion_text": ["protein", "salad_dislikes", "salad_loves",
                     "hotplate_likes", "hotplate_dislikes", "hotplate_loves",
                     "allergies"],
    "note_text": ["general_notes", "salad_notes", "hotplate_notes"],
    "boolean": ["salad_dressings", "delivery", "tax_exempt"],
    "money": ["weekly_money"]
}
try:
    # connect to production db if running in AWS
    db_config = "mysql+mysqldb://{username}:{password}@{server}:{port}/{db}".format(
        username=os.environ["RDS_USERNAME"], password=os.environ["RDS_PASSWORD"],
        server=os.environ["RDS_HOSTNAME"], port=os.environ["RDS_PORT"],
        db=os.environ["RDS_DB_NAME"])
except:
    # connect to testing db
    db_config = "mysql+mysqldb://admin:jOKb7lRRps&smt1bPeW!$@{server}:3306/ebdb".format(
        server="celinas-kitchen-testing.czfoxvxyu3gn.us-east-2.rds.amazonaws.com")


text:
package structs

import (
	"fmt"
)

// TxnKVOp is used to define a single operation on the KVS inside a
// transaction
type TxnKVOp struct {
	Verb   KVSOp
	DirEnt DirEntry
}

// TxnKVResult is used to define the result of a single operation on the KVS
// inside a transaction.
type TxnKVResult *DirEntry

// TxnOp is used to define a single operation inside a transaction. Only one
// of the types should be filled out per entry.
type TxnOp struct {
	KV *TxnKVOp
}

// TxnOps is a list of operations within a transaction.
type TxnOps []*TxnOp

// TxnRequest is used to apply multiple operations to the state store in a
// single transaction
type TxnRequest struct {
	Datacenter string
	Ops        TxnOps
	WriteRequest
}

func (r *TxnRequest) RequestDatacenter() string {
	return r.Datacenter
}

// TxnReadRequest is used as a fast path for read-only transactions that don't
// modify the state store.
type TxnReadRequest struct {
	Datacenter string
	Ops        TxnOps
	QueryOptions
}

func (r *TxnReadRequest) RequestDatacenter() string {
	return r.Datacenter
}

// TxnError is used to return information about an error for a specific
// operation.
type TxnError struct {
	OpIndex int
	What    string
}

// Error returns the string representation of an atomic error.
func (e TxnError) Error() string {
	return fmt.Sprintf("op %d: %s", e.OpIndex, e.What)
}

// TxnErrors is a list of TxnError entries.
type TxnErrors []*TxnError

// TxnResult is used to define the result of a given operation inside a
// transaction. Only one of the types should be filled out per entry.
type TxnResult struct {
	KV TxnKVResult
}

// TxnResults is a list of TxnResult entries.
type TxnResults []*TxnResult

// TxnResponse is the structure returned by a TxnRequest.
type TxnResponse struct {
	Results TxnResults
	Errors  TxnErrors
}

// TxnReadResponse is the structure returned by a TxnReadRequest.
type TxnReadResponse struct {
	TxnResponse
	QueryMeta
}


text:
===========================================
Utility functions to manipulate Neo objects
===========================================

.. automodule:: elephant.neo_tools
   :members:


text:
<?xml version="1.0" encoding="utf-8"?>
<!--

 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
    <testCase name="Magento\Widget\Test\TestCase\CreateWidgetEntityTest" summary="Create Widget" ticketId="MAGETWO-27916">
        <variation name="CreateWidgetEntityTestVariation1">
            <data name="widget/data/code" xsi:type="string">CMS Static Block</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">on_category</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">cmsStaticBlock</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetOnFrontendInCatalog" />
        </variation>
        <variation name="CreateWidgetEntityTestVariation2">
            <data name="tag" xsi:type="string">test_type:extended_acceptance_test</data>
            <data name="widget/data/code" xsi:type="string">CMS Page Link</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">for_cms_page_link</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">cmsPageLink</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetCmsPageLink" />
        </variation>
        <variation name="CreateWidgetEntityTestVariation3">
            <data name="widget/data/code" xsi:type="string">Recently Viewed Products</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">for_viewed_products</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">recentlyViewedProducts</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetRecentlyViewedProducts" />
        </variation>
        <variation name="CreateWidgetEntityTestVariation4">
            <data name="widget/data/code" xsi:type="string">Recently Compared Products</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">for_compared_products</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">recentlyComparedProducts</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetRecentlyComparedProducts" />
        </variation>
        <variation name="CreateWidgetEntityTestVariation5">
            <data name="widget/data/code" xsi:type="string">Catalog Category Link</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">for_category_link</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">catalogCategoryLink</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetCatalogCategoryLink" />
        </variation>
        <variation name="CreateWidgetEntityTestVariation6">
            <data name="tag" xsi:type="string">test_type:extended_acceptance_test</data>
            <data name="widget/data/code" xsi:type="string">Catalog Product Link</data>
            <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data>
            <data name="widget/data/title" xsi:type="string">Title_%isolation%</data>
            <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data>
            <data name="widget/data/widget_instance/dataset" xsi:type="string">on_product_link</data>
            <data name="widget/data/parameters/dataset" xsi:type="string">catalogProductLink</data>
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetInGrid" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetOnFrontendInCatalog" />
            <constraint name="Magento\Widget\Test\Constraint\AssertWidgetProductLink" />
        </variation>
    </testCase>
</config>


text:
package com.amazonaws.services.resiliencehub.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Defines an application assessment.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AppAssessment implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app/app-id. For more information about ARNs,
     * see  Amazon Resource Names
     * (ARNs) in the AWS General Reference.
     *

     */
    private String appArn;
    /**
     *

     * The version of the application.
     *

     */
    private String appVersion;
    /**
     *

     * The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app-assessment/app-id. For more information
     * about ARNs, see  Amazon
     * Resource Names (ARNs) in the AWS General Reference.
     *

     */
    private String assessmentArn;
    /**
     *

     * The name of the assessment.
     *

     */
    private String assessmentName;
    /**
     *

     * The current status of the assessment for the resiliency policy.
     *

     */
    private String assessmentStatus;
    /**
     *

     * The application compliance against the resiliency policy.
     *

     */
    private java.util.Map<String, DisruptionCompliance> compliance;
    /**
     *

     * The current status of the compliance for the resiliency policy.
     *

     */
    private String complianceStatus;
    /**
     *

     * The cost for the application.
     *

     */
    private Cost cost;
    /**
     *

     * The end time for the action.
     *

     */
    private java.util.Date endTime;
    /**
     *

     * The entity that invoked the assessment.
     *

     */
    private String invoker;
    /**
     *

     * Error or warning message from the assessment execution
     *

     */
    private String message;
    /**
     *

     * The resiliency policy.
     *

     */
    private ResiliencyPolicy policy;
    /**
     *

     * The current resiliency score for the application.
     *

     */
    private ResiliencyScore resiliencyScore;
    /**
     *

     * A resource error object containing a list of errors retrieving an application's resources.
     *

     */
    private ResourceErrorsDetails resourceErrorsDetails;
    /**
     *

     * The starting time for the action.
     *

     */
    private java.util.Date startTime;
    /**
     *

     * The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
     * consists of a key/value pair.
     *

     */
    private java.util.Map<String, String> tags;

    /**
     *

     * The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app/app-id. For more information about ARNs,
     * see  Amazon Resource Names
     * (ARNs) in the AWS General Reference.
     *

     *
     * @param appArn
     *        The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     *        :resiliencehub:region:account:app/app-id. For more information
     *        about ARNs, see
     *        Amazon Resource Names (ARNs) in the AWS General Reference.
     */

    public void setAppArn(String appArn) {
        this.appArn = appArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app/app-id. For more information about ARNs,
     * see  Amazon Resource Names
     * (ARNs) in the AWS General Reference.
     *

     *
     * @return The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     *         :resiliencehub:region:account:app/app-id. For more information
     *         about ARNs, see
     *         Amazon Resource Names (ARNs) in the AWS General Reference.
     */

    public String getAppArn() {
        return this.appArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app/app-id. For more information about ARNs,
     * see  Amazon Resource Names
     * (ARNs) in the AWS General Reference.
     *

     *
     * @param appArn
     *        The Amazon Resource Name (ARN) of the application. The format for this ARN is: arn:partition
     *        :resiliencehub:region:account:app/app-id. For more information
     *        about ARNs, see
     *        Amazon Resource Names (ARNs) in the AWS General Reference.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withAppArn(String appArn) {
        setAppArn(appArn);
        return this;
    }

    /**
     *

     * The version of the application.
     *

     *
     * @param appVersion
     *        The version of the application.
     */

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    /**
     *

     * The version of the application.
     *

     *
     * @return The version of the application.
     */

    public String getAppVersion() {
        return this.appVersion;
    }

    /**
     *

     * The version of the application.
     *

     *
     * @param appVersion
     *        The version of the application.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withAppVersion(String appVersion) {
        setAppVersion(appVersion);
        return this;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app-assessment/app-id. For more information
     * about ARNs, see  Amazon
     * Resource Names (ARNs) in the AWS General Reference.
     *

     *
     * @param assessmentArn
     *        The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     *        :resiliencehub:region:account:app-assessment/app-id. For more
     *        information about ARNs, see  Amazon Resource Names
     *        (ARNs) in the AWS General Reference.
     */

    public void setAssessmentArn(String assessmentArn) {
        this.assessmentArn = assessmentArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app-assessment/app-id. For more information
     * about ARNs, see  Amazon
     * Resource Names (ARNs) in the AWS General Reference.
     *

     *
     * @return The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     *         :resiliencehub:region:account:app-assessment/app-id. For more
     *         information about ARNs, see  Amazon Resource Names
     *         (ARNs) in the AWS General Reference.
     */

    public String getAssessmentArn() {
        return this.assessmentArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     * :resiliencehub:region:account:app-assessment/app-id. For more information
     * about ARNs, see  Amazon
     * Resource Names (ARNs) in the AWS General Reference.
     *

     *
     * @param assessmentArn
     *        The Amazon Resource Name (ARN) of the assessment. The format for this ARN is: arn:partition
     *        :resiliencehub:region:account:app-assessment/app-id. For more
     *        information about ARNs, see  Amazon Resource Names
     *        (ARNs) in the AWS General Reference.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withAssessmentArn(String assessmentArn) {
        setAssessmentArn(assessmentArn);
        return this;
    }

    /**
     *

     * The name of the assessment.
     *

     *
     * @param assessmentName
     *        The name of the assessment.
     */

    public void setAssessmentName(String assessmentName) {
        this.assessmentName = assessmentName;
    }

    /**
     *

     * The name of the assessment.
     *

     *
     * @return The name of the assessment.
     */

    public String getAssessmentName() {
        return this.assessmentName;
    }

    /**
     *

     * The name of the assessment.
     *

     *
     * @param assessmentName
     *        The name of the assessment.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withAssessmentName(String assessmentName) {
        setAssessmentName(assessmentName);
        return this;
    }

    /**
     *

     * The current status of the assessment for the resiliency policy.
     *

     *
     * @param assessmentStatus
     *        The current status of the assessment for the resiliency policy.
     * @see AssessmentStatus
     */

    public void setAssessmentStatus(String assessmentStatus) {
        this.assessmentStatus = assessmentStatus;
    }

    /**
     *

     * The current status of the assessment for the resiliency policy.
     *

     *
     * @return The current status of the assessment for the resiliency policy.
     * @see AssessmentStatus
     */

    public String getAssessmentStatus() {
        return this.assessmentStatus;
    }

    /**
     *

     * The current status of the assessment for the resiliency policy.
     *

     *
     * @param assessmentStatus
     *        The current status of the assessment for the resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AssessmentStatus
     */

    public AppAssessment withAssessmentStatus(String assessmentStatus) {
        setAssessmentStatus(assessmentStatus);
        return this;
    }

    /**
     *

     * The current status of the assessment for the resiliency policy.
     *

     *
     * @param assessmentStatus
     *        The current status of the assessment for the resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AssessmentStatus
     */

    public AppAssessment withAssessmentStatus(AssessmentStatus assessmentStatus) {
        this.assessmentStatus = assessmentStatus.toString();
        return this;
    }

    /**
     *

     * The application compliance against the resiliency policy.
     *

     *
     * @return The application compliance against the resiliency policy.
     */

    public java.util.Map<String, DisruptionCompliance> getCompliance() {
        return compliance;
    }

    /**
     *

     * The application compliance against the resiliency policy.
     *

     *
     * @param compliance
     *        The application compliance against the resiliency policy.
     */

    public void setCompliance(java.util.Map<String, DisruptionCompliance> compliance) {
        this.compliance = compliance;
    }

    /**
     *

     * The application compliance against the resiliency policy.
     *

     *
     * @param compliance
     *        The application compliance against the resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withCompliance(java.util.Map<String, DisruptionCompliance> compliance) {
        setCompliance(compliance);
        return this;
    }

    /**
     * Add a single Compliance entry
     *
     * @see AppAssessment#withCompliance
     * @returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment addComplianceEntry(String key, DisruptionCompliance value) {
        if (null == this.compliance) {
            this.compliance = new java.util.HashMap<String, DisruptionCompliance>();
        }
        if (this.compliance.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
        this.compliance.put(key, value);
        return this;
    }

    /**
     * Removes all the entries added into Compliance.
     *
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment clearComplianceEntries() {
        this.compliance = null;
        return this;
    }

    /**
     *

     * The current status of the compliance for the resiliency policy.
     *

     *
     * @param complianceStatus
     *        The current status of the compliance for the resiliency policy.
     * @see ComplianceStatus
     */

    public void setComplianceStatus(String complianceStatus) {
        this.complianceStatus = complianceStatus;
    }

    /**
     *

     * The current status of the compliance for the resiliency policy.
     *

     *
     * @return The current status of the compliance for the resiliency policy.
     * @see ComplianceStatus
     */

    public String getComplianceStatus() {
        return this.complianceStatus;
    }

    /**
     *

     * The current status of the compliance for the resiliency policy.
     *

     *
     * @param complianceStatus
     *        The current status of the compliance for the resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ComplianceStatus
     */

    public AppAssessment withComplianceStatus(String complianceStatus) {
        setComplianceStatus(complianceStatus);
        return this;
    }

    /**
     *

     * The current status of the compliance for the resiliency policy.
     *

     *
     * @param complianceStatus
     *        The current status of the compliance for the resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see ComplianceStatus
     */

    public AppAssessment withComplianceStatus(ComplianceStatus complianceStatus) {
        this.complianceStatus = complianceStatus.toString();
        return this;
    }

    /**
     *

     * The cost for the application.
     *

     *
     * @param cost
     *        The cost for the application.
     */

    public void setCost(Cost cost) {
        this.cost = cost;
    }

    /**
     *

     * The cost for the application.
     *

     *
     * @return The cost for the application.
     */

    public Cost getCost() {
        return this.cost;
    }

    /**
     *

     * The cost for the application.
     *

     *
     * @param cost
     *        The cost for the application.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withCost(Cost cost) {
        setCost(cost);
        return this;
    }

    /**
     *

     * The end time for the action.
     *

     *
     * @param endTime
     *        The end time for the action.
     */

    public void setEndTime(java.util.Date endTime) {
        this.endTime = endTime;
    }

    /**
     *

     * The end time for the action.
     *

     *
     * @return The end time for the action.
     */

    public java.util.Date getEndTime() {
        return this.endTime;
    }

    /**
     *

     * The end time for the action.
     *

     *
     * @param endTime
     *        The end time for the action.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withEndTime(java.util.Date endTime) {
        setEndTime(endTime);
        return this;
    }

    /**
     *

     * The entity that invoked the assessment.
     *

     *
     * @param invoker
     *        The entity that invoked the assessment.
     * @see AssessmentInvoker
     */

    public void setInvoker(String invoker) {
        this.invoker = invoker;
    }

    /**
     *

     * The entity that invoked the assessment.
     *

     *
     * @return The entity that invoked the assessment.
     * @see AssessmentInvoker
     */

    public String getInvoker() {
        return this.invoker;
    }

    /**
     *

     * The entity that invoked the assessment.
     *

     *
     * @param invoker
     *        The entity that invoked the assessment.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AssessmentInvoker
     */

    public AppAssessment withInvoker(String invoker) {
        setInvoker(invoker);
        return this;
    }

    /**
     *

     * The entity that invoked the assessment.
     *

     *
     * @param invoker
     *        The entity that invoked the assessment.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AssessmentInvoker
     */

    public AppAssessment withInvoker(AssessmentInvoker invoker) {
        this.invoker = invoker.toString();
        return this;
    }

    /**
     *

     * Error or warning message from the assessment execution
     *

     *
     * @param message
     *        Error or warning message from the assessment execution
     */

    public void setMessage(String message) {
        this.message = message;
    }

    /**
     *

     * Error or warning message from the assessment execution
     *

     *
     * @return Error or warning message from the assessment execution
     */

    public String getMessage() {
        return this.message;
    }

    /**
     *

     * Error or warning message from the assessment execution
     *

     *
     * @param message
     *        Error or warning message from the assessment execution
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withMessage(String message) {
        setMessage(message);
        return this;
    }

    /**
     *

     * The resiliency policy.
     *

     *
     * @param policy
     *        The resiliency policy.
     */

    public void setPolicy(ResiliencyPolicy policy) {
        this.policy = policy;
    }

    /**
     *

     * The resiliency policy.
     *

     *
     * @return The resiliency policy.
     */

    public ResiliencyPolicy getPolicy() {
        return this.policy;
    }

    /**
     *

     * The resiliency policy.
     *

     *
     * @param policy
     *        The resiliency policy.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withPolicy(ResiliencyPolicy policy) {
        setPolicy(policy);
        return this;
    }

    /**
     *

     * The current resiliency score for the application.
     *

     *
     * @param resiliencyScore
     *        The current resiliency score for the application.
     */

    public void setResiliencyScore(ResiliencyScore resiliencyScore) {
        this.resiliencyScore = resiliencyScore;
    }

    /**
     *

     * The current resiliency score for the application.
     *

     *
     * @return The current resiliency score for the application.
     */

    public ResiliencyScore getResiliencyScore() {
        return this.resiliencyScore;
    }

    /**
     *

     * The current resiliency score for the application.
     *

     *
     * @param resiliencyScore
     *        The current resiliency score for the application.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withResiliencyScore(ResiliencyScore resiliencyScore) {
        setResiliencyScore(resiliencyScore);
        return this;
    }

    /**
     *

     * A resource error object containing a list of errors retrieving an application's resources.
     *

     *
     * @param resourceErrorsDetails
     *        A resource error object containing a list of errors retrieving an application's resources.
     */

    public void setResourceErrorsDetails(ResourceErrorsDetails resourceErrorsDetails) {
        this.resourceErrorsDetails = resourceErrorsDetails;
    }

    /**
     *

     * A resource error object containing a list of errors retrieving an application's resources.
     *

     *
     * @return A resource error object containing a list of errors retrieving an application's resources.
     */

    public ResourceErrorsDetails getResourceErrorsDetails() {
        return this.resourceErrorsDetails;
    }

    /**
     *

     * A resource error object containing a list of errors retrieving an application's resources.
     *

     *
     * @param resourceErrorsDetails
     *        A resource error object containing a list of errors retrieving an application's resources.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withResourceErrorsDetails(ResourceErrorsDetails resourceErrorsDetails) {
        setResourceErrorsDetails(resourceErrorsDetails);
        return this;
    }

    /**
     *

     * The starting time for the action.
     *

     *
     * @param startTime
     *        The starting time for the action.
     */

    public void setStartTime(java.util.Date startTime) {
        this.startTime = startTime;
    }

    /**
     *

     * The starting time for the action.
     *

     *
     * @return The starting time for the action.
     */

    public java.util.Date getStartTime() {
        return this.startTime;
    }

    /**
     *

     * The starting time for the action.
     *

     *
     * @param startTime
     *        The starting time for the action.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withStartTime(java.util.Date startTime) {
        setStartTime(startTime);
        return this;
    }

    /**
     *

     * The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
     * consists of a key/value pair.
     *

     *
     * @return The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource.
     *         Each tag consists of a key/value pair.
     */

    public java.util.Map<String, String> getTags() {
        return tags;
    }

    /**
     *

     * The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
     * consists of a key/value pair.
     *

     *
     * @param tags
     *        The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource.
     *        Each tag consists of a key/value pair.
     */

    public void setTags(java.util.Map<String, String> tags) {
        this.tags = tags;
    }

    /**
     *

     * The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
     * consists of a key/value pair.
     *

     *
     * @param tags
     *        The tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource.
     *        Each tag consists of a key/value pair.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }

    /**
     * Add a single Tags entry
     *
     * @see AppAssessment#withTags
     * @returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment addTagsEntry(String key, String value) {
        if (null == this.tags) {
            this.tags = new java.util.HashMap<String, String>();
        }
        if (this.tags.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
        this.tags.put(key, value);
        return this;
    }

    /**
     * Removes all the entries added into Tags.
     *
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public AppAssessment clearTagsEntries() {
        this.tags = null;
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAppArn() != null)
            sb.append("AppArn: ").append(getAppArn()).append(",");
        if (getAppVersion() != null)
            sb.append("AppVersion: ").append(getAppVersion()).append(",");
        if (getAssessmentArn() != null)
            sb.append("AssessmentArn: ").append(getAssessmentArn()).append(",");
        if (getAssessmentName() != null)
            sb.append("AssessmentName: ").append(getAssessmentName()).append(",");
        if (getAssessmentStatus() != null)
            sb.append("AssessmentStatus: ").append(getAssessmentStatus()).append(",");
        if (getCompliance() != null)
            sb.append("Compliance: ").append(getCompliance()).append(",");
        if (getComplianceStatus() != null)
            sb.append("ComplianceStatus: ").append(getComplianceStatus()).append(",");
        if (getCost() != null)
            sb.append("Cost: ").append(getCost()).append(",");
        if (getEndTime() != null)
            sb.append("EndTime: ").append(getEndTime()).append(",");
        if (getInvoker() != null)
            sb.append("Invoker: ").append(getInvoker()).append(",");
        if (getMessage() != null)
            sb.append("Message: ").append(getMessage()).append(",");
        if (getPolicy() != null)
            sb.append("Policy: ").append(getPolicy()).append(",");
        if (getResiliencyScore() != null)
            sb.append("ResiliencyScore: ").append(getResiliencyScore()).append(",");
        if (getResourceErrorsDetails() != null)
            sb.append("ResourceErrorsDetails: ").append(getResourceErrorsDetails()).append(",");
        if (getStartTime() != null)
            sb.append("StartTime: ").append(getStartTime()).append(",");
        if (getTags() != null)
            sb.append("Tags: ").append("***Sensitive Data Redacted***");
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof AppAssessment == false)
            return false;
        AppAssessment other = (AppAssessment) obj;
        if (other.getAppArn() == null ^ this.getAppArn() == null)
            return false;
        if (other.getAppArn() != null && other.getAppArn().equals(this.getAppArn()) == false)
            return false;
        if (other.getAppVersion() == null ^ this.getAppVersion() == null)
            return false;
        if (other.getAppVersion() != null && other.getAppVersion().equals(this.getAppVersion()) == false)
            return false;
        if (other.getAssessmentArn() == null ^ this.getAssessmentArn() == null)
            return false;
        if (other.getAssessmentArn() != null && other.getAssessmentArn().equals(this.getAssessmentArn()) == false)
            return false;
        if (other.getAssessmentName() == null ^ this.getAssessmentName() == null)
            return false;
        if (other.getAssessmentName() != null && other.getAssessmentName().equals(this.getAssessmentName()) == false)
            return false;
        if (other.getAssessmentStatus() == null ^ this.getAssessmentStatus() == null)
            return false;
        if (other.getAssessmentStatus() != null && other.getAssessmentStatus().equals(this.getAssessmentStatus()) == false)
            return false;
        if (other.getCompliance() == null ^ this.getCompliance() == null)
            return false;
        if (other.getCompliance() != null && other.getCompliance().equals(this.getCompliance()) == false)
            return false;
        if (other.getComplianceStatus() == null ^ this.getComplianceStatus() == null)
            return false;
        if (other.getComplianceStatus() != null && other.getComplianceStatus().equals(this.getComplianceStatus()) == false)
            return false;
        if (other.getCost() == null ^ this.getCost() == null)
            return false;
        if (other.getCost() != null && other.getCost().equals(this.getCost()) == false)
            return false;
        if (other.getEndTime() == null ^ this.getEndTime() == null)
            return false;
        if (other.getEndTime() != null && other.getEndTime().equals(this.getEndTime()) == false)
            return false;
        if (other.getInvoker() == null ^ this.getInvoker() == null)
            return false;
        if (other.getInvoker() != null && other.getInvoker().equals(this.getInvoker()) == false)
            return false;
        if (other.getMessage() == null ^ this.getMessage() == null)
            return false;
        if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == false)
            return false;
        if (other.getPolicy() == null ^ this.getPolicy() == null)
            return false;
        if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == false)
            return false;
        if (other.getResiliencyScore() == null ^ this.getResiliencyScore() == null)
            return false;
        if (other.getResiliencyScore() != null && other.getResiliencyScore().equals(this.getResiliencyScore()) == false)
            return false;
        if (other.getResourceErrorsDetails() == null ^ this.getResourceErrorsDetails() == null)
            return false;
        if (other.getResourceErrorsDetails() != null && other.getResourceErrorsDetails().equals(this.getResourceErrorsDetails()) == false)
            return false;
        if (other.getStartTime() == null ^ this.getStartTime() == null)
            return false;
        if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false)
            return false;
        if (other.getTags() == null ^ this.getTags() == null)
            return false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAppArn() == null) ? 0 : getAppArn().hashCode());
        hashCode = prime * hashCode + ((getAppVersion() == null) ? 0 : getAppVersion().hashCode());
        hashCode = prime * hashCode + ((getAssessmentArn() == null) ? 0 : getAssessmentArn().hashCode());
        hashCode = prime * hashCode + ((getAssessmentName() == null) ? 0 : getAssessmentName().hashCode());
        hashCode = prime * hashCode + ((getAssessmentStatus() == null) ? 0 : getAssessmentStatus().hashCode());
        hashCode = prime * hashCode + ((getCompliance() == null) ? 0 : getCompliance().hashCode());
        hashCode = prime * hashCode + ((getComplianceStatus() == null) ? 0 : getComplianceStatus().hashCode());
        hashCode = prime * hashCode + ((getCost() == null) ? 0 : getCost().hashCode());
        hashCode = prime * hashCode + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        hashCode = prime * hashCode + ((getInvoker() == null) ? 0 : getInvoker().hashCode());
        hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode());
        hashCode = prime * hashCode + ((getPolicy() == null) ? 0 : getPolicy().hashCode());
        hashCode = prime * hashCode + ((getResiliencyScore() == null) ? 0 : getResiliencyScore().hashCode());
        hashCode = prime * hashCode + ((getResourceErrorsDetails() == null) ? 0 : getResourceErrorsDetails().hashCode());
        hashCode = prime * hashCode + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
        return hashCode;
    }

    @Override
    public AppAssessment clone() {
        try {
            return (AppAssessment) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.resiliencehub.model.transform.AppAssessmentMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
import chalk from "chalk";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { should } from "should";
import { promisify } from "util";

import {
    OPCUACertificateManager
} from "node-opcua-certificate-manager";
import {
    ClientSession,
    OPCUAClient,
    UserIdentityInfoUserName
} from "node-opcua-client";
import {
    Certificate,
    convertPEMtoDER,
    makeSHA1Thumbprint,
    PrivateKey,
    PrivateKeyPEM,
    split_der,
    toPem
} from "node-opcua-crypto";
import { AttributeIds } from "node-opcua-data-model";
import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
import { NodeId } from "node-opcua-nodeid";
import { nodesets } from "node-opcua-nodesets";
import { MessageSecurityMode, SecurityPolicy } from "node-opcua-secure-channel";
import {
    OPCUAServer,
    OPCUAServerEndPoint
} from "node-opcua-server";
import { StatusCodes } from "node-opcua-status-code";
import { UserTokenType } from "node-opcua-types";

import {
    _tempFolder, initializeHelpers,
    produceCertificate,
    produceCertificateAndPrivateKey
} from "../helpers/fake_certificate_authority";

import { installPushCertificateManagementOnServer } from "../..";
import { ClientPushCertificateManagement } from "../..";
import { certificateMatchesPrivateKey } from "../..";
import { OPCUAServerPartial } from "../../source";

//tslint:disable-next:no-var-requires
import rimraf = require("rimraf");

const doDebug = checkDebugFlag("ServerConfiguration");
const debugLog = make_debugLog("ServerConfiguration");
const errorLog = make_errorLog("ServerConfiguration");

// make sure extra error checking is made on object constructions
// tslint:disable-next-line:no-var-requires
const describe = require("node-opcua-leak-detector").describeWithLeakDetector;
describe("Testing server configured with push certificate management", () => {

    const fakePKI = path.join(_tempFolder, "FakePKI");
    const certificateManager = new OPCUACertificateManager({
        rootFolder: fakePKI
    });

    const fakeClientPKI = path.join(_tempFolder, "FakeClientPKI");
    const clientCertificateManager = new OPCUACertificateManager({
        rootFolder: fakeClientPKI
    });
    let clientCertificateFile = "";
    let clientPrivateKeyFile = "";

    before(async () => {
        await initializeHelpers();
        await certificateManager.initialize();
    });
    before(async () => {
        await clientCertificateManager.initialize();
        clientCertificateFile = path.join(clientCertificateManager.rootDir, "certificate.pem");
        await clientCertificateManager.createSelfSignedCertificate({
            applicationUri: "ClientApplication",
            subject: "CN=Test",

            dns: [os.hostname()],
            ip: [],

            startDate: new Date(),
            validity: 10,

            outputFile: clientCertificateFile
        });
        clientPrivateKeyFile = clientCertificateManager.privateKey;
    });

    it("SCT-1 should modify a server to support push certificate management", async () => {

        const server = new OPCUAServer({
            port: 20000,
            serverCertificateManager: certificateManager,
            userCertificateManager: certificateManager
        });

        await server.initialize();

        await installPushCertificateManagementOnServer(server);

        const privateKey1PEM = await promisify(fs.readFile)(server.serverCertificateManager.privateKey, "utf8");
        const privateKey1 = convertPEMtoDER(privateKey1PEM);
        const privateKey2 = convertPEMtoDER(server.getPrivateKey());
        privateKey1.toString("base64").should.eql(privateKey2.toString("base64"));

        // now start the server
        await server.start();

        // now stop the server
        await server.shutdown();
    });

    function verifyServer(server: OPCUAServer) {

        debugLog("---------------------------------------------------------------");
        const certificateChain1 = server.getCertificateChain();
        debugLog("server.getCertificateChain() =",
          makeSHA1Thumbprint(certificateChain1).toString("hex") + " l=" + certificateChain1.length);
        const privateKey1 = convertPEMtoDER(server.getPrivateKey());
        debugLog("server.getPrivateKey()       =",
          makeSHA1Thumbprint(privateKey1).toString("hex"));

        const match = certificateMatchesPrivateKey(certificateChain1, privateKey1);
        debugLog("math                         =", match);

        for (const endpoint of server.endpoints) {
            debugLog("endpoint ", endpoint.toString());

            for (const e of endpoint.endpointDescriptions()) {
                const certificateChain3 = e.serverCertificate;
                debugLog("endpoint certificate =",
                  makeSHA1Thumbprint(certificateChain3).toString("hex") + " l=" + certificateChain3.length);
                // xx console.log(e.toString());
            }

        }
        debugLog("---------------------------------------------------------------");

    }

    async function replaceServerCertificateUsingPushCertificateManagerMethod(endpointUrl: string): Promise<Certificate> {

        const client = OPCUAClient.create({
            certificateFile: clientCertificateFile,
            privateKeyFile: clientPrivateKeyFile,

            securityMode: MessageSecurityMode.SignAndEncrypt,
            securityPolicy: SecurityPolicy.Basic256

        });

        try {

            await client.connect(endpointUrl);

            const userIdentityToken: UserIdentityInfoUserName = {
                type: UserTokenType.UserName,

                password: "secret",
                userName: "admin"
            };

            const session = await client.createSession(userIdentityToken);

            const pm = new ClientPushCertificateManagement(session);

            const response = await pm.createSigningRequest(
              "DefaultApplicationGroup",
              NodeId.nullNodeId,
              "CN=MyApplication");

            debugLog(" cert request status",
              response.statusCode.toString());
            if (response.statusCode !== StatusCodes.Good) {
                throw new Error("Cannot get signing request from server : " + response.statusCode.toString());
            }
            debugLog(" cert request       ",
              response.certificateSigningRequest!.toString("base64"));

            const certificateFull = await produceCertificate(response.certificateSigningRequest!);

            const certificateChain = split_der(certificateFull);
            const certificate = certificateChain[0];
            const issuerCertificates = certificateChain.slice(1);

            // generate some certificate
            const response2 = await pm.updateCertificate(
              "DefaultApplicationGroup",
              NodeId.nullNodeId,
              certificate,
              issuerCertificates
            );
            debugLog(" updateCertificate  status", response2.statusCode.toString());
            if (response2.statusCode !== StatusCodes.Good) {
                throw new Error("Cannot updateCertificate " + response2.statusCode.toString());
            }

            await pm.applyChanges();

            await session.close();

            return certificateFull;

        } catch (err) {
            console.log("err =", err);
            throw err;
        } finally {
            await client.disconnect();
        }

    }

    async function replaceServerCertificateAndPrivateKeyUsingPushCertificateManagerMethod(
      endpointUrl: string
    ): Promise<{ certificate: Certificate, privateKey: PrivateKey }> {

        // create a new key pair
        const { certificate, privateKey } = await produceCertificateAndPrivateKey();

        const client = OPCUAClient.create({
            certificateFile: clientCertificateFile,
            privateKeyFile: clientPrivateKeyFile,

            securityMode: MessageSecurityMode.SignAndEncrypt,
            securityPolicy: SecurityPolicy.Basic256

        });

        try {

            await client.connect(endpointUrl);

            const userIdentityToken: UserIdentityInfoUserName = {
                type: UserTokenType.UserName,

                password: "secret",
                userName: "admin"
            };

            const session = await client.createSession(userIdentityToken);

            const pm = new ClientPushCertificateManagement(session);

            const privateKeyFormat = "PEM"; // or PFX
            const issuerCertificates: Certificate[] = [];

            // generate some certificate
            const response2 = await pm.updateCertificate(
              "DefaultApplicationGroup",
              NodeId.nullNodeId,
              certificate,
              issuerCertificates,
              privateKeyFormat,
              privateKey
            );
            debugLog(" updateCertificate  status", response2.statusCode.toString());

            if (response2.statusCode === StatusCodes.Good) {
                await pm.applyChanges();
            }

            await session.close();

            if (response2.statusCode !== StatusCodes.Good) {
                throw new Error("Cannot updateCertificate " + response2.statusCode.toString());
            }

        } catch (err) {
            console.log("err =", err);
            throw err;
        } finally {
            await client.disconnect();
        }

        return { certificate, privateKey };

    }

    async function constructServerWithPushCertificate(): Promise<OPCUAServer> {

        // given that the server user manager is able to identify a  system administrator
        const mockUserManager = {

            isValidUser: (userName: string, password: string) => {

                if (userName === "admin" && password === "secret") {
                    return true;
                }
                return false;
            },

            // see OPCUA 1.04 part 3 4.8.2 Well know role
            // Anonymous          The Role has very limited access for use when a Session has anonymous credentials.
            // AuthenticatedUser  The Role has limited access for use when a Session has valid non-anonymous credentials
            //                    but has not been explicitly granted access to a Role.
            // Observer           The Role is allowed to browse, read live data, read historical data/events or subscribe to
            //                    data/events.
            // Operator           The Role is allowed to browse, read live data, read historical data/events or subscribe to
            //                    data/events.
            //                    In addition, the Session is allowed to write some live data and call some Methods.
            // Engineer           The Role is allowed to browse, read/write configuration data, read historical data/events,
            //                    call Methods or subscribe to data/events.
            // Supervisor         The Role is allowed to browse, read live data, read historical data/events, call Methods
            //                    or subscribe to data/events.
            // ConfigureAdmin     The Role is allowed to change the non-security related configuration settings.
            // SecurityAdmin      The Role is allowed to change security related settings.

            getUserRole(username: string): string {
                if (username === "anonymous") {
                    return "Anonymous";
                }
                if (username === "admin") {
                    return "AuthenticatedUser;SecurityAdmin";
                }
                return "None";
            }

        };

        const server = new OPCUAServer({

            port: 2010,

            nodeset_filename: nodesets.standard,
            userManager: mockUserManager,

            serverCertificateManager: certificateManager,
            userCertificateManager: certificateManager
        });
        await server.initialize();

        verifyServer(server);

        await installPushCertificateManagementOnServer(server);
        debugLog("private key location =  ", server.serverCertificateManager.privateKey);

        verifyServer(server);

        // Given that the server is configured to trust client certificate
        const clientCertificatePEM = await promisify(fs.readFile)(clientCertificateFile, "utf8");
        const clientCertificateDER = convertPEMtoDER(clientCertificatePEM);
        await server.serverCertificateManager.trustCertificate(clientCertificateDER);

        // also trusted newest certificate

        return server;
    }

    let onGoingClient: OPCUAClient;
    let onGoingSession: ClientSession;
    let count = 0;

    async function testWithSimpleClient(endpointUri: string) {

        const client = OPCUAClient.create({
            certificateFile: clientCertificateFile,
            privateKeyFile: clientPrivateKeyFile,
            securityMode: MessageSecurityMode.SignAndEncrypt,
            securityPolicy: SecurityPolicy.Basic256
        });
        try {
            await client.connect(endpointUri);
            const session = await client.createSession();

            await session.close();
        } catch (err) {
            errorLog("Cannot reconnect a client !!!! ", err.message, "\n", err);
        } finally {
            await client.disconnect();
        }

    }

    async function startOnGoingConnection(endpointUri: string) {
        onGoingClient = OPCUAClient.create({
            certificateFile: clientCertificateFile,
            privateKeyFile: clientPrivateKeyFile,

            securityMode: MessageSecurityMode.SignAndEncrypt,
            securityPolicy: SecurityPolicy.Basic256
        });
        onGoingClient.on("start_reconnection", () => {
            debugLog(chalk.bgWhite.red(" !!!!!!!!!!!!!!!!!!!!!!!!  Starting Reconnection !!!!!!!!!!!!!!!!!!!"));
        });
        onGoingClient.on("backoff", (retry: number, delay: number) => {
            debugLog(chalk.bgWhite.yellow("backoff  attempt #"), retry, " retrying in ", delay / 1000.0, " seconds");
        });
        onGoingClient.on("connection_reestablished", () => {
            debugLog(chalk.bgWhite.red(" !!!!!!!!!!!!!!!!!!!!!!!!  CONNECTION RE-ESTABLISHED !!!!!!!!!!!!!!!!!!!"));
            debugLog("    Server certificate is now ", makeSHA1Thumbprint(onGoingClient.serverCertificate!).toString("base64"));
        });
        onGoingClient.on("connection_lost", () => {
            debugLog(chalk.bgWhite.red("Client has lost connection ..."));
            debugLog(chalk.bgWhite.red("    Server certificate was ", makeSHA1Thumbprint(onGoingClient.serverCertificate!).toString("base64")));
        });

        onGoingClient.on("close", () => {
            debugLog(chalk.bgWhite.red("client has CLOOOOOOOOOOSSSSSED"));
        });

        await onGoingClient.connect(endpointUri);
        onGoingSession = await onGoingClient.createSession();

        const subscription = await onGoingSession.createSubscription2({
            requestedPublishingInterval: 500,

            maxNotificationsPerPublish: 1000,
            publishingEnabled: true,
            requestedLifetimeCount: 100,
            requestedMaxKeepAliveCount: 10
        });

        const monitoredItem = await subscription.monitor({
              attributeId: AttributeIds.Value,
              nodeId: "i=2258" // Current Time
          },
          { samplingInterval: 500 }, TimestampsToReturn.Both);

        count = 0;
        monitoredItem.on("changed", (dataValue: DataValue) => {
            debugLog(" ", chalk.cyan(dataValue.value.toString()));
            count++;
        });

        await new Promise((resolve) => setTimeout(resolve, 1500));

    }

    async function stopOnGoingConnection() {

        debugLog("stopping");
        await new Promise((resolve) => setTimeout(resolve, 5000));
        debugLog("stopOnGoingConnection - Server certificate is now ",
          makeSHA1Thumbprint(onGoingClient.serverCertificate!).toString("base64"));
        await onGoingSession.close();
        await onGoingClient.disconnect();
    }

    it("SCT-2 should be possible to change the certificate of a server that supports push certificate ", async () => {

        // Given a server with push management
        const server = await constructServerWithPushCertificate();

        // Given that we known the server key pair before it is changed
        const privateKey1PEM = await promisify(fs.readFile)(server.serverCertificateManager.privateKey, "utf8");
        const certificateBefore = server.getCertificate();

        // Given that the server is started
        await server.start();

        // Given the server connection endpoint
        const endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl!;

        // Given that the sever has some client connected to it
        await startOnGoingConnection(endpointUrl);

        try {

            // when an administrative client replaces the certificate
            const newCertificate = await replaceServerCertificateUsingPushCertificateManagerMethod(endpointUrl);

            // then I should verify that the server certificate has changed
            const certificateAfter = server.getCertificate();
            certificateBefore.toString("base64").should.not.eql(certificateAfter.toString("base64"));

            // and I should verify that the new server certificate matches the new certificate provided by the admin client
            certificateAfter.toString("base64").should.not.eql(newCertificate.toString("base64"));

            await new Promise((resolve) => setTimeout(resolve, 3000));

        } catch (err) {
            console.log(err);
            throw err;
        } finally {
            await stopOnGoingConnection();
            // now stop the server
            await server.shutdown();
        }
    });

    async function simulateCertificateAndPrivateKeyChange(server: OPCUAServer) {
        const _server = server as any as OPCUAServerPartial;

        // create a new key pair
        const { certificate, privateKey } = await produceCertificateAndPrivateKey();

        _server.$$privateKeyPEM = toPem(privateKey, "RSA PRIVATE KEY");
        _server.$$certificateChain = certificate;
        _server.$$certificate = undefined;
        await server.suspendEndPoints();
        await server.shutdownChannels();
        await server.resumeEndPoints();

    }
    it("SCT-3 - Client reconnection should work if server changes its private key", async () => {

        // Given a server with push management
        const server = await constructServerWithPushCertificate();
        // Given that the server is started
        await server.start();

        // Given the server connection endpoint
        const endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl!;

        // Given a connected client
        const client = OPCUAClient.create({
            certificateFile: clientCertificateFile,
            privateKeyFile: clientPrivateKeyFile,

            securityMode: MessageSecurityMode.SignAndEncrypt,
            securityPolicy: SecurityPolicy.Basic256
        });

        client.on("start_reconnection", () => {
            debugLog(chalk.bgWhite.red(" !!!!!!!!!!!!!!!!!!!!!!!!  Starting Reconnection !!!!!!!!!!!!!!!!!!!"));
        });
        client.on("backoff", (retry: number, delay: number) => {
            debugLog(chalk.bgWhite.yellow("backoff  attempt #"), retry, " retrying in ", delay / 1000.0, " seconds");
        });
        client.on("connection_reestablished", () => {
            debugLog(chalk.bgWhite.red(" !!!!!!!!!!!!!!!!!!!!!!!!  CONNECTION RE-ESTABLISHED !!!!!!!!!!!!!!!!!!!"));
            debugLog("    Server certificate is now ", makeSHA1Thumbprint(client.serverCertificate!).toString("base64"));
        });
        client.on("connection_lost", () => {
            debugLog(chalk.bgWhite.red("Client has lost connection ..."));
            debugLog(chalk.bgWhite.red("    Server certificate was ", makeSHA1Thumbprint(client.serverCertificate!).toString("base64")));
        });
        client.on("close", () => {
            debugLog(chalk.bgWhite.red("Client has CLOOOOOOOOOOSSSSSED"));
        });

        await client.connect(endpointUrl);

        // When Server changes certificates
        const certificateBefore: Certificate = server.getCertificate();
        const privateKeyBefore: PrivateKeyPEM = server.getPrivateKey();

        await simulateCertificateAndPrivateKeyChange(server);

        const certificateAfter: Certificate = server.getCertificate();
        const privateKeyAfter: PrivateKeyPEM = server.getPrivateKey();

        makeSHA1Thumbprint(certificateBefore).should.not.eql(makeSHA1Thumbprint(certificateAfter));
        privateKeyBefore.should.not.eql(privateKeyAfter);

        // then I should see the client being reconnected
        await new Promise((resolve) => setTimeout(resolve, 6000));

        client.isReconnecting.should.eql(false);

        // Tear down
        await client.disconnect();
        // now stop the server
        await server.shutdown();
    });

    it("SCT-4 should be possible to change the certificate and PrivateKey of the server", async () => {

        // Given a server with push management
        const server = await constructServerWithPushCertificate();

        // Given that we known the server key pair before it is changed
        const privateKey1PEM = await promisify(fs.readFile)(server.serverCertificateManager.privateKey, "utf8");
        const certificateBefore = server.getCertificate();
        const privateKeyBefore = server.getPrivateKey();

        // Given that the server is started
        await server.start();

        // Given the server connection endpoint
        const endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl!;

        // Given that the sever has some client connected to it
        await startOnGoingConnection(endpointUrl);

        try {

            // when an administrative client replaces the certificate & PrivateKey
            const { certificate, privateKey } = await replaceServerCertificateAndPrivateKeyUsingPushCertificateManagerMethod(endpointUrl);

            // then I should verify that the server certificate has changed
            const certificateAfter = server.getCertificate();
            certificateBefore.toString("base64").should.not.eql(certificateAfter.toString("base64"));

            // and I should verify that the new server certificate matches the new certificate provided by the admin client
            certificateAfter.toString("base64").should.eql(certificate.toString("base64"));

            // then I should verify that the server private key has changed
            const privateKeyAfter: PrivateKeyPEM = server.getPrivateKey();
            privateKeyBefore.should.not.eql(privateKeyAfter);

            // and I should verify that the new server private key matches the new private key provided by the admin client
            privateKeyAfter.should.eql(toPem(privateKey, "RSA PRIVATE KEY"));

            await new Promise((resolve) => setTimeout(resolve, 3000));

            await testWithSimpleClient(endpointUrl);

            onGoingClient.isReconnecting.should.eql(false, "client shall not be reconnected");

        } catch (err) {
            errorLog("---------------------------------------------- ERROR ! in Test ");
            errorLog(err);
            throw err;
        } finally {

            await stopOnGoingConnection();
            // now stop the server
            await server.shutdown();
        }

    });
});


text:
using UnityEngine;
using System.Collections;

public class DeftRigidBody : MonoBehaviour
{

  public enum DeftRigidBodyType { PLAYER, PHYSICSOBJECT };

  public DeftRigidBodyType type;
  public double m_InterpolationBackTime = 0.1;
  public double m_ExtrapolationLimit = 0.5;

  public string controllerScript;

  internal struct State
  {
    internal double timestamp;
    internal Vector3 pos;
    internal Vector3 velocity;
    internal Quaternion rot;
    internal Vector3 angularVelocity;
  }

  void OnNetworkInstantiate(NetworkMessageInfo msg)
  {
    Debug.Log("Instantiating deft rigid body of type " + this.type.ToString());
    if (this.type == DeftRigidBodyType.PLAYER)
    {
      if (networkView.isMine)
      {
      }
      else
      {
        if (controllerScript != null)
          Destroy(gameObject.GetComponent(controllerScript));
        // destroy any other controllers or enable/disable them
      }
    }
    if (this.type == DeftRigidBodyType.PHYSICSOBJECT)
    {
      // todo
    }
  }

  State[] m_BufferedState = new State[20];
  int m_TimestampCount;

  void Start()
  {
    foreach (NetworkView n in GetComponents<NetworkView>())
      n.observed = this;
  }

  void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
  {
    if (stream.isWriting)
    {
      Vector3 pos = rigidbody.position;
      Quaternion rot = rigidbody.rotation;
      Vector3 velocity = rigidbody.velocity;
      Vector3 angularVelocity = rigidbody.angularVelocity;

      stream.Serialize(ref pos);
      stream.Serialize(ref velocity);
      stream.Serialize(ref rot);
      stream.Serialize(ref angularVelocity);
    }
    else
    {
      Vector3 pos = Vector3.zero;
      Vector3 velocity = Vector3.zero;
      Quaternion rot = Quaternion.identity;
      Vector3 angularVelocity = Vector3.zero;
      stream.Serialize(ref pos);
      stream.Serialize(ref velocity);
      stream.Serialize(ref rot);
      stream.Serialize(ref angularVelocity);

      for (int i = m_BufferedState.Length - 1; i >= 1; i--)
      {
        m_BufferedState[i] = m_BufferedState[i - 1];
      }

      State state;
      state.timestamp = info.timestamp;
      state.pos = pos;
      state.velocity = velocity;
      state.rot = rot;
      state.angularVelocity = angularVelocity;
      m_BufferedState[0] = state;

      m_TimestampCount = Mathf.Min(m_TimestampCount + 1, m_BufferedState.Length);

      for (int i = 0; i < m_TimestampCount - 1; i++)
        if (m_BufferedState[i].timestamp < m_BufferedState[i + 1].timestamp)
          Debug.Log("State inconsistent");
    }
  }

  void Update()
  {
    // This is the target playback time of the rigid body
    double interpolationTime = Network.time - m_InterpolationBackTime;

    // Use interpolation if the target playback time is present in the buffer
    if (m_BufferedState[0].timestamp > interpolationTime)
    {
      // Go through buffer and find correct state to play back
      for (int i = 0; i < m_TimestampCount; i++)
      {
        if (m_BufferedState[i].timestamp <= interpolationTime || i == m_TimestampCount - 1)
        {
          // The state one slot newer (<100ms) than the best playback state
          State rhs = m_BufferedState[Mathf.Max(i - 1, 0)];
          // The best playback state (closest to 100 ms old (default time))
          State lhs = m_BufferedState[i];

          // Use the time between the two slots to determine if interpolation is necessary
          double length = rhs.timestamp - lhs.timestamp;
          float t = 0.0f;
          // As the time difference gets closer to 100 ms t gets closer to 1 in
          // which case rhs is only used
          // Example:
          // Time is 10.000, so sampleTime is 9.900
          // lhs.time is 9.910 rhs.time is 9.980 length is 0.070
          // t is 9.900 - 9.910 / 0.070 = 0.14. So it uses 14% of rhs, 86% of lhs
          if (length > 0.0001f)
            t = (float)((interpolationTime - lhs.timestamp) / length);

          // if t=0 => lhs is used directly
          transform.localPosition = Vector3.Lerp(lhs.pos, rhs.pos, t);
          transform.localRotation = Quaternion.Slerp(lhs.rot, rhs.rot, t);
          return;
        }
      }
      // Use extrapolation
    }
    else
    {
      State latest = m_BufferedState[0];

      float extrapolationLength = (float)(interpolationTime - latest.timestamp);
      // Don't extrapolation for more than 500 ms, you would need to do that carefully
      if (extrapolationLength < m_ExtrapolationLimit)
      {
        float axisLength = extrapolationLength * latest.angularVelocity.magnitude * Mathf.Rad2Deg;
        Quaternion angularRotation = Quaternion.AngleAxis(axisLength, latest.angularVelocity);

        rigidbody.position = latest.pos + latest.velocity * extrapolationLength;
        rigidbody.rotation = angularRotation * latest.rot;
        rigidbody.velocity = latest.velocity;
        rigidbody.angularVelocity = latest.angularVelocity;
      }
    }
  }

}


text:
module Realm
  module Messaging
    class NoResponsesFoundError < MessagingError
      def initialize(message_type_name)
        super("No responses found for message type #{message_type_name.inspect}")
      end
    end
  end
end


text:
#pragma once

#include "core/hw/gfxip/indirectCmdGenerator.h"
#include "palInlineFuncs.h"

namespace Pal
{
namespace Gfx9
{

class Device;

// Enumerates all of the GFX9-specific indirect operations which can be generated by an indirect command generator.
enum class IndirectOpType : uint32
{
    Skip = 0,           // Skip this indirect operation and generate no packets for it. This is used for things like
                        // index buffer bindings, which are skipped and handled as part of the DrawIndex2 operation.
    Dispatch,           // Issue a direct dispatch call.
    DrawIndexAuto,      // Issue a non-indexed draw call.
    DrawIndexOffset2,   // Issue an indexed draw call. This variation is used in cases where the indirect command
                        // generator doesn't also contain an indirect index-buffer binding. In this case, we need
                        // to inherit the already-bound index buffer.
    DrawIndex2,         // Issue an indexed draw call. This variation is used in cases where the indirect command
                        // generator also contains its own index-buffer binding. This is more performant than the
                        // other variation since it avoids unnecessary memory reads by the CP.
    SetUserData,        // Sets one or more consecutive virtualized user-data entries. These entries may end up
                        // being mapped to either physical SPI user-data registers or to the spill table.
    VertexBufTableSrd,  // Builds an untyped buffer SRD in the vertex buffer table.
    DispatchMesh,       // Issue a dispatch mesh call.
};

// Contains all information the indirect command generation shader(s) need to generate a command buffer snippet for
// a single command parameter.
// NOTE: This *must* be compatible with the same-named structure inside core/hw/gfxip/rpm/gfx9/globals.hlsl !
struct IndirectParamData
{
    // Type of the command operation.
    IndirectOpType  type;
    // Offsets into the command buffer and argument buffer. Both are relative to the owning command's offsets.
    uint32  cmdBufOffset;
    uint32  argBufOffset;
    // Sizes (in bytes) of the command buffer space and argument buffer space used by this command parameter.
    uint32  cmdBufSize;
    uint32  argBufSize;
    // Miscellaneous data which varies by command parameter type. See below for details specific to each type
    // of indirect operation:
    //  DrawIndex2:
    //  [0] = Offset in the argument buffer where the index data bind information is stored
    //  SetUserData:
    //  [0] = First user-data entry to update
    //  [1] = Number of user-data entries to update
    //  IndirectTableSrd:
    //  [0] = Offset into the table where the SRD is written (in DWORDs)
    uint32  data[2];
};

// =====================================================================================================================
// GFX9 specific version of the IndirectCmdGenerator class. Responsible for knowing the layout of the command buffer
// snippets corresponding to different operations which can be done in an indirect command (e.g., draw, bind index data,
// etc.). Contains the indirect parameter data and populates the buffers used to communicate the pipeline signature and
// properties of the CmdExecuteIndirectCommands() call.
class IndirectCmdGenerator final : public Pal::IndirectCmdGenerator
{
public:
    static size_t GetSize(
        const IndirectCmdGeneratorCreateInfo& createInfo);

    IndirectCmdGenerator(
        const Device&                         device,
        const IndirectCmdGeneratorCreateInfo& createInfo);

    virtual Result BindGpuMemory(
        IGpuMemory* pGpuMemory,
        gpusize     offset) override;

    uint32 CmdBufStride(
        const Pipeline* pPipeline) const;

    virtual void PopulateInvocationBuffer(
        GfxCmdBuffer*   pCmdBuffer,
        const Pipeline* pPipeline,
        bool            isTaskEnabled,
        gpusize         argsGpuAddr,
        uint32          maximumCount,
        uint32          indexBufSize,
        void*           pSrd) const override;

    virtual void PopulateParameterBuffer(
        GfxCmdBuffer*   pCmdBuffer,
        const Pipeline* pPipeline,
        void*           pSrd) const override;

    virtual void PopulatePropertyBuffer(
        GfxCmdBuffer*   pCmdBuffer,
        const Pipeline* pPipeline,
        void*           pSrd) const override;

    virtual void PopulateSignatureBuffer(
        GfxCmdBuffer*   pCmdBuffer,
        const Pipeline* pPipeline,
        void*           pSrd) const override;

    virtual void PopulateUserDataMappingBuffer(
        GfxCmdBuffer*   pCmdBuffer,
        const Pipeline* pPipeline,
        void*           pSrd) const override;

    bool ContainsIndexBufferBind() const { return m_bindsIndexBuffer; }

protected:
    virtual ~IndirectCmdGenerator() { }

private:
    void InitParamBuffer(
        const IndirectCmdGeneratorCreateInfo& createInfo);

    uint32 DetermineMaxCmdBufSize(
        GeneratorType        type,
        IndirectOpType       opType,
        const IndirectParam& param) const;

    // Tracks whether or not commands generated by this object include an index-buffer binding.
    bool  m_bindsIndexBuffer;

    // Array of IndirectParamData structures. These items are used to communicate how the RPM shader(s) for command
    // generation should interpret the application's indirect-argument buffer contents.
    IndirectParamData*const  m_pParamData;

    IndirectParam*const      m_pCreationParam;

    bool    m_cmdSizeNeedPipeline;  // Specifies whether command sizes and command buffer stride can be determined
                                    // at IndirectCmdGenerator creation time
                                    // If not, they will depend on pipeline object

    PAL_DISALLOW_DEFAULT_CTOR(IndirectCmdGenerator);
    PAL_DISALLOW_COPY_AND_ASSIGN(IndirectCmdGenerator);
};

// =====================================================================================================================
// Helper function for updating a command buffer's tracking of which user-data entries have known values after running
// an indirect-command generator and executing the generated commands.
template <typename Signature>
static void PAL_INLINE CommandGeneratorTouchedUserData(
    UserDataFlags&              mask,
    const IndirectCmdGenerator& generator,
    const Signature&            signature)
{
    // Mark any user-data entries which the command generator touched as "untouched" so that redundant user-data
    // filtering won't incorrectly reject subsequent user-data updates.
    for (uint32 idx = 0; idx < NumUserDataFlagsParts; ++idx)
    {
        mask[idx] &= ~(generator.TouchedUserDataEntries()[idx]);
    }
}

} // Gfx9
} // Pal


text:
#ifndef NARF_LIBC_H
#define NARF_LIBC_H

typedef unsigned int uint32_t;
typedef unsigned char uint8_t;

#define SUCCESS 0
// list errors
#define ERRNO_LIST_PUSH 404
#define ERRNO_ALLOC 505

typedef struct node {
	void * data;
	struct node *next;
	struct node *prev;
} node_t;
// doubly-linked list
// int node_contains(struct node * nd, const void * value) {}
//  -- should return 0 when node nd contains value, 1 when not.
typedef int(*node_contains_f)(node_t *, void *);

typedef struct list {
	node_t *head;
	node_t *tail;
	uint32_t count;
	node_contains_f node_contains_impl;
} list_t;

// List related
list_t * list_create(node_contains_f node_contains_impl);
int list_push(list_t *lst, node_t *nd, void * value);
node_t * list_find(list_t *lst, void * value);
node_t * list_remove(list_t *lst, void * value);

// Node related
node_t * node_create(void * data);
int node_destroy(node_t *nd);

// I/O
int send(const char *buf, const size_t size);
int transmit_all(int fd, const char *buf, const size_t size);
unsigned int recv_all(char *res_buf, size_t res_buf_size);
unsigned int read_all(int fd, char *buf, unsigned int size);

// stdlib
size_t cgc_strlen(const char *str);
void *cgc_memset(void *dst, int c, unsigned int n);

#endif