text:
sap.ui.define([
	'sap/ui/model/json/JSONModel'
], function (JSONModel) {
	'use strict';

	// Please order topics alphabetically by "title"
	return new JSONModel({
		selectedKey: 'learnGettingStarted',
		navigation: [
			{
				title: 'Landmark API',
				icon: 'sap-icon://flag',
				key: 'landmark',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'dynamicPage',
						target: 'exploreSamples',
						title: 'Dynamic Page',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/dynamicPage/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/dynamicPage/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/dynamicPage/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/dynamicPage/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/dynamicPage/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'page',
						target: 'exploreSamples',
						title: 'Page',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/page/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/page/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/page/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/page/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/page/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'panel',
						target: 'exploreSamples',
						title: 'Panel',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/panel/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/panel/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/panel/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/panel/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'objectPage',
						target: 'exploreSamples',
						title: 'Object Page',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/objectPage/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/objectPage/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/objectPage/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/objectPage/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			},
			{
				title: 'Labeling and Description',
				icon: 'sap-icon://tag',
				key: 'labeling',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'select',
						target: 'exploreSamples',
						title: 'Select',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/select/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/select/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/select/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/select/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/select/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'dialog',
						target: 'exploreSamples',
						title: 'Dialog',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/dialog/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/dialog/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/dialog/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/dialog/i18n.properties',
								name: 'i18n.properties',
								key: 'i18n.properties'
							},
							{
								url: '/samples/dialog/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/dialog/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'simpleForm',
						target: 'exploreSamples',
						title: 'Simple Form',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/simpleForm/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/simpleForm/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/simpleForm/i18n.properties',
								name: 'i18n.properties',
								key: 'i18n.properties'
							},
							{
								url: '/samples/simpleForm/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/simpleForm/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/simpleForm/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'inputs',
						target: 'exploreSamples',
						title: 'User Inputs',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/inputs/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/inputs/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/inputs/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/inputs/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/inputs/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'inputsDescription',
						target: 'exploreSamples',
						title: 'Input with Description',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/inputsDescription/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/inputsDescription/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/inputsDescription/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/inputsDescription/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'popover',
						target: 'exploreSamples',
						title: 'Popover',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/popover/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/popover/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/popover/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/popover/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/popover/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'popoverDescribedby',
						target: 'exploreSamples',
						title: 'Popover with Description',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/popoverDescribedby/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/popoverDescribedby/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/popoverDescribedby/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/popoverDescribedby/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/popoverDescribedby/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							}
						]
					},
					{
						key: 'iconOnlyButtons',
						target: 'exploreSamples',
						title: 'Icon-Only Buttons',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/iconOnlyButtons/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/iconOnlyButtons/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/iconOnlyButtons/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/iconOnlyButtons/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'maskInput',
						target: 'exploreSamples',
						title: 'Mask Input',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/maskInput/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/maskInput/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/maskInput/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/maskInput/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'nonDecorativeImages',
						target: 'exploreSamples',
						title: 'Non-Decorative Images',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/nonDecorativeImages/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/nonDecorativeImages/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/nonDecorativeImages/images/HT-6120-large.jpg',
								name: 'images/HT-6120-large.jpg',
								key: 'HT-6120-large.jpg'
							},
							{
								url: '/samples/nonDecorativeImages/images/HT-7777-large.jpg',
								name: 'images/HT-7777-large.jpg',
								key: 'HT-7777-large.jpg'
							},
							{
								url: '/samples/nonDecorativeImages/img.json',
								name: 'img.json',
								key: 'img.json'
							},
							{
								url: '/samples/nonDecorativeImages/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/nonDecorativeImages/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/nonDecorativeImages/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			},
			{
				title: 'Focus Handling',
				icon: 'sap-icon://SAP-icons-TNT/marquee',
				key: 'focusHandling',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'popoverInitialFocus',
						target: 'exploreSamples',
						title: 'Popover Initial Focus Position',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/popoverInitialFocus/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/popoverInitialFocus/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/popoverInitialFocus/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/popoverInitialFocus/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/popoverInitialFocus/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'toolbarActive',
						target: 'exploreSamples',
						title: 'Active Toolbar',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/toolbarActive/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/toolbarActive/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/toolbarActive/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/toolbarActive/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/toolbarActive/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			},
			{
				title: 'Keyboard Shortcuts',
				icon: 'sap-icon://keyboard-and-mouse',
				key: 'keyboardShortcuts',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'buttonShortcut',
						target: 'exploreSamples',
						title: 'Button with Shortcut',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/buttonShortcut/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/buttonShortcut/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/buttonShortcut/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/buttonShortcut/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/buttonShortcut/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			},
			{
				title: 'Invisible Content',
				icon: 'sap-icon://SAP-icons-TNT/content-enricher',
				key: 'invisibleContent',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'invisibleMessaging',
						target: 'exploreSamples',
						title: 'Invisible Messaging',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/invisibleMessaging/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/invisibleMessaging/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/invisibleMessaging/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/invisibleMessaging/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/invisibleMessaging/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					},
					{
						key: 'invisibleText',
						target: 'exploreSamples',
						title: 'Invisible Text',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/invisibleText/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/invisibleText/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/invisibleText/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/invisibleText/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			},
			{
				title: 'Message Handling',
				icon: 'sap-icon://SAP-icons-TNT/catching-message',
				key: 'messageHandling',
				target: 'exploreOverview',
				hasExpander: false,
				items: [
					{
						key: 'messageHandlingConcept',
						target: 'exploreSamples',
						title: 'Message Handling Concept',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/messageHandlingConcept/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/messageHandlingConcept/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/messageHandlingConcept/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/messageHandlingConcept/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/messageHandlingConcept/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							},
							{
								url: '/samples/messageHandlingConcept/localService/mockdata/FormsModel.json',
								name: 'FormsModel.json',
								key: 'FormsModel.json'
							}
						]
					},
					{
						key: 'messageToast',
						target: 'exploreSamples',
						title: 'Message Toast',
						useIFrame: true,
						isApplication: true,
						files: [
							{
								url: '/samples/messageToast/Controller.controller.js',
								name: 'Controller.controller.js',
								key: 'Controller.controller.js'
							},
							{
								url: '/samples/messageToast/View.view.xml',
								name: 'View.view.xml',
								key: 'View.view.xml'
							},
							{
								url: '/samples/messageToast/index.html',
								name: 'index.html',
								key: 'index.html'
							},
							{
								url: '/samples/messageToast/manifest.json',
								name: 'manifest.json',
								key: 'manifest.json',
								isApplicationManifest: true
							},
							{
								url: '/samples/messageToast/Component.js',
								name: 'Component.js',
								key: 'Component.js'
							}
						]
					}
				]
			}
		]
	});
});


text:
package com.groceryreminder.domain;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.location.LocationManager;
import android.provider.Settings;

import com.groceryreminder.BuildConfig;
import com.groceryreminder.R;
import com.groceryreminder.RobolectricTestBase;
import com.groceryreminder.data.ReminderContract;
import com.groceryreminder.shadows.ShadowLocationManager;
import com.groceryreminder.testUtils.LocationValuesBuilder;
import com.groceryreminder.testUtils.ReminderValuesBuilder;
import com.groceryreminder.views.reminders.RemindersActivity;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.shadows.ShadowIntent;
import org.robolectric.shadows.ShadowLocation;
import org.robolectric.shadows.ShadowNotification;
import org.robolectric.shadows.ShadowNotificationManager;
import org.robolectric.shadows.ShadowPendingIntent;

import java.util.List;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, shadows = {ShadowLocationManager.class})
public class GroceryStoreNotificationManagerTest extends RobolectricTestBase {

    public static final String ARBITRARY_STORE_NAME = "test";
    GroceryStoreNotificationManager groceryStoreNotificationManager;

    @Before
    public void setUp() {
        super.setUp();
        ContentValues reminderValues = new ReminderValuesBuilder().createDefaultReminderValues().build();
        RuntimeEnvironment.application.getContentResolver().insert(ReminderContract.Reminders.CONTENT_URI, reminderValues);
        groceryStoreNotificationManager = new GroceryStoreNotificationManager(RuntimeEnvironment.application, getTestAndroidModule().getLocationManager());
    }

    private Intent buildIntentToListenFor() {
        Intent intentToListenFor =  new Intent(GroceryReminderConstants.ACTION_STORE_PROXIMITY_EVENT);
        intentToListenFor.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, true);
        intentToListenFor.putExtra(ReminderContract.Locations.NAME, ARBITRARY_STORE_NAME);

        return intentToListenFor;
    }

    private ShadowNotificationManager getShadowNotificationManager() {
        return Shadows.shadowOf((NotificationManager)
                RuntimeEnvironment.application.getSystemService(Context.NOTIFICATION_SERVICE));
    }

    @Test
    public void whenANotificationIsSentThenTheNotificationShouldBeCreated() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNotNull(notification);
    }

    @Test
    public void whenANotificationIsSentThenTheSmallIconIsSet() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertEquals(R.drawable.ic_stat_maps_local_grocery_store, notification.icon);
    }

    @Test
    public void whenANotificationIsSentThenTheContentTitleIsSet() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));
        assertEquals(RuntimeEnvironment.application.getString(R.string.app_name) + ": " + ARBITRARY_STORE_NAME, notification.getContentTitle());
    }

    @Test
    public void whenANotificationIsSentThenTheContentTextIsSet() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));
        assertEquals(RuntimeEnvironment.application.getString(R.string.reminder_notification), notification.getContentText());
    }

    @Test
    public void whenANotificationIsSentThenTheVibrationIsSet() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));

        assertArrayEquals(GroceryReminderConstants.PROXIMITY_VIBRATION_PATTERN, notification.getRealNotification().vibrate);
    }

    @Test
    public void whenANotificationIsSentThenTheDefaultNotificationSoundPlays() {
        Intent intent = buildIntentToListenFor();

        groceryStoreNotificationManager.sendNotification(intent);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));

        assertEquals(Settings.System.DEFAULT_NOTIFICATION_URI, notification.getRealNotification().sound);
    }

    @Test
    public void whenANotificationIsSavedThenTheStoreNameIsStoredAsTheMostRecentStore() {
        groceryStoreNotificationManager.saveNoticeDetails(ARBITRARY_STORE_NAME, System.currentTimeMillis());

        SharedPreferences sharedPreferences = RuntimeEnvironment.application
                .getSharedPreferences(RuntimeEnvironment.application.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);

        assertEquals(ARBITRARY_STORE_NAME, sharedPreferences.getString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ""));
    }

    @Test
    public void whenANotificationIsSentThenTheNotificationTimeIsStoredAsTheMostRecentNotificationTime() {
        long notificationTime = System.currentTimeMillis();

        groceryStoreNotificationManager.saveNoticeDetails(ARBITRARY_STORE_NAME, notificationTime);
        SharedPreferences sharedPreferences = RuntimeEnvironment.application
                .getSharedPreferences(RuntimeEnvironment.application.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);

        assertTrue(sharedPreferences.getLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME, 0) > 0);
    }

    @Test
    public void whenThereAreNoStoresThenTheNotificationIsNotSent() {
        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);
        shadowApplication.getContentResolver().delete(ReminderContract.Locations.CONTENT_URI, null, null);

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNull(notification);
    }

    @Test
    public void givenThereIsAStoreNearbyThenTheNotificationIsSent() {
        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNotNull(notification);
    }

    @Test
    public void whenANotificationIsSentThenTheTheNotificationDetailsAreSaved() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        long currentTime = System.currentTimeMillis();
        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), currentTime);

        SharedPreferences sharedPreferences = shadowApplication.getSharedPreferences(shadowApplication.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);
        assertEquals(ARBITRARY_STORE_NAME, sharedPreferences.getString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ""));
        assertEquals(currentTime, sharedPreferences.getLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME, 0));
    }

    @Test
    public void whenANotificationIsSentForTheSameStoreThenTheTheLastNotificationTimeForTheSameStoreIsSetAreSaved() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);
        SharedPreferences sharedPreferences = shadowApplication.getSharedPreferences(shadowApplication.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);
        sharedPreferences.edit().putString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ARBITRARY_STORE_NAME).commit();

        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        long currentTime = System.currentTimeMillis();
        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), currentTime);

        assertEquals(currentTime, sharedPreferences.getLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME_FOR_SAME_STORE, 0));
    }

    @Test
    public void whenANotificationIsSentThenTheTheNotificationIncludesTheStoreName() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        long currentTime = System.currentTimeMillis();
        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), currentTime);

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        ShadowNotification shadowNotification = (ShadowNotification)Shadows.shadowOf(notification);
        assertTrue(((String) shadowNotification.getContentTitle()).contains(ARBITRARY_STORE_NAME));
    }

    private void insertStoreLocation(ShadowApplication shadowApplication) {
        ContentValues locationValues = new LocationValuesBuilder().createDefaultLocationValues().withName(ARBITRARY_STORE_NAME).build();
        shadowApplication.getContentResolver().insert(ReminderContract.Locations.CONTENT_URI, locationValues);
    }

    @Test
    public void givenThereAreStoresButNotNearbyThenTheNotificationIsNotSent() {
        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[] {(float)GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS + 1});

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNull(notification);
    }

    @Test
     public void givenAStoreNotificationHasBeenStoredWhenARequestToSendANotificationWithTheTheSameStoreIsReceivedBeforeTheMinimumUpdateTimeForTheSameStoreThenTheNotificationIsNotSent() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);
        SharedPreferences sharedPreferences = shadowApplication.getSharedPreferences(shadowApplication.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);
        sharedPreferences.edit().putString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ARBITRARY_STORE_NAME)
                .putLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME_FOR_SAME_STORE, System.currentTimeMillis() - 1)
                .commit();

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNull(notification);
    }

    @Test
    public void givenAStoreNotificationHasBeenStoredWhenARequestToSendANotificationWithTheTheSameStoreAfterTheMinimumUpdateTimeForTheSameStoreIsReceivedThenTheNotificationIsSent() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);
        SharedPreferences sharedPreferences = shadowApplication.getSharedPreferences(shadowApplication.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);
        sharedPreferences.edit()
                .putString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ARBITRARY_STORE_NAME)
                .putLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME_FOR_SAME_STORE, GroceryReminderConstants.MIN_LOCATION_UPDATE_TIME_FOR_SAME_STORE_MILLIS + 1)
                .commit();

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNotNull(notification);
    }

    @Test
    public void givenAStoreNotificationHasBeenSentWhenARequestToSendANotificationIsReceivedUnderTheMinimumLocationUpdateTimeThenTheNotificationIsNotSent() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);
        SharedPreferences sharedPreferences = shadowApplication.getSharedPreferences(shadowApplication.getString(R.string.reminder_pref_key), Context.MODE_PRIVATE);
        sharedPreferences.edit()
                .putString(GroceryReminderConstants.LAST_NOTIFIED_STORE_KEY, ARBITRARY_STORE_NAME + 1)
                .putLong(GroceryReminderConstants.LAST_NOTIFICATION_TIME, System.currentTimeMillis())
                .commit();

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNull(notification);
    }

    @Test
    public void givenAStoreNotificationHasNotBeenSentWhenARequestToSendANotificationIsReceivedThenTheIsSent() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);
        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNotNull(notification);
    }

    @Test
    public void whenNoRemindersExistThenNoNotificationIsSent() {
        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);
        shadowApplication.getContentResolver().delete(ReminderContract.Reminders.CONTENT_URI, null, null);
        insertStoreLocation(shadowApplication);
        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        Notification notification = shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT);
        assertNull(notification);
    }

    @Test
    public void whenThereAreMultipleStoresNearbyThenOnlyOneNotificationIsSent() {
        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();

        ShadowApplication shadowApplication = (ShadowApplication) Shadows.shadowOf(RuntimeEnvironment.application);

        insertStoreLocation(shadowApplication);
        insertStoreLocation(shadowApplication);

        ShadowLocation.setDistanceBetween(new float[]{(float) GroceryReminderConstants.LOCATION_GEOFENCE_RADIUS_METERS});

        groceryStoreNotificationManager.sendPotentialNotification(new Location(LocationManager.GPS_PROVIDER), System.currentTimeMillis());

        List<Notification> notifications = shadowNotificationManager.getAllNotifications();
        assertEquals(1, notifications.size());
    }

    @Test
    public void givenANotificationIsSentWhenTheNotificationIsActedOnThenTheRemindersActivityIsLaunched() {
        groceryStoreNotificationManager.sendNotification(buildIntentToListenFor());

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));
        ShadowPendingIntent shadowPendingIntent = Shadows.shadowOf(notification.getRealNotification().contentIntent);
        ShadowIntent shadowIntent = Shadows.shadowOf(shadowPendingIntent.getSavedIntent());

        assertEquals(RemindersActivity.class.getName(), shadowIntent.getComponent().getClassName());
    }

    @Test
    public void givenANotificationIsSentWhenTheNotificationIsActedOnThenTheTheNotificationIsDismissed() {
        groceryStoreNotificationManager.sendNotification(buildIntentToListenFor());

        ShadowNotificationManager shadowNotificationManager = getShadowNotificationManager();
        ShadowNotification notification = Shadows.shadowOf(shadowNotificationManager.getNotification(GroceryReminderConstants.NOTIFICATION_PROXIMITY_ALERT));

        assertTrue((notification.getRealNotification().flags & Notification.FLAG_AUTO_CANCEL) == Notification.FLAG_AUTO_CANCEL);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package eu.sarunas.atf.generators.code;

import java.util.List;
import eu.sarunas.atf.meta.sut.Class;
import eu.sarunas.atf.meta.tests.TestSuite;

public interface ITestTransformer
{
	public Class transformTest(TestSuite testSuite, List<String> constraintsFiles);
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using RucheHome.Util;
using RucheHome.Util.Extensions.String;

namespace VoiceroidUtil
{
    /// <summary>
    /// TalkTextReplaceItem インスタンスコレクションクラス。
    /// </summary>
    public class TalkTextReplaceItemCollection : BindableCollection<TalkTextReplaceItem>
    {
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        public TalkTextReplaceItemCollection() : base()
        {
        }

        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="items">コレクションの初期値となるアイテム列挙。</param>
        public TalkTextReplaceItemCollection(IEnumerable<TalkTextReplaceItem> items)
            : base(items)
        {
        }

        /// <summary>
        /// 現在のアイテム群を用いて文字列を置換する。
        /// </summary>
        /// <param name="src">置換対象文字列。</param>
        /// <returns>置換後の文字列。</returns>
        public string Replace(string src)
        {
            if (src != null)
            {
                var items = this.Where(i => i.IsAvailable());
                if (items.Any())
                {
                    return
                        src.Replace(
                            items.Select(i => i.OldValue),
                            items.Select(i => i.NewValue));
                }
            }

            return src;
        }

        #region BindableCollection<TalkTextReplaceItem> のオーバライド

        protected override void InsertItem(int index, TalkTextReplaceItem item)
        {
            // null は無視
            if (item != null)
            {
                base.InsertItem(index, item);
            }
        }

        protected override void SetItem(int index, TalkTextReplaceItem item)
        {
            // null は無視
            if (item != null)
            {
                base.SetItem(index, item);
            }
        }

        #endregion
    }
}


text:
package org.apache.cassandra.cql3;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CyclicBarrier;

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

import com.datastax.driver.core.Row;
import com.datastax.driver.core.exceptions.NoHostAvailableException;
import com.datastax.driver.core.exceptions.WriteTimeoutException;
import org.apache.cassandra.batchlog.BatchlogManager;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.apache.cassandra.transport.ProtocolVersion;
import org.apache.cassandra.concurrent.SEPExecutor;
import org.apache.cassandra.concurrent.Stage;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.WrappedRunnable;

public class ViewLongTest extends CQLTester
{
    ProtocolVersion protocolVersion = ProtocolVersion.V4;
    private final List<String> views = new ArrayList<>();

    @BeforeClass
    public static void startup()
    {
        requireNetwork();
    }
    @Before
    public void begin()
    {
        views.clear();
    }

    @After
    public void end() throws Throwable
    {
        for (String viewName : views)
            executeNet(protocolVersion, "DROP MATERIALIZED VIEW " + viewName);
    }

    private void createView(String name, String query) throws Throwable
    {
        executeNet(protocolVersion, String.format(query, name));
        // If exception is thrown, the view will not be added to the list; since it shouldn't have been created, this is
        // the desired behavior
        views.add(name);
    }

    @Test
    public void testConflictResolution() throws Throwable
    {
        final int writers = 96;
        final int insertsPerWriter = 50;
        final Map<Integer, Exception> failedWrites = new ConcurrentHashMap<>();

        createTable("CREATE TABLE %s (" +
                    "a int," +
                    "b int," +
                    "c int," +
                    "PRIMARY KEY (a, b))");

        executeNet(protocolVersion, "USE " + keyspace());

        createView("mv", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE c IS NOT NULL AND a IS NOT NULL AND b IS NOT NULL PRIMARY KEY (c, a, b)");

        CyclicBarrier semaphore = new CyclicBarrier(writers);

        Thread[] threads = new Thread[writers];
        for (int i = 0; i < writers; i++)
        {
            final int writer = i;
            Thread t = NamedThreadFactory.createThread(new WrappedRunnable()
            {
                public void runMayThrow()
                {
                    try
                    {
                        int writerOffset = writer * insertsPerWriter;
                        semaphore.await();
                        for (int i = 0; i < insertsPerWriter; i++)
                        {
                            try
                            {
                                executeNet(protocolVersion, "INSERT INTO %s (a, b, c) VALUES (?, ?, ?) USING TIMESTAMP 1",
                                           1,
                                           1,
                                           i + writerOffset);
                            }
                            catch (NoHostAvailableException|WriteTimeoutException e)
                            {
                                failedWrites.put(i + writerOffset, e);
                            }
                        }
                    }
                    catch (Throwable e)
                    {
                        throw new RuntimeException(e);
                    }
                }
            });
            t.start();
            threads[i] = t;
        }

        for (int i = 0; i < writers; i++)
            threads[i].join();

        for (int i = 0; i < writers * insertsPerWriter; i++)
        {
            if (executeNet(protocolVersion, "SELECT COUNT(*) FROM system.batches").one().getLong(0) == 0)
                break;
            try
            {
                // This will throw exceptions whenever there are exceptions trying to push the view values out, caused
                // by the view becoming overwhelmed.
                BatchlogManager.instance.startBatchlogReplay().get();
            }
            catch (Throwable ignore)
            {

            }
        }

        int value = executeNet(protocolVersion, "SELECT c FROM %s WHERE a = 1 AND b = 1").one().getInt("c");

        List<Row> rows = executeNet(protocolVersion, "SELECT c FROM " + keyspace() + ".mv").all();

        boolean containsC = false;
        StringBuilder others = new StringBuilder();
        StringBuilder overlappingFailedWrites = new StringBuilder();
        for (Row row : rows)
        {
            int c = row.getInt("c");
            if (c == value)
                containsC = true;
            else
            {
                if (others.length() != 0)
                    others.append(' ');
                others.append(c);
                if (failedWrites.containsKey(c))
                {
                    if (overlappingFailedWrites.length() != 0)
                        overlappingFailedWrites.append(' ');
                    overlappingFailedWrites.append(c)
                                           .append(':')
                                           .append(failedWrites.get(c).getMessage());
                }
            }
        }

        if (rows.size() > 1)
        {
            throw new AssertionError(String.format("Expected 1 row, but found %d; %s c = %d, and (%s) of which (%s) failed to insert", rows.size(), containsC ? "found row with" : "no rows contained", value, others, overlappingFailedWrites));
        }
        else if (rows.isEmpty())
        {
            throw new AssertionError(String.format("Could not find row with c = %d", value));
        }
        else if (rows.size() == 1 && !containsC)
        {
            throw new AssertionError(String.format("Single row had c = %d, expected %d", rows.get(0).getInt("c"), value));
        }
    }

    @Test
    public void testExpiredLivenessInfoWithDefaultTTLWithFlush() throws Throwable
    {
        testExpiredLivenessInfoWithDefaultTTL(true);
    }

    @Test
    public void testExpiredLivenessInfoWithDefaultTTLWithoutFlush() throws Throwable
    {
        testExpiredLivenessInfoWithDefaultTTL(false);
    }

    private void testExpiredLivenessInfoWithDefaultTTL(boolean flush) throws Throwable
    {
        createTable("CREATE TABLE %s (field1 int,field2 int,date int,PRIMARY KEY ((field1), field2)) WITH default_time_to_live = 5;");

        execute("USE " + keyspace());
        executeNet(protocolVersion, "USE " + keyspace());

        createView("mv",
                   "CREATE MATERIALIZED VIEW mv AS SELECT * FROM %%s WHERE field1 IS NOT NULL AND field2 IS NOT NULL AND date IS NOT NULL PRIMARY KEY ((field1), date, field2) WITH CLUSTERING ORDER BY (date desc, field2 asc);");

        updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 111);", flush);
        assertRows(execute("select * from %s"), row(1, 2, 111));
        assertRows(execute("select * from mv"), row(1, 111, 2));

        updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 222);", flush);
        assertRows(execute("select * from %s"), row(1, 2, 222));
        assertRows(execute("select * from mv"), row(1, 222, 2));

        updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 333);", flush);

        assertRows(execute("select * from %s"), row(1, 2, 333));
        assertRows(execute("select * from mv"), row(1, 333, 2));

        if (flush)
        {
            Keyspace.open(keyspace()).getColumnFamilyStore("mv").forceMajorCompaction();
            assertRows(execute("select * from %s"), row(1, 2, 333));
            assertRows(execute("select * from mv"), row(1, 333, 2));
        }

        // wait for ttl, data should be removed
        updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 444);", flush);
        assertRows(execute("select * from %s"), row(1, 2, 444));
        assertRows(execute("select * from mv"), row(1, 444, 2));

        Thread.sleep(5000);
        assertRows(execute("select * from %s"));
        assertRows(execute("select * from mv"));

        // shadow mv with date=555 and then update it back to live, wait for ttl
        updateView("update %s set date=555 where field1=1 and field2=2;");
        updateView("update %s set date=666 where field1=1 and field2=2;");
        updateViewWithFlush("update %s set date=555 where field1=1 and field2=2;", flush);
        assertRows(execute("select * from %s"), row(1, 2, 555));
        assertRows(execute("select * from mv"), row(1, 555, 2));

        Thread.sleep(5000);
        assertRows(execute("select * from %s"));
        assertRows(execute("select * from mv"));

        // test user-provided ttl for table with/without default-ttl
        for (boolean withDefaultTTL : Arrays.asList(true, false))
        {
            execute("TRUNCATE %s");
            if (withDefaultTTL)
                execute("ALTER TABLE %s with default_time_to_live=" + (withDefaultTTL ? 10 : 0));
            updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 666) USING TTL 1000;", flush);

            assertRows(execute("select * from %s"), row(1, 2, 666));
            assertRows(execute("select * from mv"), row(1, 666, 2));

            updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 777) USING TTL 1100;", flush);
            assertRows(execute("select * from %s"), row(1, 2, 777));
            assertRows(execute("select * from mv"), row(1, 777, 2));

            updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 888) USING TTL 800;", flush);

            assertRows(execute("select * from %s"), row(1, 2, 888));
            assertRows(execute("select * from mv"), row(1, 888, 2));

            if (flush)
            {
                Keyspace.open(keyspace()).getColumnFamilyStore("mv").forceMajorCompaction();
                assertRows(execute("select * from %s"), row(1, 2, 888));
                assertRows(execute("select * from mv"), row(1, 888, 2));
            }

            // wait for ttl, data should be removed
            updateViewWithFlush("insert into %s (field1, field2, date) values (1, 2, 999) USING TTL 5;", flush);
            assertRows(execute("select * from %s"), row(1, 2, 999));
            assertRows(execute("select * from mv"), row(1, 999, 2));

            Thread.sleep(5000);
            assertRows(execute("select * from %s"));
            assertRows(execute("select * from mv"));

            // shadow mv with date=555 and then update it back to live with ttl=5, wait for ttl to expire
            updateViewWithFlush("update %s  USING TTL 800 set date=555 where field1=1 and field2=2;", flush);
            assertRows(execute("select * from %s"), row(1, 2, 555));
            assertRows(execute("select * from mv"), row(1, 555, 2));

            updateViewWithFlush("update %s set date=666 where field1=1 and field2=2;", flush);
            assertRows(execute("select * from %s"), row(1, 2, 666));
            assertRows(execute("select * from mv"), row(1, 666, 2));

            updateViewWithFlush("update %s USING TTL 5 set date=555 where field1=1 and field2=2;", flush);
            assertRows(execute("select * from %s"), row(1, 2, 555));
            assertRows(execute("select * from mv"), row(1, 555, 2));

            Thread.sleep(5000);
            assertRows(execute("select * from %s"));
            assertRows(execute("select * from mv"));
        }
    }

    @Test
    public void testExpiredLivenessInfoWithUnselectedColumnAndDefaultTTLWithFlush() throws Throwable
    {
        testExpiredLivenessInfoWithUnselectedColumnAndDefaultTTL(true);
    }

    @Test
    public void testExpiredLivenessInfoWithUnselectedColumnAndDefaultTTLWithoutFlush() throws Throwable
    {
        testExpiredLivenessInfoWithUnselectedColumnAndDefaultTTL(false);
    }

    private void testExpiredLivenessInfoWithUnselectedColumnAndDefaultTTL(boolean flush) throws Throwable
    {
        createTable("CREATE TABLE %s (k int,c int,a int, b int, PRIMARY KEY ((k), c)) WITH default_time_to_live = 1000;");

        execute("USE " + keyspace());
        executeNet(protocolVersion, "USE " + keyspace());

        createView("mv",
                   "CREATE MATERIALIZED VIEW mv AS SELECT k,c,a FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL "
                           + "PRIMARY KEY (c, k)");

        // table default ttl
        updateViewWithFlush("UPDATE %s SET b = 111 WHERE k = 1 AND c = 2", flush);
        assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 111));
        assertRows(execute("select k,c,a from mv"), row(1, 2, null));

        updateViewWithFlush("UPDATE %s SET b = null WHERE k = 1 AND c = 2", flush);
        assertRows(execute("select k,c,a,b from %s"));
        assertRows(execute("select k,c,a from mv"));

        updateViewWithFlush("UPDATE %s SET b = 222 WHERE k = 1 AND c = 2", flush);
        assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 222));
        assertRows(execute("select k,c,a from mv"), row(1, 2, null));

        updateViewWithFlush("DELETE b FROM %s WHERE k = 1 AND c = 2", flush);
        assertRows(execute("select k,c,a,b from %s"));
        assertRows(execute("select k,c,a from mv"));

        if (flush)
        {
            Keyspace.open(keyspace()).getColumnFamilyStore("mv").forceMajorCompaction();
            assertRows(execute("select k,c,a,b from %s"));
            assertRows(execute("select k,c,a from mv"));
        }

        // test user-provided ttl for table with/without default-ttl
        for (boolean withDefaultTTL : Arrays.asList(true, false))
        {
            execute("TRUNCATE %s");
            if (withDefaultTTL)
                execute("ALTER TABLE %s with default_time_to_live=" + (withDefaultTTL ? 10 : 0));

            updateViewWithFlush("UPDATE %s USING TTL 100 SET b = 666 WHERE k = 1 AND c = 2", flush);
            assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 666));
            assertRows(execute("select k,c,a from mv"), row(1, 2, null));

            updateViewWithFlush("UPDATE %s USING TTL 90  SET b = null WHERE k = 1 AND c = 2", flush);
            if (flush)
                FBUtilities.waitOnFutures(Keyspace.open(keyspace()).flush());
            assertRows(execute("select k,c,a,b from %s"));
            assertRows(execute("select k,c,a from mv"));

            updateViewWithFlush("UPDATE %s USING TTL 80  SET b = 777 WHERE k = 1 AND c = 2", flush);
            assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 777));
            assertRows(execute("select k,c,a from mv"), row(1, 2, null));

            updateViewWithFlush("DELETE b FROM %s WHERE k = 1 AND c = 2", flush);
            assertRows(execute("select k,c,a,b from %s"));
            assertRows(execute("select k,c,a from mv"));

            updateViewWithFlush("UPDATE %s USING TTL 110  SET b = 888 WHERE k = 1 AND c = 2", flush);
            assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 888));
            assertRows(execute("select k,c,a from mv"), row(1, 2, null));

            updateViewWithFlush("UPDATE %s USING TTL 5  SET b = 999 WHERE k = 1 AND c = 2", flush);
            assertRows(execute("select k,c,a,b from %s"), row(1, 2, null, 999));
            assertRows(execute("select k,c,a from mv"), row(1, 2, null));

            Thread.sleep(5000); // wait for ttl expired

            if (flush)
            {
                Keyspace.open(keyspace()).getColumnFamilyStore("mv").forceMajorCompaction();
                assertRows(execute("select k,c,a,b from %s"));
                assertRows(execute("select k,c,a from mv"));
            }
        }
    }

    private void updateView(String query, Object... params) throws Throwable
    {
        updateViewWithFlush(query, false, params);
    }

    private void updateViewWithFlush(String query, boolean flush, Object... params) throws Throwable
    {
        executeNet(protocolVersion, query, params);
        while (!(((SEPExecutor) Stage.VIEW_MUTATION.executor()).getPendingTaskCount() == 0
                && ((SEPExecutor) Stage.VIEW_MUTATION.executor()).getActiveTaskCount() == 0))
        {
            Thread.sleep(1);
        }
        if (flush)
            Keyspace.open(keyspace()).flush();
    }
}


text:
<?php

namespace Cravler\RemoteBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;

/**
 * @author Sergei Vizel <sergei.vizel@gmail.com>
 */
class EndpointsCompilerPass implements CompilerPassInterface
{
    /**
     * @param ContainerBuilder $container
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('cravler_remote.service.endpoints_chain')) {
            return;
        }

        $definition = $container->getDefinition(
            'cravler_remote.service.endpoints_chain'
        );

        $taggedServices = $container->findTaggedServiceIds(
            'cravler_remote.endpoint'
        );
        foreach ($taggedServices as $id => $attributes) {
            $definition->addMethodCall(
                'addEndpoint',
                array(new Reference($id))
            );
        }
    }
}


text: template class std::ctype<short>;


text:
  {{#with user}}

    <button class="close" data-dismiss="modal">×</button>

{{ name }}

@{{ username}}

      {{#if location }}
      {{ location }}
      ·
      {{/if}}
      {{#if website_url }}
      {{ website_url }}
      {{/if}}

    Follow on Dribbble

{{ shots_count }} shots

{{ likes_received_count }} likes received

{{ likes_count }} likes given

{{ following_count }} following

{{ followers_count }} followers

  {{/with}}

    {{#each shots}}

      {{ title }}

{{ views_count }}

{{ comments_count }}

{{ likes_count }}

    {{/each}}


text:
using namespace lemon;

BOOST_AUTO_TEST_CASE(Empty) {
  lemon::ListGraph graph;

  const int connectedComponentCount = lemon::countConnectedComponents(graph);
  BOOST_CHECK_EQUAL(0, connectedComponentCount);
}

BOOST_AUTO_TEST_CASE(OneCC) {
  lemon::ListGraph graph;
  lemon::ListGraph::Node a = graph.addNode(), b = graph.addNode();
  graph.addEdge(a,b);
  const int connectedComponentCount = lemon::countConnectedComponents(graph);
  BOOST_CHECK_EQUAL(1, connectedComponentCount);
}

BOOST_AUTO_TEST_CASE(TwoCC) {
  lemon::ListGraph graph;

  lemon::ListGraph::Node a = graph.addNode(), b = graph.addNode();
  graph.addEdge(a,b);
  lemon::ListGraph::Node a2 = graph.addNode(), b2 = graph.addNode();
  graph.addEdge(a2,b2);
  const int connectedComponentCount = lemon::countConnectedComponents(graph);
  BOOST_CHECK_EQUAL(2, connectedComponentCount);
}

BOOST_AUTO_TEST_CASE(TwoCC_Parsing) {
  lemon::ListGraph graph;

  lemon::ListGraph::Node a = graph.addNode(), b = graph.addNode();
  graph.addEdge(a,b);
  lemon::ListGraph::Node a2 = graph.addNode(), b2 = graph.addNode();
  graph.addEdge(a2,b2);

  typedef ListGraph::NodeMap<size_t> IndexMap;
  IndexMap connectedNodeMap(graph);
  const int connectedComponentCount =  lemon::connectedComponents(graph, connectedNodeMap);
  BOOST_CHECK_EQUAL(2, connectedComponentCount);
  for (IndexMap::MapIt it(connectedNodeMap); it != INVALID; ++it)
  {
    ALICEVISION_LOG_DEBUG(*it << "\t" << graph.id(it));
  }
}

/// Test to get back node id of each CC
// a
//
// b-c
//
// d-g
// | |
// e-f
//
// h-i-j-k
//   |/
//   l
BOOST_AUTO_TEST_CASE(exportGraphToMapSubgraphs_CC_Subgraph) {
  lemon::ListGraph graph;

  // single
  lemon::ListGraph::Node a = graph.addNode();

  // two
  lemon::ListGraph::Node b = graph.addNode(), c = graph.addNode();
  graph.addEdge(b,c);

  // four
  lemon::ListGraph::Node d = graph.addNode(), e = graph.addNode(),
    f = graph.addNode(), g = graph.addNode();
  graph.addEdge(d,e);
  graph.addEdge(e,f);
  graph.addEdge(f,g);
  graph.addEdge(g,d);

  // five
  lemon::ListGraph::Node h = graph.addNode(), i = graph.addNode(),
    j = graph.addNode(), k = graph.addNode(),l = graph.addNode();
  graph.addEdge(h,i);
  graph.addEdge(i,j);
  graph.addEdge(j,k);
  graph.addEdge(i,l);
  graph.addEdge(j,l);

  const std::map<size_t, std::set<lemon::ListGraph::Node> > map_subgraphs =
    aliceVision::graph::exportGraphToMapSubgraphs<lemon::ListGraph, size_t>(graph);

  BOOST_CHECK_EQUAL(4, map_subgraphs.size());
  BOOST_CHECK_EQUAL(5, map_subgraphs.at(0).size());
  BOOST_CHECK_EQUAL(4, map_subgraphs.at(1).size());
  BOOST_CHECK_EQUAL(2, map_subgraphs.at(2).size());
  BOOST_CHECK_EQUAL(1, map_subgraphs.at(3).size());
}


text:
package org.dcm4che.srom;

/**
 * The ImageContent interface represents a
 * DICOM SR Image Content of value type IMAGE.
 *

 *
 * A DICOM SR Image Content specifies the Attributes that convey
 * a reference to a DICOM image.
 *
 * @author  gunter.zeilinger@tiani.com
 * @version 1.0
 *
 * @see "DICOM Part 3: Information Object Definitions,
 * Annex C.17.3 SR Document Content Module"
 *
 * @see "DICOM Part 3: Information Object Definitions,
 * Annex C.18.4 Image Reference Macro"
 */
public interface ImageContent extends CompositeContent {
    // Constants -----------------------------------------------------

    // Public --------------------------------------------------------

    /**
     * Returns the frame numbers of a refereced DICOM image.
     *
DICOM Tag: (0008,1160)
     *
Tag Name: Referenced Frame Number
     *

     * Identifies the frame numbers within the Referenced SOP Instance
     * to which the reference applies. The first frame shall be denoted
     * as frame number 1.
     *
     *
Note:

     *

     *   This Attribute may be multi-valued.
     *   Required if the Referenced SOP Instance
     *   is a multi-frame image and the reference
     *   does not apply to all frames.
     *

     *
     * @return  Frame numbers of a refereced DICOM image.
     */
    public int[] getFrameNumbers();

    public void setFrameNumbers(int[] frameNumbers);

    /**
     * Returns the single item of DICOM Referenced SOP Sequence
     * for reference to a
     * Softcopy Presentation State SOP Class/SOP Instance pair.
     *
DICOM Tag: (0008,1199)
     *
Tag Name: Referenced SOP Sequence
     *

     * This is the reference to the presentation state of a DICOM image.
     * Only a single Item is permitted in this sequence so only one
     * {@link RefSOP} object will be returned.
     *
     *

     *
NOTE:  from [Clunie2000]
     *

     *   There may not be more than one item (since that would imply
     *   more than one value),58 and there may not be zero items
     *   (since that would imply no value).
     *
     *   58.
     *      This is not strictly true. As of the time of writing,
     *      there is what is probably an error in Supplement 23
     *      that has not yet been corrected with a CP. Though the
     *      text describing the COMPOSITE value type implies a
     *      single reference,the macro allows for one or more
     *      items in the sequence. This also affects the IMAGE
     *      and WAVEFORM value types which include the COMPOSITE
     *      macro.
     *
     *

     *
     * @return  Single item of Referenced SOP Sequence.
     *
     * @see "[Clunie2000] - Clunie, David. DICOM Structured Reporting.
     * PixelMed Publishing, Bangor, Pennsylvania, 2000. ISBN: 0970136900."
     */
    public RefSOP getRefPresentationSOP();

    public void setRefPresentationSOP(RefSOP refPresentationSOP);

    public IconImage getIconImage();

    public void setIconImage(IconImage iconImage);

}//end interface ImageContent


text:
using System.ComponentModel;

namespace Tasks.Models {
    public sealed class LocationItem {
        public string Id { get; set; }

        public string Name { get; set; }

        public string Address { get; set; }

        public string Town { get; set; }

        private float _CurrentTemperature;

        public float CurrentTemperature {
            get { return _CurrentTemperature; }
            set {
                if (_CurrentTemperature != value) {
                    _CurrentTemperature = value;
                    NotifyPropertyChanged(nameof(CurrentTemperature));
                }
            }
        }

        private float _HighestTemperature;

        public float HighestTemperature {
            get { return _HighestTemperature; }
            set {
                if (_HighestTemperature != value) {
                    _HighestTemperature = value;
                    NotifyPropertyChanged(nameof(HighestTemperature));
                }
            }
        }

        private float _LowestTemperature;

        public float LowestTemperature {
            get { return _LowestTemperature; }
            set {
                if (_LowestTemperature != value) {
                    _LowestTemperature = value;
                    NotifyPropertyChanged(nameof(LowestTemperature));
                }

            }
        }

        public double Latitude { get; set; }

        public double Longitude { get; set; }

        private bool _IsSelected;

        public bool IsSelected {
            get { return _IsSelected; }
            set {
                if (_IsSelected != value) {
                    _IsSelected = value;
                    NotifyPropertyChanged(nameof(IsSelected));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName) {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}


text:
package group.idealworld.dew.devops.kernel.config;

import group.idealworld.dew.devops.kernel.exception.ConfigException;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * Dew docker.
 *
 * @author gudaoxuri
 */
public class DewDocker {

    // Dockerd的Host e.g. tcp://dockerd.dew.idealworld.group:2375
    private String host = "";
    // Docker Registry Url  e.g. https://harbor.dew.idealworld.group/v2
    private String registryUrl = "";
    // Docker Registry 用户名
    private String registryUserName = "";
    // Docker Registry 密码
    private String registryPassword = "";
    // Docker 镜像
    // 前端项目默认使用 nginx:alpine
    // 后端服务项目默认使用 openjdk:8-alpine
    private String image = "";

    /**
     * Gets registry host.
     *
     * @return the registry host
     */
    public String getRegistryHost() {
        try {
            return new URL(registryUrl).getHost();
        } catch (MalformedURLException e) {
            throw new ConfigException("Registry host parse error", e);
        }
    }

    /**
     * Gets host.
     *
     * @return the host
     */
    public String getHost() {
        return host;
    }

    /**
     * Sets host.
     *
     * @param host the host
     */
    public void setHost(String host) {
        this.host = host;
    }

    /**
     * Gets registry url.
     *
     * @return the registry url
     */
    public String getRegistryUrl() {
        return registryUrl;
    }

    /**
     * Sets registry url.
     *
     * @param registryUrl the registry url
     */
    public void setRegistryUrl(String registryUrl) {
        this.registryUrl = registryUrl;
    }

    /**
     * Gets registry user name.
     *
     * @return the registry user name
     */
    public String getRegistryUserName() {
        return registryUserName;
    }

    /**
     * Sets registry user name.
     *
     * @param registryUserName the registry user name
     */
    public void setRegistryUserName(String registryUserName) {
        this.registryUserName = registryUserName;
    }

    /**
     * Gets registry password.
     *
     * @return the registry password
     */
    public String getRegistryPassword() {
        return registryPassword;
    }

    /**
     * Sets registry password.
     *
     * @param registryPassword the registry password
     */
    public void setRegistryPassword(String registryPassword) {
        this.registryPassword = registryPassword;
    }

    /**
     * Gets image.
     *
     * @return the image
     */
    public String getImage() {
        return image;
    }

    /**
     * Sets image.
     *
     * @param image the image
     */
    public void setImage(String image) {
        this.image = image;
    }
}