text:
"""
Common parameter types for validating request Body.

"""
import copy
import re
import unicodedata

import six

def _is_printable(char):
    """determine if a unicode code point is printable.

    This checks if the character is either "other" (mostly control
    codes), or a non-horizontal space. All characters that don't match
    those criteria are considered printable; that is: letters;
    combining marks; numbers; punctuation; symbols; (horizontal) space
    separators.
    """
    category = unicodedata.category(char)
    return (not category.startswith("C") and
            (not category.startswith("Z") or category == "Zs"))

def _get_all_chars():
    for i in range(0xFFFF):
        yield six.unichr(i)

# build a regex that matches all printable characters. This allows
# spaces in the middle of the name. Also note that the regexp below
# deliberately allows the empty string. This is so only the constraint
# which enforces a minimum length for the name is triggered when an
# empty string is tested. Otherwise it is not deterministic which
# constraint fails and this causes issues for some unittests when
# PYTHONHASHSEED is set randomly.
def _get_printable(exclude=None):
    if exclude is None:
        exclude = []
    return ''.join(c for c in _get_all_chars()
                       if _is_printable(c) and c not in exclude)

_printable_ws = ''.join(c for c in _get_all_chars()
                        if unicodedata.category(c) == "Zs")

def _get_printable_no_ws(exclude=None):
    if exclude is None:
        exclude = []
    return ''.join(c for c in _get_all_chars()
                   if _is_printable(c) and
                       unicodedata.category(c) != "Zs" and
                       c not in exclude)

valid_name_regex_base = '^(?![%s])[%s]*(?<![%s])$'

valid_name_regex = valid_name_regex_base % (
    re.escape(_printable_ws), re.escape(_get_printable()),
    re.escape(_printable_ws))

# This regex allows leading/trailing whitespace
valid_name_leading_trailing_spaces_regex_base = (
    "^[%(ws)s]*[%(no_ws)s]+[%(ws)s]*$|"
    "^[%(ws)s]*[%(no_ws)s][%(no_ws)s%(ws)s]+[%(no_ws)s][%(ws)s]*$")

valid_cell_name_regex = valid_name_regex_base % (
    re.escape(_printable_ws),
    re.escape(_get_printable(exclude=['!', '.', '@'])),
    re.escape(_printable_ws))

# cell's name disallow '!',  '.' and '@'.
valid_cell_name_leading_trailing_spaces_regex = (
    valid_name_leading_trailing_spaces_regex_base % {
        'ws': re.escape(_printable_ws),
        'no_ws': re.escape(_get_printable_no_ws(exclude=['!', '.', '@']))})

valid_name_leading_trailing_spaces_regex = (
    valid_name_leading_trailing_spaces_regex_base % {
        'ws': re.escape(_printable_ws),
        'no_ws': re.escape(_get_printable_no_ws())})

valid_name_regex_obj = re.compile(valid_name_regex, re.UNICODE)

boolean = {
    'type': ['boolean', 'string'],
    'enum': [True, 'True', 'TRUE', 'true', '1', 'ON', 'On', 'on',
             'YES', 'Yes', 'yes',
             False, 'False', 'FALSE', 'false', '0', 'OFF', 'Off', 'off',
             'NO', 'No', 'no'],
}

none = {
    'enum': ['None', None, {}]
}

positive_integer = {
    'type': ['integer', 'string'],
    'pattern': '^[0-9]*$', 'minimum': 1
}

non_negative_integer = {
    'type': ['integer', 'string'],
    'pattern': '^[0-9]*$', 'minimum': 0
}

hostname = {
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    # NOTE: 'host' is defined in "services" table, and that
    # means a hostname. The hostname grammar in RFC952 does
    # not allow for underscores in hostnames. However, this
    # schema allows them, because it sometimes occurs in
    # real systems.
    'pattern': '^[a-zA-Z0-9-._]*$',
}

hostname_or_ip_address = {
    # NOTE: Allow to specify hostname, ipv4 and ipv6.
    'type': 'string', 'maxLength': 255,
    'pattern': '^[a-zA-Z0-9-_.:]*$'
}

name = {
    # NOTE: Nova v2.1 API contains some 'name' parameters such
    # as keypair, server, flavor, aggregate and so on. They are
    # stored in the DB and Nova specific parameters.
    # This definition is used for all their parameters.
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    'pattern': valid_name_regex,
}

cell_name = {
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    'pattern': valid_cell_name_regex,
}

cell_name_leading_trailing_spaces = {
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    'pattern': valid_cell_name_leading_trailing_spaces_regex,
}

name_with_leading_trailing_spaces = {
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    'pattern': valid_name_leading_trailing_spaces_regex,
}

tcp_udp_port = {
    'type': ['integer', 'string'], 'pattern': '^[0-9]*$',
    'minimum': 0, 'maximum': 65535,
    'minLength': 1
}

project_id = {
    'type': 'string', 'minLength': 1, 'maxLength': 255,
    'pattern': '^[a-zA-Z0-9-]*$'
}

server_id = {
    'type': 'string', 'format': 'uuid'
}

image_id = {
    'type': 'string', 'format': 'uuid'
}

volume_id = {
    'type': 'string', 'format': 'uuid'
}

network_id = {
    'type': 'string', 'format': 'uuid'
}

network_port_id = {
    'type': 'string', 'format': 'uuid'
}

admin_password = {
    # NOTE: admin_password is the admin password of a server
    # instance, and it is not stored into nova's data base.
    # In addition, users set sometimes long/strange string
    # as password. It is unnecessary to limit string length
    # and string pattern.
    'type': 'string',
}

image_ref = {
    'type': 'string',
}

flavor_ref = {
    'type': ['string', 'integer'], 'minLength': 1
}

metadata = {
    'type': 'object',
    'patternProperties': {
        '^[a-zA-Z0-9-_:. ]{1,255}$': {
            'type': 'string', 'maxLength': 255
        }
    },
    'additionalProperties': False
}

metadata_with_null = copy.deepcopy(metadata)
metadata_with_null['patternProperties']['^[a-zA-Z0-9-_:. ]{1,255}$']['type'] =\
    ['string', 'null']

mac_address = {
    'type': 'string',
    'pattern': '^([0-9a-fA-F]{2})(:[0-9a-fA-F]{2}){5}$'
}

ip_address = {
    'type': 'string',
    'oneOf': [
        {'format': 'ipv4'},
        {'format': 'ipv6'}
    ]
}

ipv4 = {
    'type': 'string', 'format': 'ipv4'
}

ipv6 = {
    'type': 'string', 'format': 'ipv6'
}

cidr = {
    'type': 'string', 'format': 'cidr'
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="10dp"
        card_view:cardCornerRadius="8dp"
        card_view:cardElevation="8dp">

        <android.support.v7.widget.AppCompatImageView
            android:id="@+id/timetable_iv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_margin="5dp"
            android:adjustViewBounds="true"
            android:scaleType="centerCrop" />

        <android.support.v7.widget.AppCompatButton
            android:id="@+id/download"
            style="?android:attr/borderlessButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            android:layout_margin="5dp"
            android:clickable="true"
            android:text="Download"
            android:textColor="@color/colorPrimary" />
    </android.support.v7.widget.CardView>

</RelativeLayout>

redpajama_set_name: RedPajamaGithub


text:
package com.momnop.modularsonics.api;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;

public final class ItemNBTHelper {

	/** Checks if an ItemStack has a Tag Compound **/
	public static boolean detectNBT(ItemStack stack) {
		return stack.hasTagCompound();
	}

	/** Tries to initialize an NBT Tag Compound in an ItemStack,
	 * this will not do anything if the stack already has a tag
	 * compound **/
	public static void initNBT(ItemStack stack) {
		if(!detectNBT(stack))
			injectNBT(stack, new NBTTagCompound());
	}

	/** Injects an NBT Tag Compound to an ItemStack, no checks
	 * are made previously **/
	public static void injectNBT(ItemStack stack, NBTTagCompound nbt) {
		stack.setTagCompound(nbt);
	}

	/** Gets the NBTTagCompound in an ItemStack. Tries to init it
	 * previously in case there isn't one present **/
	public static NBTTagCompound getNBT(ItemStack stack) {
		initNBT(stack);
		return stack.getTagCompound();
	}

	// SETTERS ///////////////////////////////////////////////////////////////////

	public static void setBoolean(ItemStack stack, String tag, boolean b) {
		getNBT(stack).setBoolean(tag, b);
	}

	public static void setByte(ItemStack stack, String tag, byte b) {
		getNBT(stack).setByte(tag, b);
	}

	public static void setShort(ItemStack stack, String tag, short s) {
		getNBT(stack).setShort(tag, s);
	}

	public static void setInt(ItemStack stack, String tag, int i) {
		getNBT(stack).setInteger(tag, i);
	}

	public static void setLong(ItemStack stack, String tag, long l) {
		getNBT(stack).setLong(tag, l);
	}

	public static void setFloat(ItemStack stack, String tag, float f) {
		getNBT(stack).setFloat(tag, f);
	}

	public static void setDouble(ItemStack stack, String tag, double d) {
		getNBT(stack).setDouble(tag, d);
	}

	public static void setCompound(ItemStack stack, String tag, NBTTagCompound cmp) {
		if(!tag.equalsIgnoreCase("ench")) // not override the enchantments
			getNBT(stack).setTag(tag, cmp);
	}

	public static void setString(ItemStack stack, String tag, String s) {
		getNBT(stack).setString(tag, s);
	}

	public static void setList(ItemStack stack, String tag, NBTTagList list) {
		getNBT(stack).setTag(tag, list);
	}

	// GETTERS ///////////////////////////////////////////////////////////////////

	public static boolean verifyExistance(ItemStack stack, String tag) {
		return stack != null && getNBT(stack).hasKey(tag);
	}

	public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getBoolean(tag) : defaultExpected;
	}

	public static byte getByte(ItemStack stack, String tag, byte defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getByte(tag) : defaultExpected;
	}

	public static short getShort(ItemStack stack, String tag, short defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getShort(tag) : defaultExpected;
	}

	public static int getInt(ItemStack stack, String tag, int defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getInteger(tag) : defaultExpected;
	}

	public static long getLong(ItemStack stack, String tag, long defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getLong(tag) : defaultExpected;
	}

	public static float getFloat(ItemStack stack, String tag, float defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getFloat(tag) : defaultExpected;
	}

	public static double getDouble(ItemStack stack, String tag, double defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected;
	}

	/** If nullifyOnFail is true it'll return null if it doesn't find any
	 * compounds, otherwise it'll return a new one. **/
	public static NBTTagCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
		return verifyExistance(stack, tag) ? getNBT(stack).getCompoundTag(tag) : nullifyOnFail ? null : new NBTTagCompound();
	}

	public static String getString(ItemStack stack, String tag, String defaultExpected) {
		return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected;
	}

	public static NBTTagList getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) {
		return verifyExistance(stack, tag) ? getNBT(stack).getTagList(tag, objtype) : nullifyOnFail ? null : new NBTTagList();
	}

}


text:
package com.palantir.paxos;

import static com.palantir.paxos.PaxosStateLogMigrator.BATCH_SIZE;
import static com.palantir.paxos.PaxosStateLogTestUtils.NAMESPACE;
import static com.palantir.paxos.PaxosStateLogTestUtils.getPaxosValue;
import static com.palantir.paxos.PaxosStateLogTestUtils.readRoundUnchecked;
import static com.palantir.paxos.PaxosStateLogTestUtils.valueForRound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.palantir.common.streams.KeyedStream;
import java.io.IOException;
import java.util.List;
import java.util.OptionalLong;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.LongStream;
import javax.sql.DataSource;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class PaxosStateLogMigratorTest {
    private static final NamespaceAndUseCase NAMESPACE_AND_USE_CASE =
            ImmutableNamespaceAndUseCase.of(Client.of("client"), "UseCase");

    @Rule
    public TemporaryFolder tempFolder = new TemporaryFolder();

    private PaxosStateLog<PaxosValue> source;
    private PaxosStateLog<PaxosValue> target;
    private SqlitePaxosStateLogMigrationState migrationState;

    @Before
    public void setup() throws IOException {
        DataSource sourceConn = SqliteConnections.getPooledDataSource(
                tempFolder.newFolder("source").toPath());
        DataSource targetConn = SqliteConnections.getPooledDataSource(
                tempFolder.newFolder("target").toPath());
        source = SqlitePaxosStateLog.create(NAMESPACE, sourceConn);
        target = spy(SqlitePaxosStateLog.create(NAMESPACE, targetConn));
        migrationState = SqlitePaxosStateLogMigrationState.create(NAMESPACE, targetConn);
    }

    @Test
    public void emptyLogMigrationSuccessfullyMarksAsMigrated() {
        long cutoff = migrateFrom(source);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(cutoff).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void logMigrationWithNoLowerBoundMigratesForGreatest() {
        long lowerBound = 10;
        long upperBound = 75;
        long expectedCutoff = upperBound - PaxosStateLogMigrator.SAFETY_BUFFER;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long cutoff = migrateFrom(source);

        assertThat(cutoff).isEqualTo(expectedCutoff);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(expectedCutoff);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);

        LongStream.rangeClosed(lowerBound, expectedCutoff - 1)
                .mapToObj(sequence -> readRoundUnchecked(target, sequence))
                .map(Assertions::assertThat)
                .forEach(AbstractAssert::isNull);
        KeyedStream.of(LongStream.rangeClosed(expectedCutoff, upperBound).boxed())
                .map(sequence -> getPaxosValue(target, sequence))
                .mapKeys(PaxosStateLogTestUtils::valueForRound)
                .entries()
                .forEach(entry -> assertThat(entry.getKey()).isEqualTo(entry.getValue()));
    }

    @Test
    public void logMigrationWithLowerBoundMigratesForBound() {
        long lowerBound = 10;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long bound = 60;
        long expectedCutoff = bound - PaxosStateLogMigrator.SAFETY_BUFFER;
        long cutoff = migrateFrom(source, OptionalLong.of(bound));

        assertThat(cutoff).isEqualTo(expectedCutoff);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(expectedCutoff);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);

        LongStream.rangeClosed(lowerBound, expectedCutoff - 1)
                .mapToObj(sequence -> readRoundUnchecked(target, sequence))
                .map(Assertions::assertThat)
                .forEach(AbstractAssert::isNull);
        KeyedStream.of(LongStream.rangeClosed(expectedCutoff, upperBound).boxed())
                .map(sequence -> getPaxosValue(target, sequence))
                .mapKeys(PaxosStateLogTestUtils::valueForRound)
                .entries()
                .forEach(entry -> assertThat(entry.getKey()).isEqualTo(entry.getValue()));
        assertThat(source.getGreatestLogEntry()).isEqualTo(upperBound);
    }

    @Test
    public void stillMigrateWhenValidationIsSkippedButAlsoTruncateSource() {
        long lowerBound = 10;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long bound = 60;
        long expectedCutoff = bound - PaxosStateLogMigrator.SAFETY_BUFFER;
        long cutoff = migrateFrom(source, OptionalLong.of(bound), true);

        assertThat(cutoff).isEqualTo(expectedCutoff);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(expectedCutoff);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);

        LongStream.rangeClosed(lowerBound, expectedCutoff - 1)
                .mapToObj(sequence -> readRoundUnchecked(target, sequence))
                .map(Assertions::assertThat)
                .forEach(AbstractAssert::isNull);
        KeyedStream.of(LongStream.rangeClosed(expectedCutoff, upperBound).boxed())
                .map(sequence -> getPaxosValue(target, sequence))
                .mapKeys(PaxosStateLogTestUtils::valueForRound)
                .entries()
                .forEach(entry -> assertThat(entry.getKey()).isEqualTo(entry.getValue()));
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void whenBoundIsLowMigrateEverything() {
        long lowerBound = 10;
        long upperBound = 75;
        List<PaxosValue> insertedValues = insertValuesWithinBounds(lowerBound, upperBound, source);

        long expectedCutoff = PaxosAcceptor.NO_LOG_ENTRY;
        long cutoff = migrateFrom(source, OptionalLong.of(PaxosStateLogMigrator.SAFETY_BUFFER - 10));

        assertThat(cutoff).isEqualTo(expectedCutoff);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(lowerBound);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);

        insertedValues.forEach(value -> assertThat(value).isEqualTo(getPaxosValue(target, value.seq)));
    }

    @Test
    public void whenBoundIsTooHighMigrateOneEntry() {
        long lowerBound = 10;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long bound = 10_000;
        long cutoff = migrateFrom(source, OptionalLong.of(bound));

        assertThat(cutoff).isEqualTo(upperBound);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(upperBound);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);

        LongStream.rangeClosed(lowerBound, upperBound - 1)
                .mapToObj(sequence -> readRoundUnchecked(target, sequence))
                .map(Assertions::assertThat)
                .forEach(AbstractAssert::isNull);
        assertThat(getPaxosValue(target, upperBound)).isEqualTo(valueForRound(upperBound));
    }

    @Test
    public void migrationDeletesExistingState() {
        long lowerBound = 13;
        long upperBound = 35;
        insertValuesWithinBounds(lowerBound, upperBound, target);

        long cutoff = migrateFrom(source);
        assertThat(cutoff).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
        assertThat(target.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
        verify(target, times(1)).truncate(upperBound);
    }

    @Test
    public void migrateIfInValidationState() {
        long lowerBound = 10;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);
        migrationState.migrateToValidationState();

        long cutoff = migrateFrom(source);
        assertThat(cutoff).isEqualTo(upperBound - PaxosStateLogMigrator.SAFETY_BUFFER);
        assertThat(migrationState.isInMigratedState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(upperBound - PaxosStateLogMigrator.SAFETY_BUFFER);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);
        verify(target, times(1)).truncate(anyLong());
    }

    @Test
    public void doNotMigrateIfAlreadyMigrated() {
        long lowerBound = 5;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long expectedCutoff = upperBound - PaxosStateLogMigrator.SAFETY_BUFFER;
        migrateFrom(source, OptionalLong.empty());
        verify(target, times(1)).writeBatchOfRounds(any(Iterable.class));

        long cutoff = migrateFrom(source, OptionalLong.empty());
        assertThat(cutoff).isEqualTo(expectedCutoff);
        verify(target, times(1)).writeBatchOfRounds(any(Iterable.class));
    }

    @Test
    public void doNotMigrateIfAlreadyMigratedWithSpecifiedBound() {
        long lowerBound = 5;
        long upperBound = 75;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        long bound = 60;
        long expectedCutoff = bound - PaxosStateLogMigrator.SAFETY_BUFFER;
        migrateFrom(source, OptionalLong.of(bound));
        verify(target, times(1)).writeBatchOfRounds(any(Iterable.class));

        long cutoff = migrateFrom(source, OptionalLong.of(bound));
        assertThat(cutoff).isEqualTo(expectedCutoff);
        verify(target, times(1)).writeBatchOfRounds(any(Iterable.class));
    }

    @Test
    public void logMigrationSuccessfullyMigratesManyEntriesInBatches() throws IOException {
        long lowerBound = 10;
        long upperBound = lowerBound + BATCH_SIZE * 10;

        PaxosStateLog<PaxosValue> mockLog = mock(PaxosStateLog.class);

        when(mockLog.getLeastLogEntry()).thenReturn(lowerBound);
        when(mockLog.getGreatestLogEntry()).thenReturn(upperBound);
        when(mockLog.readRound(anyLong())).thenAnswer(invocation -> {
            long sequence = (long) invocation.getArguments()[0];
            if (sequence > upperBound || sequence < lowerBound) {
                return null;
            }
            return valueForRound(sequence).persistToBytes();
        });

        migrateFrom(mockLog, OptionalLong.of(lowerBound));
        assertThat(migrationState.hasMigratedFromInitialState()).isTrue();
        assertThat(target.getLeastLogEntry()).isEqualTo(lowerBound);
        assertThat(target.getGreatestLogEntry()).isEqualTo(upperBound);
        verify(target, times(11)).writeBatchOfRounds(anyList());

        for (long counter = lowerBound; counter <= upperBound; counter += BATCH_SIZE) {
            assertThat(readRoundUnchecked(target, counter))
                    .containsExactly(valueForRound(counter).persistToBytes());
        }
    }

    @Test
    public void retryWritesFiveTimes() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        PaxosStateLog<PaxosValue> targetMock = mock(PaxosStateLog.class);
        AtomicInteger failureCount = new AtomicInteger(0);
        doAnswer(invocation -> {
                    if (failureCount.getAndIncrement() < 5) {
                        throw new RuntimeException();
                    }
                    return null;
                })
                .when(targetMock)
                .writeBatchOfRounds(any());

        ImmutableMigrationContext<PaxosValue> context = ImmutableMigrationContext.<PaxosValue>builder()
                .sourceLog(source)
                .destinationLog(targetMock)
                .hydrator(PaxosValue.BYTES_HYDRATOR)
                .migrationState(migrationState)
                .migrateFrom(lowerBound)
                .namespaceAndUseCase(NAMESPACE_AND_USE_CASE)
                .skipValidationAndTruncateSourceIfMigrated(false)
                .build();

        assertThatCode(() -> PaxosStateLogMigrator.migrateAndReturnCutoff(context))
                .doesNotThrowAnyException();
    }

    @Test
    public void eventuallyStopRetrying() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        PaxosStateLog<PaxosValue> targetMock = mock(PaxosStateLog.class);
        Exception expectedException = new RuntimeException("We failed");
        doThrow(expectedException).when(targetMock).writeBatchOfRounds(any());

        ImmutableMigrationContext<PaxosValue> context = ImmutableMigrationContext.<PaxosValue>builder()
                .sourceLog(source)
                .destinationLog(targetMock)
                .hydrator(PaxosValue.BYTES_HYDRATOR)
                .migrationState(migrationState)
                .migrateFrom(lowerBound)
                .namespaceAndUseCase(NAMESPACE_AND_USE_CASE)
                .skipValidationAndTruncateSourceIfMigrated(false)
                .build();

        assertThatThrownBy(() -> PaxosStateLogMigrator.migrateAndReturnCutoff(context))
                .isEqualTo(expectedException);
    }

    @Test
    public void failWhenAlreadyMigratedButSourceAdvancedChangingCutoff() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 50, upperBound + 50, source);
        insertValuesWithinBounds(upperBound + 50, upperBound + 50, target);
        assertThatThrownBy(() -> migrateFrom(source, OptionalLong.empty())).isInstanceOf(IllegalStateException.class);
    }

    @Test
    public void failWhenAlreadyMigratedButSourceAdvancedWithoutChangingCutoffAndEntriesDoNotMatch() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 1, upperBound + 1, source);
        target.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        assertThatThrownBy(() -> migrateFrom(source, OptionalLong.empty())).isInstanceOf(IllegalStateException.class);
    }

    @Test
    public void failWhenAlreadyMigratedButSourceAdvancedWithoutChangingCutoffAndNoEntryInTarget() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 1, upperBound + 1, source);
        assertThatThrownBy(() -> migrateFrom(source, OptionalLong.empty())).isInstanceOf(IllegalStateException.class);
    }

    @Test
    public void failWhenAlreadyMigratedButSourceAdvancedAndEntriesDoNotMatchWhenSpecifyingLowerBound() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.of(150));

        source.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        insertValuesWithinBounds(upperBound + 1, upperBound + 100, target);
        assertThatThrownBy(() -> migrateFrom(source, OptionalLong.of(150))).isInstanceOf(IllegalStateException.class);
    }

    @Test
    public void failWhenAlreadyMigratedButSourceAdvancedAndNoEntryInTargetWhenSpecifyingLowerBound() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.of(150));

        source.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        insertValuesWithinBounds(upperBound + 2, upperBound + 100, target);
        assertThatThrownBy(() -> migrateFrom(source, OptionalLong.of(150))).isInstanceOf(IllegalStateException.class);
    }

    @Test
    public void doNotFailWhenAlreadyMigratedAndSourceTruncatedPartially() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        source.truncate(250 - 10);
        assertThatCode(() -> migrateFrom(source, OptionalLong.empty())).doesNotThrowAnyException();
    }

    @Test
    public void doNotFailWhenAlreadyMigratedAndMigrateFromIncreasesButGreatestEntryIsMigrated() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.of(220));

        assertThatCode(() -> migrateFrom(source, OptionalLong.of(300))).doesNotThrowAnyException();
    }

    @Test
    public void doNotFailWhenAlreadyMigratedAndSourceTruncatedFully() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        source.truncate(250);
        assertThatCode(() -> migrateFrom(source, OptionalLong.empty())).doesNotThrowAnyException();
    }

    @Test
    public void doNotFailWhenSourceAdvancedChangingCutoffOnSkippingValidation() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 50, upperBound + 50, source);
        insertValuesWithinBounds(upperBound + 50, upperBound + 50, target);
        assertThatCode(() -> migrateFrom(source, OptionalLong.empty(), true)).doesNotThrowAnyException();
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void doNotFailWhenSourceAdvancedWithoutChangingCutoffAndEntriesDoNotMatchOnSkippingValidation() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 1, upperBound + 1, source);
        target.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        assertThatCode(() -> migrateFrom(source, OptionalLong.empty(), true)).doesNotThrowAnyException();
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void doNotFailWhenSourceAdvancedWithoutChangingCutoffAndNoEntryInTargetOnSkippingValidation() {
        long lowerBound = 10;
        long upperBound = 25;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.empty());

        insertValuesWithinBounds(upperBound + 1, upperBound + 1, source);
        assertThatCode(() -> migrateFrom(source, OptionalLong.empty(), true)).doesNotThrowAnyException();
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void doNotFailWhenSourceAdvancedAndEntriesDoNotMatchWhenSpecifyingLowerBoundOnSkippingValidation() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.of(150));

        source.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        insertValuesWithinBounds(upperBound + 1, upperBound + 100, target);
        assertThatCode(() -> migrateFrom(source, OptionalLong.of(150), true)).doesNotThrowAnyException();
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    @Test
    public void doNotFailWhenSourceAdvancedAndNoEntryInTargetWhenSpecifyingLowerBoundOnSkippingValidation() {
        long lowerBound = 10;
        long upperBound = 250;
        insertValuesWithinBounds(lowerBound, upperBound, source);

        migrateFrom(source, OptionalLong.of(150));

        source.writeRound(upperBound + 1, PaxosStateLogTestUtils.valueForRound(upperBound + 2));
        insertValuesWithinBounds(upperBound + 2, upperBound + 100, target);
        assertThatCode(() -> migrateFrom(source, OptionalLong.of(150), true)).doesNotThrowAnyException();
        assertThat(source.getGreatestLogEntry()).isEqualTo(PaxosAcceptor.NO_LOG_ENTRY);
    }

    private long migrateFrom(PaxosStateLog<PaxosValue> sourceLog) {
        return migrateFrom(sourceLog, OptionalLong.empty());
    }

    private long migrateFrom(PaxosStateLog<PaxosValue> sourceLog, OptionalLong lowerBound) {
        return migrateFrom(sourceLog, lowerBound, false);
    }

    private long migrateFrom(PaxosStateLog<PaxosValue> sourceLog, OptionalLong lowerBound, boolean skipValidation) {
        return PaxosStateLogMigrator.migrateAndReturnCutoff(ImmutableMigrationContext.<PaxosValue>builder()
                .sourceLog(sourceLog)
                .destinationLog(target)
                .hydrator(PaxosValue.BYTES_HYDRATOR)
                .migrationState(migrationState)
                .migrateFrom(lowerBound)
                .namespaceAndUseCase(NAMESPACE_AND_USE_CASE)
                .skipValidationAndTruncateSourceIfMigrated(skipValidation)
                .build());
    }

    private List<PaxosValue> insertValuesWithinBounds(long from, long to, PaxosStateLog<PaxosValue> targetLog) {
        List<PaxosValue> valuesWritten = LongStream.rangeClosed(from, to)
                .mapToObj(PaxosStateLogTestUtils::valueForRound)
                .collect(Collectors.toList());
        valuesWritten.forEach(value -> targetLog.writeRound(value.seq, value));
        return valuesWritten;
    }
}


text:
class CreateDimensions < ActiveRecord::Migration
  def self.up
    create_table :dimensions do |t|
      t.string :name
      t.integer :height
      t.integer :width
      t.float :aspect
      t.boolean :crop
      t.boolean :resize

      t.timestamps
    end
  end

  def self.down
    drop_table :dimensions
  end
end


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

    <title>Dynamics of Structures</title>
    <meta http-equiv="content-type" content="text/html;charset=latin-1"></>
     <link rel="stylesheet" href="../css/3.13.css" type="text/css"></link>

Dynamics of Structures

2020-04-17

Today the lesson is divided in two parts.

Earthquake Excitation

            After a visual introduction to the variety of different
            earthquake excitations, we define the response spectrum in
            terms of peak deformation as a function of SDOF
            characteristics.

 Pseudo spectra (velocity and accelerations) simply
            replicate the information in the deformation response
            spectrum, but are convenient as they directly relate to
            different aspects of structural response.

 From statistical analysis it is possible to infer
          some common characteristics of response spectra and develop
          an idealized model of a consistent set of response spectra
          in terms of simple parameters of the ground motion.

 Design spectra are envelopes ()  of spectral
          response ordinates.

            Structures designed to remain elastic during a large
            earthquake are antieconomical, it is custumary to design
            for reduced lateral forces, accepting a controlled level
            of damage during a large earthquake.

A commonly used idealization of complex
          force-displacement relationships is the elastic-perfectly
          plastic model.

For a given excitation we compute the ductility
              ratio (e-p peak displacement over yield
            displacement) as a function of the normalized yield force:
            the ductility is a measure of the structure excursion into
            plastic range, and indirectly of structural damage.

Reversing the reasoning and the line of flow of the
            computation, we need to know the normalized yield force
            that give rise to a ductility demand that is deemed
            acceptable for a particular class of structures.

From the normalized yield force we derive the yield
            displacement (simply dividing by k) and repeating
            the procedure for different levels of ductility demand it
            is possible to construct a yield displacement response
            spectrum.

Finally it is possible to introduce an inelastic
            design spectrum using a mean value of the rduction factor,
            different for different vibration period ranges.

            Material available for the lesson:

the slides for the first
              part and

the slides for the second one

a ready to print version of the
                  first slides (due to an excess of slides
                  superposition, the ready to print pdf has some
                  broken pages, please compare with the slides).

a ready to print version of the
                  second slides.

            2020-04-12
            Home
            Summer 2020

      <address>
        Giacomo Boffi
      </address>


text:
#ifndef AGUI_HSCROLLBAR_LISTENER_HPP
#define AGUI_HSCROLLBAR_LISTENER_HPP
#include "Agui/Platform.hpp"
namespace agui {
	class AGUI_CORE_DECLSPEC HScrollBar;
	/**
     * Abstract class for Horizontal Scrollbar Listeners.
	 *
	 * Any derived Horizontal Scrollbar Listeners should inherit from this class.
	 *
	 * Must implement:
	 *
	 * valueChanged
     * @author Joshua Larouche
     * @since 0.1.0
     */
	class AGUI_CORE_DECLSPEC HScrollBarListener
	{
	public:
		HScrollBarListener(void);
		virtual void valueChanged(HScrollBar* source, int val) = 0;
		virtual void minValueChanged(HScrollBar*, int) {}
		virtual void maxValueChanged(HScrollBar*, int) {}
		virtual void arrowWidthChanged(HScrollBar*, int) {}
		virtual void largeAmountChanged(HScrollBar*, int) {}
		virtual void leftAmountChanged(HScrollBar*, int) {}
		virtual void rightAmountChanged(HScrollBar*, int) {}
		virtual void minThumbWidthChanged(HScrollBar*, int) {}
		virtual void death(HScrollBar*) {}

		virtual ~HScrollBarListener(void);
	};
}
#endif


text:
package uk.theretiredprogrammer.authentication;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.annotation.WebServlet;
import uk.theretiredprogrammer.jeelibrary.GetAllServlet;

/**
 * Servlet to handle request to get all Application entities.
 *
 * (Class generated by NetBeans Platform Code Generator tools using script.xml.
 * Do not edit this file. Apply any changes to the definition file and
 * regenerate all files.)
 *
 * @author Richard Linsdale (richard at theretiredprogrammer.uk)
 */
@WebServlet("/Role/getall")
public class RoleGetAllServlet extends GetAllServlet<Role> {

    @PersistenceContext(unitName = "authentication2_PU")
    private EntityManager em;

    /**
     * Constructor
     */
    public RoleGetAllServlet() {
        super("Role");
    }

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    @Override
    public String getServletInfo() {
        return "authentication/Role/getall Servlet";
    }
}


text:
package cmd

import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/urfave/cli"
)

func SetConfig(c *cli.Context) error {

	if c.NArg() < 2 {
		return cli.NewExitError("Must supply a key and a value to set it to", 1)
	} else if c.NArg()%2 != 0 {
		return cli.NewExitError("Must supply a list of key-value pairs", 1)
	}

	patchData := map[string]interface{}{}
	conf := json.RawMessage{}

	for i := 0; i < c.NArg(); i += 2 {

		key := c.Args().Get(i)
		value := []byte(c.Args().Get(i + 1))

		var unmarshaledValue interface{}

		if err := json.Unmarshal(value, &unmarshaledValue); err != nil {
			unmarshaledValue = c.Args().Get(i + 1)
		}
		patchData[key] = unmarshaledValue

	}

	if err := patch(c, "config", &patchData, &conf); err != nil {
		return cli.NewExitError("Error from server: "+err.Error(), 1)
	}

	indentedJSON := bytes.NewBuffer(nil)
	if err := json.Indent(indentedJSON, []byte(conf), "", "  "); err != nil {
		return cli.NewExitError(err.Error(), 1)
	}

	fmt.Println(indentedJSON)

	return nil

}

func GetConfig(c *cli.Context) error {

	if c.Args().First() == "" {
		// get the full configuration.
		return getFullConfig(c)
	} else {
		return getSingleConfig(c)
	}

}

func getFullConfig(c *cli.Context) error {

	conf := json.RawMessage{}
	if err := get(c, "config", &conf); err != nil {
		return cli.NewExitError(err.Error(), 1)
	}

	result := bytes.NewBuffer(nil)
	if err := json.Indent(result, []byte(conf), "", "  "); err != nil {
		return cli.NewExitError(err.Error(), 1)
	}

	fmt.Println(result)

	return nil

}

func getSingleConfig(c *cli.Context) error {

	requestedVar := c.Args().First()

	conf := map[string]json.RawMessage{}
	if err := get(c, "config", &conf); err != nil {
		return cli.NewExitError(err.Error(), 1)
	}

	val, ok := conf[requestedVar]
	if !ok {
		return cli.NewExitError("No such configuration variable: "+requestedVar, 1)
	}

	fmt.Println(string(val))
	return nil

}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
	<string name="back_button_label">Back</string>
	<string name="skip_button_label">Skip</string>
	<string name="next_button_label">Next</string>
	<string name="loading">Loading\u2026</string>
	<string name="capital_on">ON</string>
	<string name="capital_off">OFF</string>
	<string name="candidates_style"><u>candidates</u></string>
	<string name="number_picker_increment_scroll_mode"><xliff:g id="value" example="3">%s</xliff:g> tap and hold.</string>
	<string name="number_picker_increment_scroll_action">Slide up to increment and down to decrement.</string>
	<string name="number_picker_increment_button">Increment</string>
	<string name="number_picker_decrement_button">Decrement</string>
	<string name="time_picker_dialog_title">Set time</string>
	<string name="time_picker_increment_minute_button">Increment minute</string>
	<string name="time_picker_decrement_minute_button">Decrement minute</string>
	<string name="time_picker_increment_hour_button">Increment hour</string>
	<string name="time_picker_decrement_hour_button">Decrement hour</string>
	<string name="time_picker_increment_set_pm_button">Set PM</string>
	<string name="time_picker_decrement_set_am_button">Set AM</string>
	<string name="time_picker_separator">:</string>
	<string name="date_picker_dialog_title">Set date</string>
	<string name="date_picker_increment_day_button">Increase day</string>
	<string name="date_picker_decrement_day_button">Decrease day</string>
	<string name="date_picker_increment_month_button">Increase month</string>
	<string name="date_picker_decrement_month_button">Decrease month</string>
	<string name="date_picker_increment_year_button">Increase year</string>
	<string name="date_picker_decrement_year_button">Decrease year</string>
	<string name="date_time_done">Done</string>
	<string name="date_time_set">Set</string>
	<string name="ringtone_picker_title">Ringtones</string>
	<string name="ringtone_default">Default ringtone</string>
	<string name="ringtone_silent">Silent</string>
</resources>


text:
/*
    good: #0084DB
    bad: #9C1200;
    light good: #B2E0FF

    action/link: #325385;
    action/link hover: #4F83D1;
    action/link active: #8EA9D1;

    header bar: #516685;
    header bar active: #607d9a;
    header bar secondary: #8090A8;
    header bar tertiary: #C1CEE0;

    zebra stripe bg: #F0F3F7;

 */

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto-regular-webfont.eot');
    src: url('../fonts/roboto-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/roboto-regular-webfont.woff') format('woff'),
         url('../fonts/roboto-regular-webfont.ttf') format('truetype'),
         url('../fonts/roboto-regular-webfont.svg#Roboto') format('svg');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto-bold-webfont.eot');
    src: url('../fonts/roboto-bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/roboto-bold-webfont.woff') format('woff'),
         url('../fonts/roboto-bold-webfont.ttf') format('truetype'),
         url('../fonts/roboto-bold-webfont.svg#Roboto') format('svg');
    font-weight: bold;
    font-style: normal;
}

/* disable breakpoints */
@media (min-width: 768px) {
  .container {
    width: 1170px;
  }
}
@media (min-width: 992px) {
  .container {
    width: 1170px;
  }
}

html, body, .container { height: 100%; }

body {
    padding: 20px;
    color: #666;
    font-family: "Roboto";
}

textarea {
    width: 100%;
    padding: 5px 10px;
}

.invisible {
    visibility: hidden;
}

a, .btn-link {
    text-decoration: none;
    color: #404040;
    cursor: pointer;
}
a:hover, a:active, a:focus,
.btn-link:hover, .btn-link:active, .btn-link:focus {
    color: #404040;
    text-decoration: none;
    outline: 0;
}

.link {
    cursor: pointer;
    color: #325385;
    font-weight: bold;
}

.link:hover {
    color: #4F83D1;
}
.link:active {
    color: #8EA9D1;
}

.action {
    font-weight: bold;
    cursor: pointer;
    color: #325385;
    text-decoration: none;
    padding-top: 0;
    padding-left: 0;
}
.action:hover {
    color: #4F83D1;
}
.action:active {
    color: #8EA9D1;
}
.action[disabled="disabled"],
.action.disabled {
    text-decoration: none;
    color: #777 !important;
}

.inline-code {
    font-family: monospace;
    color: #888;
    font-size: 0.85em;
}

table > thead {
    background-color: #516685;
    color: #ffffff;
}

table > thead.light {
    background-color: white;
    color: #999;
}

.table {
    margin-bottom: 10px;
    /* tables usually have headings and/or actions
        which are floated and must be cleared */
    clear: both;
}

.table-bordered > thead > tr > th {
    border: 0px;
}

.table > tbody > tr:hover > td {
    background-color: #F0F3F7;
}

.table-bordered {
    border-left: 0px;
    border-top: 0px;
}

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    border-bottom: solid 1px #DCE1E8;
}

.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
    background-color: #ddffdd;
}

.toggle .btn.active {
    padding-right: 10px;
}
table .btn,
.toggle .btn {
    border-radius: 15px;
    line-height: .8;
    font-size: 12px;
    font-weight: bold;
}

.toggle.btn-group .btn + .btn,
.toggle.btn-group .btn + .btn-group,
.toggle.btn-group .btn-group + .btn,
.toggle.btn-group .btn-group + .btn-group {
    margin-left: -11px;
}

.toggle.btn-group > .btn.off:last-child:not(:first-child) {
    border-bottom-left-radius: 15px;
    border-top-left-radius: 15px;
    border-color: #3C91C9;
    padding-right: 20px;
    z-index:3;
}

.toggle.btn-group > .btn.active:last-child:not(:first-child) {
    padding-left: 15px;
}

.toggle.btn-group > .btn.off:first-child:not(:last-child):not(.dropdown-toggle) {
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    border-color: #999;
    padding-right: 20px;
    z-index:3;
}

.toggle.btn-group > .btn.active:first-child:not(:last-child):not(.dropdown-toggle) {
    padding-right: 15px;
}

.toggle.btn-group .btn-danger {
    background-color: #999;
    border-color: #999;
}
.toggle.btn-group .btn-success {
    background-color: #3C91C9;
    border-color: #3C91C9;
}

.btn-group > .btn > input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: radio-label;
}

.table-bordered.side-flush > thead > tr > th,
.table-bordered.side-flush > tbody > tr > th,
.table-bordered.side-flush > tfoot > tr > th,
.table-bordered.side-flush > thead > tr > td,
.table-bordered.side-flush > tbody > tr > td,
.table-bordered.side-flush > tfoot > tr > td {
    border-left: 0px;
}

.navbar-zen {
    background-color: #6b6b6b;
    color: #f6f6f6;
}
.navbar-secondary {
    height: 30px;
    background-color: #f5f5f5;
    margin-left: 15px;
}

.navbar-zen .main-nav button,
.navbar-zen .main-nav a {
    padding: 15px;
    margin: 0px;
    border: 0px;
    color: #CCC;
    font-weight: bold;
    text-shadow: 1px 1px 2px #414141;
}

.navbar-zen .main-nav a.glyphicon {
    top: 0px;
}

.navbar-zen .main-nav li.active > button,
.navbar-zen .main-nav li.active > a {
    color: #F6F6F6;
    background-color: #515151;
}

.navbar-zen .main-nav a.navbar-brand:hover,
.navbar-zen .main-nav li > button:hover,
.navbar-zen .main-nav li > a:hover,
.navbar-zen .main-nav li > a:focus {
    background-color: #969696;
    color: #f6f6f6;
}

.navbar-brand {
    width: 153px;
    background-color: #516685;
    border-right: solid white 4px;
}
.navbar-brand .logoType {
    position: absolute;
    top: 7px;
    left: 48px;
}
.navbar-brand .logoCircle{
    background-color: white;
    border-radius: 100px;
    border: solid 4px #516685;
    position: absolute;
    top: -8px;
    left: -24px;
    z-index: 1000;
}

.navbar-zen .main-nav .navbar-right button{
    font-weight: normal;
    color: #EEE;
    font-size: .9em;
    line-height: 1.6em;
}

.navbar-zen .main-nav .navbar-right .vr{
    font-weight: normal;
    color: #888;
    font-size: .9em;
    line-height: 1.6em;
    padding: 15px 4px;
}

.nav > li > .item {
    position: relative;
    display: block;
    padding: 15px 15px;
}

.navbar-inverse li .item {
    color: #999;
}

.navbar {
    margin: 10px 0 30px 0;
    border-radius: 0;
    border: 0;
}

.item > i {
    margin: 0px 5px;
    color: #4d4d4d;
    text-shadow: -1px -1px 0px #414141;
}

.navbar-nav > li.item {
    padding: 10px;
    line-height: 20px;
    text-shadow: 1px 1px 2px #414141;
}

@media (min-width: 768px) {
    .navbar-nav > li.item {
        padding: 15px;
    }
}

@media screen and (min-width: 1024px) {
    .big.modal-dialog,
    .wizard.modal-dialog {
        width: 1024px;
    }
    .big textarea {
        width: 960px;
        min-height: 500px
    }
}

.btn-primary{
    background-color: #325385;
    border-color: #555;
}
.btn-primary[disabled],
.btn-primary[disabled]:hover{
    opacity: 0.65;
    background-color: #6b6b6b;
    border-color: #555;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.open .dropdown-toggle.btn-primary {
    border-color: #0084DB;
    background-color: #4F83D1;
}

.details {
    background-color: #f5f5f5;
}

.breadcrumb {
    margin: 0px 15px;
    padding: 8px 0px;
    border-radius: 0;
}
.breadcrumb.bordered {
    border-bottom: 1px solid #d0d0d0;
}
.breadcrumb.inline > li + li:before {
    padding: 0 5px;
    color: #cccccc;
    content: "\00a0/"; /* reverse order of space and separator */
}
.breadcrumb .crumb {
    color: #AAA;
}
.breadcrumb .crumb:hover {
    color: #666;
}
.breadcrumb .crumb.current {
    font-weight: bold;
    color: #666;
}

.highlighted {
    background-color: #d0d0d0;
    font-weight: bold
}

.box {
    padding: 40px 50px;
    background-color: #eeeeee;
    border-radius: 6px;
}
.page-nav {
    padding-top: 40px;
}
.sort.active {
    color: white !important;
}
.sort:hover {
    color: #DDD !important;
}
.sort {
    color: #8197B8 !important;
}
.form-signin {
    width: 500px;
    margin: 60px auto 0;
    padding: 61px;
    background-color: white;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0px 0px 8px rgba(0,0,0,.4);
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
    margin-bottom: 10px;
}

.form-signin .checkbox {
    font-weight: normal;
}
.form-signin .form-control {
    position: relative;
    font-size: 16px;
    height: auto;
    padding: 10px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.form-signin .form-control:focus {
    z-index: 2;
}
.form-signin input[type="text"] {
    margin-bottom: -1px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.form-signin input[type="password"] {
    margin-bottom: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.login-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("../img/theMcKrakenBG1.png") #516685;
}
.nav-tree {
    list-style: none;
    padding: 0px 0px 0px 20px;
}

.nav-tree > li {
    display: block;
    padding: 6px;
}

.nav-tree > li.current {
    background-color: #a8bcd9;
    color: #ffffff;
}

.nav-tree > li.active,
.nav-tree > li:hover {
    background-color: #b8cce9;
}

.extended {
    visibility: hidden;
}
li:hover > .extended {
    visibility: inherit;
}
li.current > .extended {
    visibility: inherit;
}
.tempvis.extended {
    visibility: inherit;
}

.nav-tree.root {
    padding: 0px;
}

.sidebar-nav > h4 .btn-link {
    text-decoration: none;
    padding: 6px;
}
.sidebar-nav > h4 a:hover,
.sidebar-nav > h4 a:focus,
.sidebar-nav > h4 .btn-link:hover {
    text-decoration: none;
    cursor: pointer;
}

td.deploy-success {
    color: #0084DB;
}
td.deploy-error {
    color: #9C1200;
}
td.deploy-info {
    color: #3a87ad;
}
td.deploy-warning {
    color: #c09853;
}

.details > .details-control {
    padding: 5px;
}
.details > .details-actions {
    padding: 0px 15px 8px 15px;
}

.add-control {
    padding: 2px 5px;
    font-size: 14px;
    line-height: 1.7;
    display: inline-block;
    background-color: #e1e1e1;
    border-radius: 6px;
    vertical-align: top;
}

.add-control:hover {
    background-color: #f0f0f0;
}

.add-control > .btn-link {
    color: #404040;
    padding: 0;
    line-height: 1;
}

.deployed.alert {
    font-weight: bold;
}

.deployed.alert > a {
    text-decoration: underline;
}

li.active > .pool-data {
    background-color: #eeeeee;
}

.sidebar-nav.flow {
    padding-left: 0;
    padding-right: 0;
}

.sidebar-nav > div {
    padding: 7px 15px;
}

.sidebar-nav > .top-info {
    background-color: #8090A8;
    color: #ffffff;
    font-weight: bold;
}

.sidebar-nav .btn-link,
.sidebar-nav a {
    color: #4c6c99;
    font-weight: bold;
}

.sidebar-nav .current a.main {
    color: #ffffff;
}

.nav-tree > li .pool-data:hover,
.nav-tree > li .pool-data:focus {
     background-color: #a7bbd9;
}

.sidebar-nav a.main:hover,
.sidebar-nav a.main:focus {
    text-decoration: none;
    cursor: pointer;
    color: #ffffff;
}

.sidebar-nav > .top-head a,
.sidebar-nav > .top-head .btn-link {
    color: #595959;
}

.sidebar-nav > .top-head:hover {
    background-color: #b8cce9;
}

.sidebar-nav > .top-head a:hover,
.sidebar-nav > .top-head .btn-link:hover {
    color: #ffffff;
}

.dropdown-menu > li > a {
    display: block;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    text-decoration: none;
    cursor: pointer;
    background-color: #c0c0c0;
}

.glyphicon.spacer:before {
    content: "\00a0";
}
.disabled {
    opacity: 0.65;
}

div.side-flush {
    padding-left: 0px;
    padding-right: 0px;
}

div.top-bar {
    margin: 0px;
    background-color: #516685;
    color: #d7e0ed;
    padding: 4px;
}

.top-bar .nav-link {
    font-size: 16px;
    font-weight: bold;
    color: #d7e0ed;
    padding: 0px 10px;
}
.top-bar .nav-link.active,
.top-bar label.active {
    font-size: 16px;
    padding: 0px 10px;
    margin: 2px 0 3px 0;
    background-color: #C1CEE0;
    color: #325385;
    border-radius: 10px;
    -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

.deployed.alert {
    margin-bottom: 0;
}

input.search {
    font-size: 14px;
    border-radius: 15px;
    height: 27px;
    /*line-height: 1.0;*/
}

input.instances {
    width: 70px;
}
input.startup {
    width: 320px;
}

.search-control label {
    margin: 0px;
}

.details-control .alert,
.search-control .alert {
    padding: 2px 5px;
    font-size: 14px;
    display: inline-block;
    vertical-align: top;
    margin: 0px 10px;
}

.close {
    font-size: 16px;
    line-height: 1.2;
    margin-left: 10px;
}

.search.form-control {
    display: inline-block;
    width: auto;
    vertical-align: bottom;
}

.vertical-info {
    flex: 1 0 auto;
    display: inline-block;
    vertical-align: top;
    border-right: solid 1px #EEE;
    margin-right: 7px;
}
.vertical-info:last-of-type {
    border: none;
}
.vertical-info > label {
    display: block;
    margin-bottom: 0;
    font-size: 0.9em;
}

.wizard ol {
    list-style: none;
    padding: 0px;
}

.wizard li > label {
    display: block;
    font-size: 20px;
    position: relative;
    left: -25px;
    color: #4c6c99;
}

.wizard li > label:before {
    position: relative;
    top: 1px;
    display: inline-block;
    font-family: 'Glyphicons Halflings';
    -webkit-font-smoothing: antialiased;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    padding-right: 5px;
    content: "\00a0";
}

.wizard li.current {
    background-color: #a8bcd9;
    color: #ffffff;
}
.close {
    opacity: 0.4;
}

.wizard li.inactive {
    opacity: 0.4;
}

.wizard li > label.done:before {
    color: #468847;
    content: "\e013";
}

.wizard li {
    padding: 10px 30px;
}

.wizard .block-data {
    padding: 6px 0px;
    display: block;
}

.indented {
    margin-left: 20px;
}
.indent0 {
    margin-left: 0;
}
.indent1 {
    margin-left: 20px;
}
.indent2 {
    margin-left: 40px;
}
.indent3 {
    margin-left: 60px;
}
.indent4 {
    margin-left: 80px;
}
.indent5 {
    margin-left: 100px;
}
.indent6 {
    margin-left: 120px;
}
.indent7 {
    margin-left: 140px;
}
.indent8 {
    margin-left: 160px;
}
.indent9 {
    margin-left: 180px;
}
.indent10 {
    margin-left: 200px;
}

.wizard .modal-body {
    padding: 0px 20px 0px 15px;
}

.modal-header {
    background-color: #a0a0a0;
    border-bottom: 1px solid black;
    padding: 5px;
}

.modal-title {
    margin-left: 10px;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #c0c0c0;
    color: #1a1a1a;
}
.modal-notify {
    position: relative;
}

.flow {
    background-color: #F0F3F7;
    min-height: 600px;
    border-right: 1px solid #949494;
}
.wizard .flow {
    padding: 0px;
}

.wizard .scroll {
    height: 550px;
    overflow-y: auto;
}

.wizard .content {
    border-left: 1px solid black;
    background-color: #ffffff;
    min-height: 600px;
}

.wizard .content > .scroll {
    padding-top: 20px;
}

.rotate-down {
    transform: rotate(90deg);
    writing-mode: lr-tb;
}

.medChart{
    position: relative;
    height: 200px;
}

.noData {
  margin: auto;
  top: 40px;
  color: #AAA;
  text-align: center;
  font-size: 1.2em;
  font-style: italic;
}

/* Visualization.js style changes */
/* d3 related below */

.node {
  border: solid 1px white;
  font: 10px sans-serif;
  line-height: 12px;
  position: absolute;
  text-indent: 2px;
}

.treemap {
    position: relative;

}

/* dagre-d3 related below  */

.last_update {
    font-size: 0.9em;
    color: #CCC;
    text-align: right;
}
.last_update strong {
    font-weight: bold;
    color: #888;
}

.control-buttons {
    margin-top: 20px;
}
.control-buttons.pull-right {
    margin-left: 10px;
}

/* health and status popover content */
.popover{
    max-width: none;
    line-height: 1.5;
}

.popover table{
    white-space: nowrap;
}
.popover .healthTooltipDetailRow {
    position: relative;
    font-size: 12px;
    white-space: nowrap;
}
.popover .healthTooltipDetailRow .healthTooltipDetailName {
    display: inline-block;
}
.popover .healthTooltipDetailRow .healthIcon {
    top: 1px;
    font-size: 15px;
}
.popover .healthTooltipDetailRow .healthTooltipDetailName {
    padding-left: 18px;
}

.popover .emergencyTooltip {
    color: #9c1200;
    font-size: 0.9em;
    text-align: center;
}

.popover .emergencyTooltip h3 {
    margin-top: 3px;
    margin-bottom: 3px;
    font-size: 1.1em;
    font-weight: bold;
}

.popover .emergencyTooltip a.btn {
    margin-top: 8px;
    padding: 5px 15px 8px 8px;
    border-radius: 6px;
}

.popover .emergencyTooltip a.btn .glyphicon {
    padding: 0 3px;
}

.chartContainer {
  position: relative;
}

.nvtooltip h3{
    font-size: 12px;
}

.nvtooltip p{
    font-weight: bold;
}

/* bootstrap override */
.bg-primary{
    background-color: #6b6b6b;
}

.btn-link {
    font-weight: bold;
    color: #325385;
}
.btn-link:hover {
    color: #4F83D1;
}
.btn-link.minor {
    color: #888;
}

.btn-danger {
    background-color: #9C1200;
    border-color: #9C1200;
}

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    padding: 5px 10px;
    vertical-align: middle;
}

.clickable {
    cursor: pointer;
}

.navbar-nav > li:last-child > button{
    padding-right: 15px;
}

.navWrapper {
    position: relative;
}

/* lock icon ends up being a butterfly without this :/ */
.glyphicon-lock:before {
    content: "\1f512" !important;
}

/* force stuff to stay 1140px or wider */
.table,
.details,
.navbar-zen,
.infoWrapper {
    min-width: 1140px;
}

/* speed up bootstrap modals */
.fade {
   opacity: 0;
   -webkit-transition: opacity .15s ease-out;
      -moz-transition: opacity .15s ease-out;
       -ms-transition: opacity .15s ease-out;
        -o-transition: opacity .15s ease-out;
           transition: opacity .15s ease-out;
 }
 .modal.fade .modal-dialog {
  -webkit-transition: -webkit-transform .15s ease-out;
     -moz-transition:    -moz-transform .15s ease-out;
       -o-transition:      -o-transform .15s ease-out;
          transition:         transform .15s ease-out;
}
/* make modal content scroll when too tall */
.modal-body {
    max-height: 600px;
    overflow-y: auto;
}
.modal {
    overflow: auto;
}
/* make modal submit button resize nicely */
.modal .submit {
    -webkit-transition: width 0.5s;
    -moz-transition: width 0.5s;
    transition: width 0.5s;
    /* set min width to avoid funky size transitions
     * when text content changes to "Submitting..." */
    min-width: 110px;
}
.modal .modal-footer .glyphicon {
    top: 2px;
}
.modal .modal-footer .btn-primary .glyphicon {
    padding-right: 8px;
}

/* notifications */

/* this is the main notification holder */
#notifications {
    position: absolute;
    top: 50px;
    width: 100%;
    z-index: 999 !important;
}

#loginNotifications {
    width: 500px;
    margin: auto;
    position: relative;
    top: -4px;
}

.notification {
    padding: 20px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: rgba(0,0,0,0.4) 0 3px 1px;
}

.notification > *{
    vertical-align: middle;
}
.notification .close {
    position: absolute;
    padding: 15px;
    top: 7px;
    right: 0;
}

/* notification icons */
.notification .dialogIcon {
    font-size: 1.2em;
    top: -1px;
}

.notification .title{
    font-size: 1.3em;
    font-weight: bold;
}

.notification .message {
    padding-left: 10px;
}

.notification.bg-info .dialogIcon {
    color: #7890b6;
}
.notification.bg-success {
    background-color: #B2E0FF;
}
.notification.bg-success .dialogIcon {
    color: #0084DB;
}
.notification.bg-danger .dialogIcon {
    color: #7A0000;
}

/* animate dialogIcon to show that it's working */
.notification.bg-info .dialogIcon {
    animation: throb 3s infinite;
    -webkit-animation: throb 3s infinite;
    -moz-animation: throb 3s infinite;
}
@keyframes throb {
  0%   { opacity: 1; }
  10%  { opacity: .5;}
  20% { opacity: 1; }
}
@-webkit-keyframes throb {
  0%   { opacity: 1; }
  10%  { opacity: .5;}
  20% { opacity: 1; }
}
@-moz-keyframes throb {
  0%   { opacity: 1; }
  10%  { opacity: .5;}
  20% { opacity: 1; }
}

/* NOTIFICATION OVERRIDES */
.modal-notify .notification {
    position: relative;
    box-shadow: rgba(0,0,0,0.4) 0 0px 4px inset;
}

.spinner {
    display: inline-block;
    opacity: 0;
    width: 0;

    -webkit-transition: opacity 0.25s, width 0.25s;
    -moz-transition: opacity 0.25s, width 0.25s;
    -o-transition: opacity 0.25s, width 0.25s;
    transition: opacity 0.25s, width 0.25s;
}

.has-spinner.active {
    cursor:progress;
}

.has-spinner.active .spinner {
    opacity: 1;
    width: auto; /* This doesn't work, just fix for unkown width elements */
}

.has-spinner.active .spinner {
    opacity: 1;
    width: 16px;
    max-width: 50px; /* More than it will ever come, notice that this affects on animation duration */
}

.icon-spin {
    display: inline-block;
    -moz-animation: spin 1s infinite linear;
    -o-animation: spin 1s infinite linear;
    -webkit-animation: spin 1s infinite linear;
    animation: spin 1s infinite linear;
}

@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}

.clearLink{
    cursor: pointer;
}

.messagesTitle{
    margin-bottom: 10px;
}
.unreadMessage{
    font-weight: bold;
    cursor: pointer;
}

.message .glyphicon{
    margin-right: 7px;
}

.messageCounter {
    display: inline-block;
    width: 25px;
    text-align: center;
    background-color: #AAA;
    color: white;
    border-radius: 15px;
    margin-right: 10px;
}

.readMessage .glyphicon{
    color: #CCC;
}

health-icon {
    display: block;
    position: relative;
    margin-left: 4px;
    width: 24px;
    height: 22px;
    overflow: hidden;
    cursor: default;
}
health-icon.wide {
    width: 75px;
}
health-icon.zoom {
    animation: zoom .3s;
    -webkit-animation: zoom .3s;
    -moz-animation: zoom .3s;
}
@-webkit-keyframes zoom {
    0% { -webkit-transform: scale(1, 1); }
    50% { -webkit-transform: scale(1.5, 1.5); }
    100% { -webkit-transform: scale(1, 1);  }
}
@-moz-keyframes zoom {
    0% { -moz-transform: scale(1, 1); }
    50% { -moz-transform: scale(1.5, 1.5); }
    100% { -moz-transform: scale(1, 1);  }
}

@keyframes zoom {
    0% { transform: scale(1, 1); }
    50% { transform: scale(1.5, 1.5); }
    100% { transform: scale(1, 1);  }
}

health-icon {
    transition: width .35s;
}

.healthIcon {
    font-size: 22px;
    position: absolute;
    top: -2px;
    left: 1px;
}
.healthIconBadge {
    font-size: .9em;
    font-weight: bold;
    display: inline-block;
    vertical-align: top;
    position: absolute;
    top: 3px;
    left: 26px;
}

/* NOTE: hardcoding glyphicon glyphs here to make CSS simpler.
 * Changes to glyphicons or angular could cause this to break */
.passed>.healthIcon:before{
    color: #0084DB;
    content: "\e084";
}
.failed>.healthIcon:before{
    color: #9C1200;
    content: "\e101";
}
.unknown>.healthIcon:before{
    color: #94C0DB;
    content: "\e063";
}
.not_running>.healthIcon:before{
    color: #AAA;
    content: "\e082";
}
.emergency_shutdown>.healthIcon:before{
    color: #9C1200;
    content: "\e090";
}

.appName {
    position: relative;
}

.appName .healthIcon {
    top: 3px;
    font-size: 0.9em;
}

.appName>.link.emergency_shutdown {
    color: #9C1200;
    margin-left: 20px;
}

h3 health-icon {
    top: 2px;
    width: 24px !important;
}
h3 .healthIconBadge {
    display: none !important;
}
h3 .healthTooltipDetailRow {
    padding-bottom: 4px;
}
h3 .healthTooltipDetailRow .healthIcon {
    top: -1px;
}

/* service state styles */

.svcstate {
    display: inline-block;
    font-style: italic;
    line-height: 13px;
    min-width: 90px;
    text-transform: capitalize;
}

    .svcstate.running,
    .svcstate.started {
        color: #0084DB;
        font-weight: bold;
        font-style: normal;
    }

    .svcstate.stopped {
        color: #aaa;
        font-style: normal;
    }

    .svcstate.pending_emergency_stop,
    .svcstate.emergency_stopped {
        color: #7A0000;
        font-weight: bold;
    }

    .svcstate.emergency_stopped {
        font-style: normal;
    }

/* service actions */

.svc-actionbar {
    color: #bbb;
    display: flex;
    font-size: 12px;
}
    .svc-actionbar > div {
        flex-basis: 100px;
    }

/* chart styles */
.nv-axis .tick text,
.nv-axis .nv-axisMaxMin {
    fill: #999;
}

.nv-axis .tick line {
    stroke-dasharray: 2,2;
}

/* hide x axis */
.nv-axis.nv-x .tick{
    opacity: 0 !important;
}

/* hide y axis label */
.nv-axis.nv-y .nv-axislabel{
    fill: transparent;
}

.zenchart {
    margin-left: -45px;
}

.zenchartContainer {
    width: calc(50% - 20px);
    margin: 10px 20px 10px 0;
    float: left;
    padding: 20px;
    box-shadow: rgba(0,0,0,.3) 0 1px 3px;
    border: solid #EEE 1px;
}
.zenchartContainer h4{
    margin: 0 0 10px 0;
    display: inline-block;
}
.zenchartContainer .graphDescrip {
    display: inline-block;
    font-size: .9em;
    color: #AAA;
    padding-left: 10px;
    border-left: solid 1px #CCC;
    margin-left: 10px;
}

.zenchart_lowlight {
    opacity: .15;
}

.zenchart_spotlight {
    opacity: 1;
    stroke-width: 4 !important;
}

.graphsControls {
    top: 0;
    right: 0;
    position: absolute;
}
.graphsControls .graphControl {
    display: inline-block;
    padding-right: 10px;
    margin-right: 10px;
    border-right: solid 1px #CCC;
}
.graphsControls .graphControl:last-of-type {
    margin-right: 0;
    padding-right: 0;
    border-right: none;
}
.graphsControls .graphControl label {
    font-weight: normal;
    font-size: .9em;
    color: #AAA;
    padding-right: 5px;
}
.graphsControls .form-control {
    display: inline-block;
    width: 120px;
    padding: 2px;
    height: auto;
}

.infoWrapper {
    position: relative;
}

input.ng-invalid.ng-dirty{
    border-color: #9C1200 !important;
}

input.ng-invalid:focus.ng-dirty:focus{
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(156, 18, 0, .6) !important;
}

.error{
    color: #9C1200;
}

.btn-link:hover{
    color: #4F83D1;
}

.modal-footer{
    margin-top: 0px;
}

.note{
    color: #666666;
    font-size: .7em;
    font-weight: bold;
}

#deployStatus{
    margin-top: 20px;
}

.version{
    font-size: .75em;
}

.ntsh {
    color: #CCC;
    font-style: italic;
}

input[type=file] {
    height: auto;
}

/* give tree-expansion cells more room for their expansion buttons */
.jelly-treetable tbody tr > td:first-child {
    padding: 0 0 0 8px;
}

.jelly-search {
    float:right;
    margin: 19px 0 8px 0;
    width: 200px;
}
    .jelly-search input {
        height: 29px;
    }

.jelly-treetable .jelly-row-loader {
    background: url(/static/img/loading.gif) center center no-repeat;
    background-size: 140px;
    height: 33px;
}
    .jelly-treetable .jelly-row-loader:hover > td {
        background-color: transparent;
    }

.table-collapse {
    font-size: 8px;
    padding: 6px 13px 12px 0;
    vertical-align: middle;
    cursor: pointer;
}

.messageMeta{
    width: 30%;
    float: left;
}

.messageBody{
   width: 70%;
   float: left;
}
/* stealthy input fields */
.stealthInput {
    display: block;
    position: relative;
    border: solid 1px transparent;
    border-bottom-color: #CCC;
}
.stealthInput.disabled {
    border-bottom-color: transparent;
    opacity: 1;
}
.stealthInput.isEditing {
    border: solid 1px #CCC;
    background-color: white;
}

.stealthInput input {
    position: relative;
    border: none;
    padding: 2px;
    padding-right: 14px;
    outline: none;
    background-color: transparent;
    text-overflow: ellipsis;
}

.stealthInput .controls {
    opacity: 0;
    top: -1px;
    position: absolute;
    padding: 1px 4px 0;
    right: 0px;
    background-color: white;
    border: solid #CCC 1px;
    border-left: none;
    border-radius: 0 4px 4px 0;

    transition: right .2s, opacity .15s;
}

.stealthInput.isEditing.isDirty .controls {
    opacity: 1;
    right: -30px;
}

.stealthInput.isSpinning .controls {
    opacity: 0;
    right: 0;
}

.stealthInput .save,
.stealthInput .cancel {
    opacity: 0.75;
    position: relative;
    text-align: center;
    font-family: 'Glyphicons Halflings';
    top: 1px;
    cursor: pointer;
}
.stealthInput .save:hover,
.stealthInput .cancel:hover {
    opacity: 1 !important;
}

.stealthInput .save {
    color: #325385;
}
.stealthInput .cancel {
    color: #888;
}

.stealthInput .save::after{
    content: "\e084";
}
.stealthInput .cancel::after {
    content: "\e014";
}

.stealthInput .edit {
    position: absolute;
    right: 0;
    top: 4px;
    text-align: center;
    font-family: 'Glyphicons Halflings';
    font-size: .8em;
    opacity: 0;

    transition: opacity .2s;
}
.stealthInput .edit::after {
    content: "\270F";
    color: #AAA;
}
.stealthInput:hover .edit{
    opacity: 1;
}
.stealthInput.isSpinning .edit,
.stealthInput.isEditing .edit,
.stealthInput.isDirty .edit,
.stealthInput.disabled .edit {
    opacity: 0;
}

.stealthInput .dirty {
    position: absolute;
    padding: 0 4px;
    right: 0;
    top: 2px;
    text-align: center;
    opacity: 0;
    font-weight: bold;
    color: #325385;

    transition: opacity .2s;
}
.stealthInput .dirty::after {
    content: "!";
}
.stealthInput.isDirty .dirty {
    opacity: 1;
}
.stealthInput.isDirty.isEditing .dirty {
    opacity: 0;
}

.stealthInput .working{
    position: absolute;
    right: 0;
    top: 0;
    text-align: center;
    font-family: 'Glyphicons Halflings';
    opacity: 0;

    transition: opacity .2s;
    animation: spin .7s infinite linear;
    transform-origin: 50% 55%;
}
.stealthInput .working::after {
    content: "\e031";
    color: #AAA;
}
.stealthInput.isSpinning .working{
    opacity: 1;
}

@-webkit-keyframes spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}

.modal .big .CodeMirror {
    height: 500px;
}

.modal .codemirrorLoader {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,1) center center url("/static/img/loading.gif") no-repeat;
    z-index: 10;
}

.modal .CodeMirror {
    background: transparent;
}

.modal-context {
    margin-top: 2rem;
}

.modal-darkener {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    background-color: #000;

    display: none;
    opacity: 0;

    transition: opacity 0.2s;
}
.modal-darkener.show {
    display: block;
    opacity: 0.5;
}

/* backup storage modal */
.barchartwrap {
  flex-direction: column;
  font-family: sans-serif;
  display: flex;
  margin: 0 auto;
  overflow: hidden;
}
.chart-bar {
  color: #fafafa;
  font-size: 13px;
  line-height: 28px;
  flex-wrap: nowrap;
  margin: 2px 0;
}

.chart-bar.free-space {
    text-align: right;
    margin: 0;
}
    .chart-bar.free-space span {
        color: #999;
        display: inline-block;
        width: auto;
    }

.storage-value {
    font-weight: bold;
}

.chart-bar > div {
  display: flex;
  text-indent: 6px;
  width: 100vw;
}

.bar1 {
  background-color: #777;
  width: 100%;
}

.bar2 {
  background-color: #4F83D1;
  margin-top: -30px;
  transition: width 2s;
}
    .danger .bar2 {
        background-color: #9c1200;
    }

.add-backup-modal .barchartwrap {
    visibility: hidden;
}
    .add-backup-modal.ready .barchartwrap {
        visibility: visible;
    }

.add-backup-modal .assist {
    color: #333;
    padding: 20px 0;
}

.add-backup-modal .jelly-table {
    height: calc(100% - 15px);
    margin-top: -20px;
    width: 100%;
}
.add-backup-modal .path {
    font-size: 12px;
    font-weight: normal;
}

.add-backup-modal .will-robinson {
    display: none;
}
    .add-backup-modal.danger .assist {
        display: none;
    }
    .add-backup-modal.danger .will-robinson {
        display: block;
    }

/* sticky service controls */
.serviceDetails {
    height: 93px;
}
.serviceDetails .serviceControls {
    height: 45px;
    position: relative;
    border-bottom: solid 1px #0084DB;
    background-color: white;
    z-index:100;
    padding: 4px 0;
}
.serviceDetails .serviceActions {
    position: absolute;
    right: 0;
    bottom: 4px;
}
.serviceDetails .serviceTitle {
    position: relative;
    margin: 0;
}
.serviceDetails .serviceDescription {
    padding: 4px;
    color: #999;
}
.serviceDetails .serviceBoxGradient {
    opacity: 0;
    height: 7px;
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;

    background: -moz-linear-gradient(top,  rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.3)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(0,0,0,0.3) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(0,0,0,0.3) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(0,0,0,0.3) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(0,0,0,0.3) 0%,rgba(0,0,0,0) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */

    transition: opacity .5s;
    -webkit-transition: opacity .5s;
    -moz-transition: opacity .5s;
}
.serviceControls.stickied .serviceBoxGradient{
    opacity: 1;
}

.warningMessage {
    color: #0084DB;
    font-size: .9em;
}

.graphConfigPopover {
    width: 250px;
    position: absolute;
    right: 5px;
    top: 30px;
    font-size: .9em;
    border: solid #CCC 1px;
    border-radius: 3px;
    padding: 10px;
    background-color: white;
    z-index: 1;

    -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.125);
    -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.125);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.125);
}
.graphConfigPopover .formLabel {
    display: block;
    margin-bottom: 2px;
}
.graphConfigPopover .formField {
    width: 100%;
    margin-bottom: 5px;
}
.graphConfigPopover .startEndWrapper {
    border: solid 1px #CCC;
    border-width: 1px 0;
    margin-bottom: 10px;
    padding: 5px 0;
}
.graphConfigPopover:before {
    content: "";
    position: absolute;
    top: -10px;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #CCC;
}
.graphConfigPopover:after {
    content: "";
    position: absolute;
    top: -9px;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}
.graphPanel {
    display: block;
    position: relative;
}

/* jelly table */
.jelly-table table {
    position: relative;
    clear: both;
}

.jelly-table .loader{
    background: rgba(255,255,255,.9) center center url("/static/img/loading.gif") no-repeat;
    height: calc(100% - 59px);
    left: 0;
    min-height: 65px;
    margin: auto;
    opacity: 1;
    overflow: hidden;
    position: absolute;
    text-align: center;
    top: 30px;
    transition: opacity .25s;
    width: 100%;
}
.jelly-table .loader:hover {
    background-color: rgba(255,255,255,.9);
}
.jelly-table .loader.disappear {
    opacity: 0;
}
.jelly-table .loader td {
    border: none;
}
.jelly-table .loader:hover td {
    background-color: transparent;
}

.jelly-table .noData {
    font-size: 1.4em;
}
.jelly-table .noData td {
    padding: 6px;
}

.jelly-table .statusBar {
    color: #CCC;
    font-size: .9em;
    padding: 7px 0 0 0;
    text-align: right;
    border: none;
    cursor: default;
}
    .jelly-table .has-pagination .statusBar {
        padding-top: 15px;
    }

.jelly-table .statusBar ul {
    justify-content: space-between;
    display: flex;
    flex: 1 1 100%;
    margin: 0;
    padding: 0 0 40px 0;
    height: 50px;
}

.jelly-table .statusBar ul > li {
    list-style: none;
}

.jelly-table .statusBar .entry strong {
    color: #999;
}

.jelly-table .sort-indicator {
    display: inline-block;
}

/* pagination */

.jelly-pager {
    display: flex;
    justify-content: center;
}

.pagination.jelly-pagination {
    margin: -68px 0 0 0;
    padding: 0;
    height: 30px;;
}

.pagination.jelly-pagination > li > a {
    border-radius: 4px;
    color: #325385;
    display: inline-block;
    font-size: 13px;
    height: 30px;
    line-height: 28px;
    margin: 1px;
    min-width: 30px;
    padding: 0;
    text-align: center;
}

.pagination.jelly-pagination > .active > a,
.pagination.jelly-pagination > .active > a:hover {
    background-color: #607d9a;
    border-color: transparent;
    color: #fff;
    font-weight: bold;
}

.pagination.jelly-pagination a {
    background-color: transparent;
    border: 1px solid transparent;
}

.pagination.jelly-pagination .disabled a,
.pagination.jelly-pagination .disabled a:hover {
    background-color: transparent;
    border-color: transparent;
    color: #bbb;
    cursor: default;
}

.pagination.jelly-pagination a:hover {
    background-color: #f0f3f7;
    color: #4F83D1;
}

.jelly-pager ul.jelly-pagination a.jelly-chevron {
    font-size: 19px;
    line-height: 17px;
    padding: 2px 7px 5px 5px;
}

.jelly-pager .pagination.jelly-pagination a.jelly-pager-more {
    color: #aaa;
    font-size: 30px;
    line-height: 12px;
    padding: 0;
    vertical-align: top;
}

.overcomIndicator {
    background: #9C1200;
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    position: relative;
    top: -1px;
    margin-left: 5px;
    opacity: 0.0;
    transition: opacity 1s;
    visibility: hidden;
}

.overcomIndicator.bad {
    opacity: 0.6;
    visibility: visible;
}

.overcomText.bad {
    color: #9C1200;
}

body.loading {
    overflow: hidden
}

.loading_wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    width: 100%;
    height: 100%;
    background-color: #8EA9D1;
    text-align: center;
    opacity: 1;
    font-family: Verdana, Arial, Helvetica, sans-serif;

    transition: opacity 0.2s ease-in;
}
.loading_wrapper .animated_logo {
    transition: transform 0.5s cubic-bezier(.42,-0.47,.38,1.33);
}
.loading_wrapper.hide_it {
    opacity: 0;
}
.loading_wrapper.hide_it .animated_logo {
    transform: scale(0.2, 0.2);
}
.loading_wrapper .loading_body {
    margin-top: -5px;
    font-weight: bold;
    font-size: 1.4em;
}

body.no-animation *,
body.no-animation *:before,
body.no-animation *:after {
    transition-property: none !important;
    -o-transition-property: none !important;
    -moz-transition-property: none !important;
    -ms-transition-property: none !important;
    -webkit-transition-property: none !important;

    transform: none !important;
    -o-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -webkit-transform: none !important;

    animation: none !important;
    -o-animation: none !important;
    -moz-animation: none !important;
    -ms-animation: none !important;
    -webkit-animation: none !important;

    transition: none !important;
}

.uilock {
    position: fixed;
    left: 10px;
    bottom: 10px;
    color: #CCC;
}
.uilock:before {
    font-family: 'Glyphicons Halflings';
    -webkit-font-smoothing: antialiased;
    font-style: normal;
    font-weight: normal;
    content: "\e031";
}

.instructions-block {
    font-size: 1.1em;
}

.permission-tag {
    cursor: default;
}
.permission-tag::after {
    content: ",";
    padding-right: 2px;
}
.permission-tag:last-of-type::after {
    content: "";
    padding-right: 0;
}


text:
var fetchResponse;
describe("Export table", function() {
  var export_dialog, sqlView, table;
  beforeEach(function() {
    var schema = [
      ['test', 'number'],
      ['test2', 'string'],
      ['the_geom', 'geometry'],
    ]
    table = TestUtil.createTable('test', schema);
    fetchResponse = true;
    table.fetchGeoreferenceQueryStatus = function() {
      return {
        done: function(f) {
          f(fetchResponse);
          return {
            fail: function() {}
          }
        }
      }
    }

    this.config = {
      "sql_api_protocol":"http",
      "sql_api_domain":"admin.localhost.lan",
      "sql_api_endpoint":"/api/v1/sql",
      "sql_api_port":8080
    };
    this.user_data = {
      api_key: 'ciruelo_big_key'
    };
    export_dialog = new cdb.admin.ExportTableDialog({
      model: table,
      config: this.config,
      user_data: this.user_data
    });
    export_dialog.submit = function() {
      this.submited = true;
      this.dataSubmited = this.$('form').serializeArray();
    }
    export_dialog.baseUrl = 'dummy'
    export_dialog._MAX_SQL_GET_LENGTH = 1;
    this.server = sinon.fakeServer.create();
    this.server.respondWith("POST", "dummy",
                                [200, { "Content-Type": "application/json" },
                                 '{ "response": true }']);
    this.server.respondWith("GET", "dummy",
                                [500, { "Content-Type": "application/json" },
                                 '{ "response": false }']);
  });

  afterEach(function(){
    this.server.restore();
  })

  it("should open the export dialog", function() {
    export_dialog.render();
    expect(export_dialog.$el.find(".modal:eq(0) div.head h3").text()).toEqual('Select your file type');
    expect(export_dialog.$el.find(".modal:eq(0) nav a").size()).toEqual(5);
  });

  it("should create the form", function() {
    export_dialog.render();
    expect(export_dialog.$el.find('form').attr('action')).toEqual('dummy');
  })

  it("should submit the form when clicked and the sql is bigger than _MAX_SQL_GET_LENGTH", function() {
    export_dialog.render();
    export_dialog.$el.find('*[data-format="csv"]').click();
    expect(export_dialog.submited).toBeTruthy();
  })

  it("should set the filename of the exported file and make it equal to the table's name in th sqlView", function() {
    table.sqlView = true;

    export_dialog.render();
    var options = export_dialog.getBaseOptions();
    expect(options.filename).toEqual(table.get("name"));
  })

  it("should not submit the form when clicked and the sql is bigger than _MAX_SQL_GET_LENGTH", function() {
    export_dialog._MAX_SQL_GET_LENGTH = 99999;
    export_dialog.render();
    var called = false;
    export_dialog._fetchGET = function(){called = true};
    export_dialog.$el.find('*[data-format="csv"]').click();
    expect(export_dialog.submited).toBeFalsy();
  })

  it("should fetch by get when sql is less than _MAX_SQL_GET_LENGTH", function() {
    export_dialog._MAX_SQL_GET_LENGTH = 99999;
    export_dialog.render();
    var called = false;
    export_dialog._fetchGET = function(){called = true};
    export_dialog.$el.find('*[data-format="csv"]').click();
    expect(called).toBeTruthy();
  })

  it("should pass the correct parameters when csv is clicked", function() {
    export_dialog.render();
    export_dialog.$el.find('*[data-format="csv"]').click();
    var submitedData = {};
    for(var i in export_dialog.dataSubmited) {
      var obj = export_dialog.dataSubmited[i];
      submitedData[obj.name] = obj.value;
    }

    expect(submitedData['skipfields']).toEqual('the_geom_webmercator');
    expect(submitedData['dp']).toEqual(undefined);
  })

  it("should pass the correct parameters when svg is clicked", function() {
    export_dialog.render();
    export_dialog.$el.find('*[data-format="svg"]').click();
    var submitedData = {};
    for(var i in export_dialog.dataSubmited) {
      var obj = export_dialog.dataSubmited[i];
      submitedData[obj.name] = obj.value;
    }

    expect(submitedData['skipfields']).toEqual(undefined);
    expect(submitedData['dp']).toEqual(undefined);
  })

  it("should pass the correct parameters when geoJson is clicked", function() {
    export_dialog.render();
    export_dialog.$el.find('*[data-format="geojson"]').click();
    var submitedData = {};
    for(var i in export_dialog.dataSubmited) {
      var obj = export_dialog.dataSubmited[i];
      submitedData[obj.name] = obj.value;
    }

    expect(submitedData['skipfields']).toEqual(undefined);
    expect(submitedData['dp']).toEqual(undefined);
  })

  it("should return correct geoformat obj", function() {
    var geo = export_dialog.formats[2];
    var geo2 = export_dialog.getFormat(geo.format);
    expect(_.isEqual(geo, geo2)).toBeTruthy();
  })

  it("should call csv fetcher when csv is clicked", function() {
    export_dialog.render();
    spyOn(export_dialog, 'fetchCSV');
    export_dialog.$el.find('*[data-format="csv"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetchCSV).toHaveBeenCalled();
  })

  it("should call svg fetcher when svg is clicked", function() {
    export_dialog.render();
    spyOn(export_dialog, 'fetchSVG');
    export_dialog.$el.find('*[data-format="svg"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetchSVG).toHaveBeenCalled();
  })

  it("should call plain fetcher when geoJson is clicked", function() {
    export_dialog.render();
    spyOn(export_dialog, 'fetch');
    export_dialog.$el.find('*[data-format="geojson"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetch).toHaveBeenCalled();
  })

  it("should detect if the table is georeferenced and refresh", function() {
    var called = false;

    export_dialog.refresh = function() { called = true;}
    table.set('geometry_types', ['st_point']);
    expect(called).toBeTruthy();
  })

  it("should not show a warning if the table is georeferenced", function() {
    export_dialog.render();
    expect(export_dialog.$('.geospatial').is('.hidden')).toBeTruthy();;
  })

  it("should not show generation warning when rendered", function() {
    export_dialog.render();
    expect(export_dialog.$('.generating').is(':visible')).toBeFalsy();;
  })

  it("should show a warning after click", function() {
    export_dialog.render();
    export_dialog.$el.find('*[data-format="svg"]').click();
    this.server.respond();

    expect(export_dialog.$('.generating').is(':visible')).toBeFalsy();;
  })

  it("should not show a warning if the table is NOT georeferenced after a click", function() {
    table.set("schema", ['dubidubidua', 'string']);
    export_dialog.render();
    export_dialog.$el.find('*[data-format="svg"]').click();
    expect(export_dialog.$('.geospatial').is(':visible')).toBeFalsy();;
  })

  it("should not call svg fetcher if there are not the_geom", function() {
    fetchResponse  = false;
    table.set('geometry_types', []);
    sinon.spy(export_dialog, 'fetchSVG');
    export_dialog.$el.find('*[data-format="svg"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetchSVG.calledOnce).toBeFalsy();
    export_dialog.fetchSVG.restore();
  })

  it("should not call geojson fetcher if there are not the_geom", function() {
    table.set("schema", ['dubidubidua', 'string']);
    table.set('geometry_types', []);
    sinon.spy(export_dialog, 'fetch');
    export_dialog.$el.find('*[data-format="geojson"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetch.calledOnce).toBeFalsy();
    export_dialog.fetch.restore();
  })

  it("should not call shp fetcher if there are not the_geom", function() {
    table.set("schema", ['dubidubidua', 'string']);
    table.set('geometry_types', []);
    sinon.spy(export_dialog, 'fetch');
    export_dialog.$el.find('*[data-format="shp"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetch.calledOnce).toBeFalsy();
    export_dialog.fetch.restore();
  })

  it("should call csv fetcher when csv is clicked even if there's not the_geom", function() {
    table.set("schema", ['dubidubidua', 'string']);
    export_dialog.render();
    sinon.spy(export_dialog, 'fetchCSV');
    export_dialog.$el.find('*[data-format="csv"]').click();
    var response = this.server.respond();
    expect(export_dialog.fetchCSV.calledOnce).toBeTruthy();
    export_dialog.fetchCSV.restore();
  })

  it("should use passed sql if provided", function() {
    export_dialog2 = new cdb.admin.ExportTableDialog({
      model: table,
      config: this.config,
      user_data: this.user_data,
      sql: "fakeSql"
    });
    expect(export_dialog2.getPlainSql()).toEqual('fakeSql')
  })

  it("should use gererate base sql if not provided", function() {
    expect(export_dialog.getPlainSql()).toEqual('select * from test')
  })

  it("should use the sql from the sqlView", function() {
    var sqlView = new cdb.admin.SQLViewData(null, { sql: 'select * from wadus limit 1' });
    table.useSQLView(sqlView);
    expect(export_dialog.getPlainSql()).toEqual('select * from wadus limit 1')
  })

  it("csv sql should return be a plain sql if not georeferenced", function() {
    table.set("schema", ['dubidubidua', 'string']);
    fetchResponse = false;
    table.set('geometry_types', []);
    expect(export_dialog.getGeomFilteredSql()).toEqual('select * from test')
  })

  it("should wrap csv sql if georeferenced", function() {
    var wrappedSql = export_dialog._CSV_FILTER.replace(/%%sql%%/g, 'select * from test');
    expect(export_dialog.getGeomFilteredSql()).toEqual(wrappedSql)
  });

  it("should close the dialog on click if initialized with the autoClose param", function() {
    export_dialog.options.autoClose = true;
    export_dialog.render();
    sinon.spy(export_dialog, 'hide');
    export_dialog.$el.find('*[data-format="svg"]').click();
    this.server.respond();

    expect(export_dialog.hide.called).toBeTruthy();;
  });

});