Construct set of port bindings from comma delimited list of ports.
@param portSpecs
@param exposedPorts
@param context
@return
9062
private Ports getPortBindings(String portSpecs, ExposedPort[] exposedPorts, TestContext context) {
        String[] ports = StringUtils.commaDelimitedListToStringArray(portSpecs);
        Ports portsBindings = new Ports();

        for (String portSpec : ports) {
            String[] binding = context.replaceDynamicContentInString(portSpec).split(":");
            if (binding.length == 2) {
                Integer hostPort = Integer.valueOf(binding[0]);
                Integer port = Integer.valueOf(binding[1]);

                portsBindings.bind(Stream.of(exposedPorts).filter(exposed -> port.equals(exposed.getPort())).findAny().orElse(ExposedPort.tcp(port)), Ports.Binding.bindPort(hostPort));
            }
        }

        Stream.of(exposedPorts).filter(exposed -> !portsBindings.getBindings().keySet().contains(exposed)).forEach(exposed -> portsBindings.bind(exposed, Ports.Binding.empty()));

        return portsBindings;
    }
915565
public static int mapPort(Map<Integer, Integer> mapping, int port) {
    Integer mappedPort = mapping.get(port);
    if( mappedPort == null ) throw new RuntimeException("Could not map port "+port);
    return mappedPort;
  }
281513
private Set<String> containerExposedPorts() {
    final Set<String> ports = Sets.newHashSet();
    for (final Map.Entry<String, PortMapping> entry : job.getPorts().entrySet()) {
      final PortMapping mapping = entry.getValue();
      ports.add(containerPort(mapping.getInternalPort(), mapping.getProtocol()));
    }
    return ports;
  }
866821
public function setExposedPorts(array $exposedPorts)
    {
        $this->ExposedPorts = $exposedPorts;

        $this->raw = array_merge($this->raw, ['ExposedPorts' => $exposedPorts]);

        return $this;
    }
562631
private Set<String> checkPreResolvedExistAndSetFullName(Set<String> preResolved, SelectionContext selectionContext) {
        Set<String> preResolvedSymbolicNames = new LinkedHashSet<String>(preResolved.size());
        for (String preResolvedFeatureName : preResolved) {
            ProvisioningFeatureDefinition preResolvedDef = selectionContext.getRepository().getFeature(preResolvedFeatureName);
            if (preResolvedDef == null) {
                return Collections.emptySet();
            } else {
                preResolvedSymbolicNames.add(preResolvedDef.getSymbolicName());
            }
        }
        return preResolvedSymbolicNames;
    }
1138345
public List<Integer> bind(Integer... ports) {
        String boundPorts = sendRequest(request().withMethod("PUT").withPath(calculatePath("bind")).withBody(portBindingSerializer.serialize(portBinding(ports)), StandardCharsets.UTF_8)).getBodyAsString();
        return portBindingSerializer.deserialize(boundPorts).getPorts();
    }
521465
private void configureClientProperties() throws IOException {
        Map<String, String> serviceRefProps = wsrInfo.getProperties();
        Iterator<QName> iterator = this.getPorts();//wsrInfo.getBindingPortComponentRefInfoList();

        while (null != iterator && iterator.hasNext()) {
            QName portQName = iterator.next();
            PortComponentRefInfo portInfo = wsrInfo.getPortComponentRefInfo(portQName);
            Map<String, String> portProps = (null != portInfo) ? portInfo.getProperties() : null;

            if ((null != serviceRefProps || null != portProps)) {
                prepareProperties(portQName, serviceRefProps, portProps);
            }
        }
    }
515142
func WithExposedPorts(ports ...string) func(*TestContainerConfig) {
	return func(c *TestContainerConfig) {
		c.Config.ExposedPorts = map[nat.Port]struct{}{}
		for _, port := range ports {
			c.Config.ExposedPorts[nat.Port(port)] = struct{}{}
		}
	}
}
1139360
public AerospikeDeepJobConfig<T> port(Integer[] ports) {
        this.portList.addAll(Arrays.asList(ports));
        return this;
    }
1351809
def _parse_ports(port_values: dict) -> dict:
        
        # Initialising empty dictionary
        endpoints = {}

        for port_element in port_values:
            target_port = port_element.split(':')
            for port in target_port:
                endpoints[int(port)] = int(port)

        # Setting the types
        endpoint_spec = docker.types.EndpointSpec(ports=endpoints)
        return endpoint_spec
992837
def referenced_ports(self):
        
        from mbuild.port import Port
        return [port for port in self.labels.values()
                if isinstance(port, Port)]
963619
def get_route_templates(self):
        
        def _get_published_ports(service_config):
            result = []
            for port in service_config.get('ports', []):
                protocol = 'TCP'
                if isinstance(port, string_types) and '/' in port:
                    port, protocol = port.split('/')
                if isinstance(port, string_types) and ':' in port:
                    host, container = port.split(':')
                else:
                    host = port
                result.append({'port': host, 'protocol': protocol.lower()})
            return result

        templates = []
        for name, service_config in self._services.items():
            state = service_config.get(self.CONFIG_KEY, {}).get('state', 'present')
            force = service_config.get(self.CONFIG_KEY, {}).get('force', False)
            published_ports = _get_published_ports(service_config)

            if state != 'present':
                continue

            for port in published_ports:
                route_name = "%s-%s" % (name, port['port'])
                labels = dict(
                    app=self._namespace_name,
                    service=name
                )
                template = CommentedMap()
                template['apiVersion'] = self.DEFAULT_API_VERSION
                template['kind'] = 'Route'
                template['force'] = force
                template['metadata'] = CommentedMap([
                    ('name', route_name),
                    ('namespace', self._namespace_name),
                    ('labels', labels.copy())
                ])
                template['spec'] = CommentedMap([
                    ('to', CommentedMap([
                        ('kind', 'Service'),
                        ('name', name)
                    ])),
                    ('port', CommentedMap([
                        ('targetPort', 'port-{}-{}'.format(port['port'], port['protocol']))
                    ]))
                ])

                if service_config.get(self.CONFIG_KEY, {}).get('routes'):
                    for route in service_config[self.CONFIG_KEY]['routes']:
                        if str(route.get('port')) == str(port['port']):
                            for key, value in route.items():
                                if key not in ('force', 'port'):
                                    self.copy_attribute(template['spec'], key, value)

                templates.append(template)

        return templates
1230566
public static List<FactoryModel> factories(BundleContext context) {
        List<FactoryModel> factories = new ArrayList<FactoryModel>();
        try {
            for (ServiceReference ref : context.getServiceReferences(Factory.class, null)) {
                factories.add(new FactoryModel((Factory) context.getService(ref)));
            }
            for (ServiceReference ref : context.getServiceReferences(HandlerFactory.class, null)) {
                factories.add(new FactoryModel((Factory) context.getService(ref)));
            }
        } catch (InvalidSyntaxException e) { //NOSONAR
            // Ignore it.
        }
        return factories;
    }
815800
public List<PortComponentRefType<ServiceRefType<T>>> getAllPortComponentRef()
   {
      List<PortComponentRefType<ServiceRefType<T>>> list = new ArrayList<PortComponentRefType<ServiceRefType<T>>>();
      List<Node> nodeList = childNode.get("port-component-ref");
      for(Node node: nodeList)
      {
         PortComponentRefType<ServiceRefType<T>>  type = new PortComponentRefTypeImpl<ServiceRefType<T>>(this, "port-component-ref", childNode, node);
         list.add(type);
      }
      return list;
   }
951226
public void setPublicPorts(java.util.Collection<Integer> publicPorts) {
        if (publicPorts == null) {
            this.publicPorts = null;
            return;
        }

        this.publicPorts = new java.util.ArrayList<Integer>(publicPorts);
    }
222920
def p_instance_port_list(self, p):
        ''
        p[0] = PortArg(None, p[1], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
1139029
static void extractPorts(final Map<String, Integer> input, final Map<ServiceType, Integer> ports,
        final Map<ServiceType, Integer> sslPorts) {
        for (Map.Entry<String, Integer> entry : input.entrySet()) {
            String service = entry.getKey();
            int port = entry.getValue();
            if (service.equals("mgmt")) {
                ports.put(ServiceType.CONFIG, port);
            } else if (service.equals("capi")) {
                ports.put(ServiceType.VIEW, port);
            } else if (service.equals("kv")) {
                ports.put(ServiceType.BINARY, port);
            } else if (service.equals("kvSSL")) {
                sslPorts.put(ServiceType.BINARY, port);
            } else if (service.equals("capiSSL")) {
                sslPorts.put(ServiceType.VIEW, port);
            } else if (service.equals("mgmtSSL")) {
                sslPorts.put(ServiceType.CONFIG, port);
            } else if (service.equals("n1ql")) {
                ports.put(ServiceType.QUERY, port);
            } else if (service.equals("n1qlSSL")) {
                sslPorts.put(ServiceType.QUERY, port);
            } else if (service.equals("fts")) {
                ports.put(ServiceType.SEARCH, port);
            } else if (service.equals("ftsSSL")) {
                sslPorts.put(ServiceType.SEARCH, port);
            } else if (service.equals("cbas")) {
                ports.put(ServiceType.ANALYTICS, port);
            } else if (service.equals("cbasSSL")) {
                sslPorts.put(ServiceType.ANALYTICS, port);
            }
        }
    }